-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
executable file
·36 lines (22 loc) · 865 Bytes
/
main.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
#!/usr/bin/env python3
from schedules import to_time
import permutations
import graph
print("Calculating optimal routes")
optimal = permutations.get_optimal_route()
#Fastest
print("Fastest solution:")
print("\tTotal time: %s" % (graph.get_time(optimal["fastest"])*20))
thetime = 0
for path in optimal["fastest"]:
output_string = path.replace("JUNC_", "Junction ")
output_string = output_string.replace("LOC_", "Location ")
print("\t%s\t%s" % (thetime, output_string))
thetime += 0 if path == 'START' or path == 'END' else 20
thetime = 0
print("Cheapest solution: ")
for path in optimal["cheapest"]["path"]:
output_string = path.replace("JUNC_", "Junction ")
output_string = output_string.replace("LOC_", "Location ")
print("\t%s\t%s" % (thetime, output_string))
thetime += 0 if path == 'START' or path == 'END' else 20