I got a problem for using onlyenforceif to set up constraint.
work[employee , shift , day] is the BoolVar indicating the scheduling status for each staff each day.
I would like to set a limit that for staff who worked on shift A on day 1 and shift B on day 2 then they are not allowed to work on shift c on day 3. But the code does not work.
Could you please give me some hint how to revise it. Many thanks!
#Constraint 9 - M -> N -> D shift pattern
#if day n == "N" and day n+1 == 'O' then day n+2 <> 'M'
for e in range(num_employees):
for d in range(0 , num_days-2):
model.Add(work[e,2, d+2] == 0).OnlyEnforceIf([work[e,4, d] , work[e,1, d+1]])