Skip to content

Commit 6f51e81

Browse files
authored
Fixed categorical data example #932 (#939)
1 parent cb4ea2b commit 6f51e81

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

examples/finished/categorical_data.py

+4
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)