4

If we let $x_i$ = 1 if a machine is on during hour $i$, and 0 if the machine is off, how would we enforce a constraint that requires the machine to be “on” for a minimum of at least $M$ hours?

For example, if a machine turns on at hour 5, then that means at least $x_5$ through $x_{5+M}$ all equal 1. I was thinking about introducing an auxiliary variable such that $y_i$ = 1 if machine turns on at hour $i$, but I cannot bridge how to use this to enforce a minimum run time.

I would also like to enforce a minimum down time for the machine, but I imagine a similar logic can be applied.

Mason
  • 515
  • 4
  • 8
  • 2
    Related question https://or.stackexchange.com/questions/7403/how-to-construct-my-mixed-integer-programming-problem-with-constraint-of-minimum – fontanf Feb 15 '22 at 16:35
  • 1
    "Adding minimum up- and down-time" section of https://yalmip.github.io/example/unitcommitment/ shows how to do exactly what you want. – Mark L. Stone Feb 15 '22 at 16:56

1 Answers1

2

I would also follow your idea of introducing an additional variable $y_i$ if the process of switching the machine on is done at time $i$. The first constraint makes sure that $y_i$ is 1 if the machine is being switched on at time $i$. Constraint 2, is just an auxillary constraint for index $i=0$, and the third constraint states that $x_i$ must be 1 if $y_i$ is 1, for $M$ hours.
\begin{align}y_i &= x_i - x_{i-1} \quad i=1,\ldots,I \\ x_0 &= 0 \\ x_{\min(i+t,I)} &\geq y_i \quad i=1,\ldots,I;\quad t=0,\ldots,M-1 \end{align}

PeterD
  • 1,501
  • 4
  • 16