Hello there. I have problems creating some constrains that will satisfy the following case:

We have 10 wokers that will work some days of a 14 day period in different timeintervals of the day: daytime, evening and night.

x[w=1:10,d=1:14,t=1:3] equals 1 if worker w works on day d in timeperiod t.

The workers are guaranteed some protected days off work.

p[w=1:10,d=1:14] equals 1 if worker w has day d as protected.

(1) If a worker only has 1 consequtive protected days, then the worker can’t work in 1st and 2nd time interval of the next day.

(2) If a worker has 2 or more consequtive protected days, then they can’t work in the first time interval of the next day after the consequtive protected days, but is allowed to work in the second time interval.

For the second case i am thinking something in the lines of

for all w, for d=1:(14-1), if p[w,d] + p[w,d+1] == 2 then x[w,d,1] == 0

I have alså tried creating some truth tables

p[1] p[2] x[3,1]

T T F

F F T <---- but already here a worker will be forced to work, and that should not be the case.

T F T

F T F

p[1] p[2] x[3,2]

T T T

F F T

T F T

F T F

I am at a point where I cannot generate more ideas.

The thing that makes this difficult for me, is that we’re talking ‘consequtive protected days’.

Any suggestions? Thanks!