This is my second post. I'm trying to study the nurse rostering examples. There is a way to avoid same shift in two consecutive day?
Asked
Active
Viewed 129 times
0
-
Are you trying to avoid shifts for the same nurse in two consecutive days? If yes, that would not be the same shift. There would be 2 shifts, assigned to the same nurse, with consecutive dates. You can write a constraint that penalizes it. – Eszter Oct 09 '20 at 12:25
1 Answers
0
Avoiding same shift type in 2 consecutive days goes like this:your "when" clause should be true when there are 2 ShiftAssignments of the same nurse,same shift type with your second ShiftAssignment having ShiftDatedayindex = ShiftDateDayIndex of first Assignment +1; ShiftAssignment(...$ShiftType1:shiftType,day1:shiftDateDayIndex,...) ShiftAssignment(...$ShiftType2:shiftType,$ShiftType1==$ShiftType2,day2:shiftDateDayIndex,day2==day1+1...)