This commit is contained in:
Laurent Perron
2021-02-15 16:04:27 +01:00
parent 1d9174516f
commit ab810ee300

View File

@@ -120,7 +120,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