This commit is contained in:
Laurent Perron
2019-07-04 13:13:19 +02:00
parent 4a0e9b1860
commit 8a0ba73240

View File

@@ -123,7 +123,7 @@ def add_soft_sequence_constraint(model, works, hard_min, soft_min, min_cost,
cost_coefficients.append(max_cost * (length - soft_max))
# Just forbid any sequence of true variables with length hard_max + 1
for start in range(len(works) - hard_max - 1):
for start in range(len(works) - hard_max):
model.AddBoolOr(
[works[i].Not() for i in range(start, start + hard_max + 1)])
return cost_literals, cost_coefficients