How to modelize that a machine should stay off during 5 consecutive hours at least by a linear constraint? I need to model the constraint that "the machine can be turned off if needed but once it has been turned off, it should stay off during at least 5 hours".
I have created a variable $c_{i}$ s.t. $c_{i}=1$ iff the machine is stopped at time $i+1$ (I know it could seem odd but it's like this) and $e_{i}$ s.t. $e_{i}=1$ if the machine is restarted at time $i+1$. Moreover, $a_{i}=1$ if the machine produces at time $i$. (I have established the correct constraints between $a_{i}$ and  $c_{i}$ and $e_{i}$).
However, I don't manage to express in term of linear programming constraints the fact that "the machine can be turned off if needed but once it has been turned off, it should stay off during at least 5 hours"
EDIT: so far, the constraints (among others) look like :
$e_{i}\geq a_{i+1}-a_{i}$
$e_{i} \leq a_{i+1}$
$e_{i} \leq 1-a_i$
$c_{i}\geq a_{i}-a_{i+1}$
$e_{i} \leq a_{i}$
$e_{i} \leq 1-a_{i+1}$
Thanks in advance !
 A: I have found on my own the way to fix that problem :
By calling $q_i$ the quantity produced by the machine at time $i$ and $Q$ the overall quantity to be produced :
$\sum_{k=i+1}^{i+5} q_k \leq Q \cdot (1-c_i) $
By this way, the machine can not produce anything during the 5 following periods after the machine was turned off.
I guess that we can replace $q_k$ by $a_k$ and therefore $Q$ by 5 in this case.
I hope it will help other people ;-)
A: By "stopped at time $i+1$" I suppose you mean that $a_i = 1$ and
$a_{i+1} = 0,$ that is, the machine was running at time $i$ but is no longer
running at time $i+1.$
Similarly, I suppose $e_i$ means $a_i = 0$ and $a_{i+1} = 1.$
I also suppose that the unit of time is one hour, that is,
time $i+1$ is one hour later than time $i,$
and that changes in status (such as the machine turning on or off)
occur only at the top of the hour, for example at 10 am or 2 pm
but never at 10:30 am.
So if the machine stops at time $i+1,$ you know it is off for at least an
hour, and you just need to make sure it doesn't get restarted at any of
the next four possible times, which you can explicitly list.
Alternatively, you know that if $c_i$ and $e_j$ are true,
there are certain conditions that the numbers $i$ and $j$ must satisfy.
