._site

(Arne Babenhauserheide)
2012-07-27: added the --nofullroutes commandline parameter.

added the --nofullroutes commandline parameter.

diff --git a/sim.py b/sim.py
--- a/sim.py
+++ b/sim.py
@@ -496,6 +496,7 @@ def parse_args():
     parser.add_argument("--maxhtl", help="The maximum length of routes to be successful.", default=20, type=int)
     parser.add_argument("--steps", help="The maximum number of modelsteps.", default=60, type=int)
     parser.add_argument("--perstep", help="The number of requests to run per step.", default=100, type=int)
+    parser.add_argument("--nofullroutes", help="Don’t calculate full routes but break at maxhtl. This gives weaker statistics but is much faster for random networks with very long routes and very low success rate", action="store_true", default=False, type=bool)
     parser.add_argument("-o", "--output", help="Filename of the pylab plot.", default="plot.png")
     return parser.parse_args()
 
@@ -517,7 +518,7 @@ if __name__ == "__main__":
         linklens = linklengths(net)
         print (np.mean(linklens), np.mean(routelengths), "±", np.std(routelengths), "succ", len([r for r in routelengths if r < args.maxhtl])/len(routelengths), min(routelengths), max(routelengths), sum(deviationfromsmallworld(linklens, numbins=10)))
         for i in range(args.steps):
-            routelengths = fold(net, foldperstep, args.strategy, args.maxhtl)
+            routelengths = fold(net, foldperstep, args.strategy, args.maxhtl, fullroutes=not args.nofullroutes)
             linklens = linklengths(net)
             lensnapshots[(run, i+1)] = linklens, routelengths
             print (np.mean(linklens), np.mean(routelengths), "±", np.std(routelengths), "succ", len([r for r in routelengths if r < args.maxhtl])/len(routelengths),