-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsolver.py
53 lines (33 loc) · 1.16 KB
/
solver.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
import OutageVertex
def insert_outagevertex_into_sorted_list(lst, obj):
for i in range(len(lst)):
if lst[i] > n:
lst.insert(i, n)
return lst
lst.append(n)
return lst
def main():
initial = OutageVertex(
0, # weight
None, # previous
'FRA', # departure_station_iata
'LOS', # arrival_station_iata
1718372502, # std
'some type', # ac_type
'some requirement' # ac_reqs
)
childless_visited = [initial]
terminate = False
while not terminate:
current = childless_visited.pop(0)
next_flight_of_current = current.get_next_of_registration
options = current.get_options()
if not options:
continue
solution_found = False
for option in options:
if option.is_solution:
print('solution found')
terminate = True
for option in options + [nexT_flight_of_current]:
childless_visited = insert_outagevertex_into_sorted_list(childless_visited, option)