diff --git a/runAllNetworks.py b/runAllNetworks.py new file mode 100644 index 0000000..669778b --- /dev/null +++ b/runAllNetworks.py @@ -0,0 +1,30 @@ +from multiprocessing import Pool +from CarController import CarController +from Map import Map + +def runSim(paths): + m = Map() + cc = CarController(m) + m.fromPath(paths[0]) + cc.fromPath(paths[1]) + cc.prepareRoute() + while cc.t < 3600: + cc.update() + newline = '\n' + return f"{paths[0]}/{paths[1]} : \ntemps d'arrĂȘt moyen : {cc.totalStopped / cc.carsDestroyed:.2f}s/voitures \nT : {cc.speedPercentageTotal / cc.carsDestroyed:.2f} \nbacklog total : {cc.getFlowBacklog():.2f} \n {newline.join(f'{f.id} : {f.backlog(cc.t):.2f}' for f in cc.flows)}" + +nbThreads = 5 +poly = "rdpt_polytech_fixed.net.xml" +paths = [ + [poly, "rdpt_polytech_burst.rou.xml"], + [poly, "rdpt_polytech_burst_2.rou.xml"], + [poly, "rdpt_polytech_burst_2_dynSpeed.rou.xml"], + [poly, "rdpt_polytech_burst_2_div2.rou.xml"], + [poly, "rdpt_polytech_burst_2_IA.rou.xml"], + ["rdpt_polytech_shortcut.net.xml", "rdpt_polytech_burst_2_shortcut.rou.xml"], + ["rdpt_polytech_shortcut_2.net.xml", "rdpt_polytech_burst_2_shortcut_2.rou.xml"], + ["comp_inter.net.xml", "comp_inter.rou.xml"], + ["comp_rdp.net.xml", "comp_rdp.rou.xml"] + ] +with Pool(5) as p: + print(p.map(runSim,paths))