9 match
= re
.match('\(= j(?P<j>\d+) (?P<x>\d+)\)', line
)
11 j
= int(match
.group('j'))
12 x
= int(match
.group('x'))
14 for t
in range(x
, x
+j
):
15 schedule
[t
] = schedule
.get(t
, [])
18 tmax
= max(schedule
)+1
19 levels
= {j
:max(schedule
[t
].index(j
) if j
in schedule
[t
] else 0
20 for t
in range(1, tmax
)) for j
in jobs
}
21 schedule
= {k
:sorted(v
) for k
,v
in schedule
.items()}
22 depth
= max(map(len, schedule
.values()))
23 print('$\\begin{{array}}{{|{}}}'.format('@{}c@{}|'*tmax
))
25 print('\t{}\\\\'.format(' & '.join(map(str, range(1, tmax
)))))
27 for d
in range(depth
):
29 for t
in range(1, tmax
):
30 cj
= [j
for j
in jobs
if levels
[j
] == d
and j
in schedule
[t
]]
32 print('\\hspace{{.5mm}}{}\\hspace{{.5mm}}'.format(
33 '\\mathbf{{{}}}'.format(cj
[0])
34 if cj
[0] in [5, 7, 10] else cj
[0]), end
='')
38 print('\t\\bottomrule')
39 print('\\end{array}$')