Skip to main content
4 of 4
added 33 characters in body

You want to enforce $h_i > 0 \implies h_{i-1} = 8$. You can do so by introducing binary variables $x_i$ and the following constraints: \begin{align} h_i > 0 &\implies x_i = 1 \\ x_i = 1 &\implies h_{i-1} = 8 \end{align} which you can linearize as: \begin{align} h_i &\le 8 x_i \\ 8 - h_{i-1} &\le 8(1-x_i) \end{align} More compactly: $$8 x_{i+1} \le h_i \le 8 x_i$$

The exact total workload should be distributed in different days :

$$\sum_i h_i =20$$

RobPratt
  • 34.3k
  • 2
  • 47
  • 90