diff options
author | Nils Gillmann <ng0@n0.is> | 2018-05-17 15:15:44 +0000 |
---|---|---|
committer | Nils Gillmann <ng0@n0.is> | 2018-05-17 15:15:44 +0000 |
commit | 36a3e39e84cae138dc944755134c81103daca598 (patch) | |
tree | daea923b694e74e660714225d6abb86a62e0e8aa /src/consensus | |
parent | 5f53f5bbf0df72a67bddfc4815a1da7301dd46db (diff) | |
download | gnunet-36a3e39e84cae138dc944755134c81103daca598.tar.gz gnunet-36a3e39e84cae138dc944755134c81103daca598.zip |
follow-up
Signed-off-by: Nils Gillmann <ng0@n0.is>
Diffstat (limited to 'src/consensus')
-rw-r--r-- | src/consensus/consensus-simulation.py.in | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/consensus/consensus-simulation.py.in b/src/consensus/consensus-simulation.py.in index 71a91302e..fbad9f678 100644 --- a/src/consensus/consensus-simulation.py.in +++ b/src/consensus/consensus-simulation.py.in | |||
@@ -21,7 +21,7 @@ from __future__ import absolute_import | |||
21 | from __future__ import print_function | 21 | from __future__ import print_function |
22 | import argparse | 22 | import argparse |
23 | import random | 23 | import random |
24 | from math import ceil,log,floor | 24 | from math import ceil, log, floor |
25 | 25 | ||
26 | 26 | ||
27 | def bsc(n): | 27 | def bsc(n): |
@@ -57,7 +57,7 @@ def simulate(k, n, verbose): | |||
57 | arc = 1 | 57 | arc = 1 |
58 | while arc <= largest_arc: | 58 | while arc <= largest_arc: |
59 | if verbose: | 59 | if verbose: |
60 | prin( "-- subround --") | 60 | print("-- subround --") |
61 | new_info = [x for x in info] | 61 | new_info = [x for x in info] |
62 | for peer_physical in xrange(n): | 62 | for peer_physical in xrange(n): |
63 | peer_logical = peers[peer_physical] | 63 | peer_logical = peers[peer_physical] |
@@ -71,7 +71,7 @@ def simulate(k, n, verbose): | |||
71 | if peer_logical & arc == 0: | 71 | if peer_logical & arc == 0: |
72 | # we are outgoing | 72 | # we are outgoing |
73 | if verbose: | 73 | if verbose: |
74 | print peer_physical, "connects to", partner_physical | 74 | print(peer_physical, "connects to", partner_physical) |
75 | peer_type = "outgoing" | 75 | peer_type = "outgoing" |
76 | if peer_logical < num_ghosts: | 76 | if peer_logical < num_ghosts: |
77 | # we have a ghost, check if the peer who connects | 77 | # we have a ghost, check if the peer who connects |
@@ -86,7 +86,7 @@ def simulate(k, n, verbose): | |||
86 | if verbose > 1: | 86 | if verbose > 1: |
87 | print("type of", str(peer_physical) + ":", peer_type) | 87 | print("type of", str(peer_physical) + ":", peer_type) |
88 | info = new_info | 88 | info = new_info |
89 | arc = arc << 1; | 89 | arc = arc << 1 |
90 | rounds = rounds + 1 | 90 | rounds = rounds + 1 |
91 | random.shuffle(peers) | 91 | random.shuffle(peers) |
92 | return rounds | 92 | return rounds |
@@ -100,7 +100,7 @@ if __name__ == "__main__": | |||
100 | parser.add_argument('--verbose', '-v', action='count') | 100 | parser.add_argument('--verbose', '-v', action='count') |
101 | 101 | ||
102 | args = parser.parse_args() | 102 | args = parser.parse_args() |
103 | sum = 0.0; | 103 | sum = 0.0 |
104 | for n in xrange (0, args.r): | 104 | for n in xrange(0, args.r): |
105 | sum += simulate(args.k, args.n, args.verbose) | 105 | sum += simulate(args.k, args.n, args.verbose) |
106 | print(sum / args.r) | 106 | print(sum / args.r) |