Skip to content

Commit 53ba6ae

Browse files
committed
Fixed categorical data example scipopt#932
1 parent cb4ea2b commit 53ba6ae

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

examples/finished/categorical_data.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,10 @@
5151
for s in shift_to_int.values():
5252
model.addCons(sum(x[e, s] for e in employees) == 1)
5353

54+
# Each employee must be assigned to exactly one shift
55+
for e in employees:
56+
model.addCons(sum(x[e, s] for s in shift_to_int.values()) == 1)
57+
5458
# Employees can only work shifts they are available for
5559
for e in employees:
5660
for s in shift_to_int.values():

0 commit comments

Comments
 (0)