Skip to content

Max one shift per day

Each employee is permitted to work only one shift per day. It is important to note that a night shift counts as part of the day on which it begins.

Implemented using Google's OR Tools

src/cp/constraints/max_one_shift_per_day.py
for employee in self._employees:
    for day in self._days:
        model.add_at_most_one(shift_assignment_variables[employee][day][shift] for shift in self._shifts)