dominance relation on single machine scheduling

This commit is contained in:
Laurent Perron
2018-09-19 14:58:50 +02:00
parent 759bdb12c3
commit 19dca72711

View File

@@ -224,9 +224,14 @@ def main(args):
lit = model.NewBoolVar('%i follows %i' % (j, i))
arcs.append([i + 1, j + 1, lit])
# We add the reified transition to link the literals with the times
# of the tasks.
model.Add(starts[j] >= ends[i] + setup_times[i + 1][j]).OnlyEnforceIf(lit)
# We add the reified precedence to link the literal with the times of the
# two tasks.
# If release_dates[j] == 0, we can strenghten this precedence into an
# equality as we are minimizing the makespan.
if release_dates[j] == 0:
model.Add(starts[j] == ends[i] + setup_times[i + 1][j]).OnlyEnforceIf(lit)
else:
model.Add(starts[j] >= ends[i] + setup_times[i + 1][j]).OnlyEnforceIf(lit)
model.AddCircuit(arcs)