@@ -28,8 +28,8 @@ def printschedule(r):
28
28
for d in range (len (r )/ 2 ):
29
29
name = people [d ][0 ]
30
30
origin = people [d ][1 ]
31
- out = flights [(origin ,destination )][int (r [d ])]
32
- ret = flights [(destination ,origin )][int (r [d + 1 ])]
31
+ out = flights [(origin ,destination )][int (r [d * 2 ])]
32
+ ret = flights [(destination ,origin )][int (r [d * 2 + 1 ])]
33
33
print '%10s%10s %5s-%5s $%3s %5s-%5s $%3s' % (name ,origin ,
34
34
out [0 ],out [1 ],out [2 ],
35
35
ret [0 ],ret [1 ],ret [2 ])
@@ -42,8 +42,8 @@ def schedulecost(sol):
42
42
for d in range (len (sol )/ 2 ):
43
43
# Get the inbound and outbound flights
44
44
origin = people [d ][1 ]
45
- outbound = flights [(origin ,destination )][int (sol [d ])]
46
- returnf = flights [(destination ,origin )][int (sol [d + 1 ])]
45
+ outbound = flights [(origin ,destination )][int (sol [d * 2 ])]
46
+ returnf = flights [(destination ,origin )][int (sol [d * 2 + 1 ])]
47
47
48
48
# Total price is the price of all outbound and return flights
49
49
totalprice += outbound [2 ]
@@ -58,8 +58,8 @@ def schedulecost(sol):
58
58
totalwait = 0
59
59
for d in range (len (sol )/ 2 ):
60
60
origin = people [d ][1 ]
61
- outbound = flights [(origin ,destination )][int (sol [d ])]
62
- returnf = flights [(destination ,origin )][int (sol [d + 1 ])]
61
+ outbound = flights [(origin ,destination )][int (sol [d * 2 ])]
62
+ returnf = flights [(destination ,origin )][int (sol [d * 2 + 1 ])]
63
63
totalwait += latestarrival - getminutes (outbound [1 ])
64
64
totalwait += getminutes (returnf [0 ])- earliestdep
65
65
0 commit comments