Commits

Anonymous committed fd3c4b5

fixes

Comments (0)

Files changed (1)

         target = choice(nodes)
         while target == start:
             target = choice(nodes)
-        if fullroute:
+        if fullroutes:
             route = findroute(target, start, net, maxhtl=9999)
         else:
             route = findroute(target, start, net, maxhtl=maxhtl)
             # in case we break the route at maxhtl, we just add the
             # HTL+1 to be able to do the simplistic success stats
             # later.
-            if not fullroute:
+            if not fullroutes:
                 routelengths.append(maxhtl+1)
             continue
         routelen = len(route)
     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("--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")
     parser.add_argument("-o", "--output", help="Filename of the pylab plot.", default="plot.png")
     return parser.parse_args()
 
         lensnapshots[(run,0)] = linklengths(net), [0]
         print (np.mean(lensnapshots[(run,0)][0]))
         print("===", run, "===")
-        routelengths = fold(net, 20)
+        routelengths = fold(net, foldperstep, args.strategy, args.maxhtl, fullroutes=not args.nofullroutes)
         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):
             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)))
 
+    print()
     # now plot the data
     import pylab as pl
     pl.rcParams['font.size'] = 5