I think you are asking for a way to model: "at least two consecutive periods of down time". A simple formulation is to forbid the pattern:
t t+1 t+2
1 0 1
This can be written as a linear inequality:
x(t) - x(t+1) + x(t+2) <= 1
One way to convince yourself this is correct is to just enumerate the patterns:
x(t) x(t+1) x(t+2) LHS
0 0 0 0
0 0 1 1
0 1 0 -1
0 1 1 0
1 0 0 1
1 0 1 2 <--- to be excluded
1 1 0 0
1 1 1 1
With x(t) - x(t+1) + x(t+2) <= 1
we exactly exclude the pattern 101
but allow all others.
Similarly, "at least two consecutive periods of up time" can be handled by excluding the pattern
t t+1 t+2
0 1 0
or
-x(t) + x(t+1) - x(t+2) <= 0
Note: one way to derive the second from the first constraint is to observe that forbidding the pattern 010
is the same as saying y(t)=1-x(t)
and excluding 101
in terms of y(t)
. In other words:
(1-x(t)) - (1-x(t+1)) + (1-x(t+2)) <= 1
This is identical to
-x(t) + x(t+1) - x(t+2) <= 0
In the comments it is argued this method does not work. That is based on a substantial misunderstanding of this method. The pattern 100 (i.e. x(1)=1,x(2)=0,x(3)=0
) is not allowed because
-x(0)+x(1)-x(2) <= 0
Where x(0)
is the status before we start our planning period. This is historic data. If x(0)=0
we have x(1)-x(2)<=0
, disallowing 10. I.e. this method is correct (if not, a lot of my models would fail).