Skip to content

Commit b85ec2e

Browse files
committed
Fixed a few bugs that prevented proper idle times from being computed.
1 parent 8ab1284 commit b85ec2e

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

flow-shop/flow.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def compile_solution(data, perm):
4949
job = perm[i]
5050
mach_times[0].append(mach_times[0][-1] + data[perm[i-1]][0])
5151
for mach in range(1, nmach):
52-
mach_times[mach].append(max(mach_times[mach-1][i] + data[i][mach-1],
52+
mach_times[mach].append(max(mach_times[mach-1][i] + data[perm[i]][mach-1],
5353
mach_times[mach][i-1] + data[perm[i-1]][mach]))
5454

5555
return mach_times
@@ -86,7 +86,7 @@ def print_solution(data, perm):
8686
row_format ="{:>15}" * 4
8787
print row_format.format('Machine', 'Start Time', 'Finish Time', 'Idle Time')
8888
for mach in range(len(data[0])):
89-
finish_time = sol[mach][-1] + data[perm[-1]][-1]
89+
finish_time = sol[mach][-1] + data[perm[-1]][mach]
9090
idle_time = (finish_time - sol[mach][0]) - sum([job[mach] for job in data])
9191
print row_format.format(mach+1, sol[mach][0], finish_time, idle_time)
9292

0 commit comments

Comments
 (0)