Optaplanner: how to avoid the same shift in two consecutive day?

143 views Asked by At

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?

1

There are 1 answers

0
ChrisV On

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...)