[CP-SAT] ScalProd -> WeightedSum

This commit is contained in:
Laurent Perron
2022-01-04 19:35:22 +01:00
parent a022daa56a
commit ceabca677c
29 changed files with 142 additions and 153 deletions

View File

@@ -288,7 +288,7 @@ def solve_shift_scheduling(params, output_proto):
# Exactly one shift per day.
for e in range(num_employees):
for d in range(num_days):
model.Add(sum(work[e, s, d] for s in range(num_shifts)) == 1)
model.AddExactlyOne([work[e, s, d] for s in range(num_shifts)])
# Fixed assignments.
for e, s, d in fixed_assignments: