succ: <= htl
diff --git a/sim.py b/sim.py --- a/sim.py +++ b/sim.py @@ -484,12 +484,12 @@ if __name__ == "__main__": print("===", run, "===") routelengths = fold(net, 20) linklens = linklengths(net) - print (np.mean(linklens), np.mean(routelengths), "±", np.std(routelengths), "succ", len([r for r in routelengths if r < 20])/len(routelengths), min(routelengths), max(routelengths), sum(deviationfromsmallworld(linklens, numbins=10))) + 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) 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 < 20])/len(routelengths), + 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))) # now plot the data @@ -501,9 +501,9 @@ if __name__ == "__main__": # only plot one in 10 results if i % 10 and i != 1: continue - succ = len([r for r in routelen if r < 20])/len(routelen) + succ = len([r for r in routelen if r < args.maxhtl])/len(routelen) pl.hist(linklen, 10000, cumulative=True, normed=True, histtype='step', label=str(run) + ", " + "{:}".format(i*foldperstep) + ", len: " + "{:.2f}".format(np.mean(routelen)) + ", succ: " + "{:.2f}".format(succ)) pl.semilogx() pl.legend(loc="upper left") - pl.title(str(args.size) + " nodes, " + str(args.connections) + " connections per node, optimized with strategy " + args.strategy) + pl.title(str(args.size) + " nodes, " + str(args.connections) + " connections per node, optimized with strategy " + args.strategy + ". succ: found in max " + str(args.maxhtl) + " steps.") pl.savefig(args.output)