-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrunSome.py
66 lines (55 loc) · 2.14 KB
/
runSome.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# encoding: iso-8859-1
import os
import sys
def runEBkSP(num, model, scenario, outputDir):
count = 0
reroute = []
reroute.append("EBkSP")
while(count < len(reroute)):
i = 0
while(i < num):
output =("Outputs_%s/%s/reroute_%s_%d.xml"%(reroute[count], outputDir, reroute[count], i))
os.system("python %s.py -c sumo -s %s/sim.sumocfg -n %s/sim.net.xml -k 3 -i 900 -b 1000 -d %d -o %s -l logs/%s_%s_%d.log --scale 0.75"%(reroute[count], scenario, scenario, i, output, reroute[count], model, num))
i = i+1
print("End simulation of %s"%(reroute[count]))
count = count + 1
print("End of all %d simulations"%(i))
if __name__ == '__main__':
root = os.getcwd()
Chicago = ("%s/Chicago"%(root))
Cologne = ("%s/Cologne"%(root))
Monaco = ("%s/Monaco"%(root))
Luxembourg = ("%s/Luxembourg"%(root))
num = int(sys.argv[1])
selected = []
models = ["Greenshield", "Greenberg", "GU", "Drake"]
for argi in range(2, len(sys.argv)):
i = sys.argv[argi]
i = int(i)
print(i)
selected.append(models[i])
scenario = Luxembourg
outputDir = "Luxembourg"
for model in selected:
if(model == "Greenshield"):
print("Greenshield\n")
new_path = ("%s/Linear_models/Greenshield/"%(root))
os.chdir(new_path)
runEBkSP(num, model, scenario, outputDir)
elif(model == "Greenberg"):
print("Greenberg\n")
new_path = ("%s/Logarithm_models/Greenberg/"%(root))
os.chdir(new_path)
runEBkSP(num, model, scenario, outputDir)
elif(model == "GU"):
print("Greenberg - Underwood\n")
new_path = ("%s/Logarithm_models/Greenberg-Underwood/"%(root))
os.chdir(new_path)
runEBkSP(num, model, scenario, outputDir)
elif(model == "Drake"):
print("Drake\n")
new_path = ("%s/Logarithm_models/Drake/"%(root))
os.chdir(new_path)
runEBkSP(num, model, scenario, outputDir)
print("Ended all models simulation")
sys.exit()