Free day after night shift phase
Likelihood of Confusion
Different then the constraint Free days after Night Shift Phase.
According to recommendations for the healthy organization of night and shift work, workers should have at least 24 hours of free time after a night shift phase. This ensures that workers have sufficient rest after a night shift phase. Therefore, if an employee works the night shift today and does not work the night shift tomorrow, they must take the day off.
Implemented using Google's OR Tools¶
src/cp/constraints/free_day_after_night_shift_phase.py
model.add(day_tomorrow_variable == 0).only_enforce_if(
[
night_shift_today_variable,
night_shift_tomorrow_variable.Not(),
night_shift_tomorrow_variable_special.Not(),
]
)
For each non hidden employee and each day we enforce the next day to be free (day_tomorrow_variable == 0) if we got a night shift today, but not tomorrow, meaning the night shift phase ends.