1
$\begingroup$

I have the following variables and indices. I have $y_{ijk} \in [0;1]$ which indicates how performant a machine $i$ is on day $j$ in the interval $k$. The binary variable $z_{ijk}$ indicates whether a machine $i$ runs in the interval $k$ on day $j$ or not as well as the two slack variables $s_{jk}^+,s_{jk}^- \in \mathbb{R}^+_{\ge 0}$. Then I have the machine capacity $W_{jk}$ to be provided on day $j$ in the interval $k$. I have the following "capacity constraint":

$$\sum_{i\in I}^{}y_{ijk}+s^+_{jk}-s^-_{jk}=W_{jk}~\forall j\in J, k\in K$$

Now I want to implement the following two linear constraints, but I don't know how.

  1. If the demand is greater than zero, then there must always be at least one machine running. My idea for this would be:$$ \sum_{i\in I}^{}z_{ijk}\ge 1~\forall j\in J, k\in K \mid W_{jk} >0$$ Since $W_{jk}$ can never be greater than $\mid I\mid$, I control this via multiplication.
  2. It should always be ensured that at least one fully performant machine ($y_{ijk}=1$) is working when the demand is greater than zero. I would introduce the binary variable $x_{ijk}$ which indicates if a machine is fully performant. But right now the problem is, that even if $z_{ijk}=y_{ijk}=1$, i could be that $x_{ijk}$ becomes zero. $$x_{ijk}\le y_{ijk}~\forall i\in I, j\in J, k\in K$$ $$x_{ijk}\le z_{ijk}~\forall i\in I, j\in J, k\in K$$ $$\sum_{i\in I}^{} x_{ijk}\ge 1~\forall j\in J, k\in K \mid W_{jk}>0 $$

How can I improve the first and implement the second?

$\endgroup$
5
  • $\begingroup$ In your second item, did you mean $y_{ijk}=1$ rather than $z_{ijk}=1$? $\endgroup$
    – prubin
    Commented May 7 at 15:40
  • $\begingroup$ @prubin You are correct $\endgroup$
    – mingabua
    Commented May 7 at 18:24
  • $\begingroup$ @mingabua, would you say, what does actually the demand mean? Is it the machine capacity in your case? $\endgroup$
    – A.Omidi
    Commented May 8 at 6:37
  • $\begingroup$ Also, why not try to write $W_{j,k}$ as $W_{i,j,k}$? It is common to have a specific deviation for each machine in each shift rather than having a total deviation if you are taking into account the usage cost of the machines. $\endgroup$
    – A.Omidi
    Commented May 8 at 7:09
  • $\begingroup$ Another approach would be, if you want to imply at least one fully performant machine is working when the demand is greater than zero you really defined the second part of this clause on your second constraint. You once defined if the demand is greater than zero, then at least one machine is running. Now, you want if at least a machine is running, then it should be run at fully performant. It means the expression would be: Iff ($\sum_{i} z_{i,j,k} \geq 1 \implies \sum_{i} x_{i,j,k} \geq 1$). $\endgroup$
    – A.Omidi
    Commented May 8 at 7:27

1 Answer 1

0
$\begingroup$

The second constraint implies the first: if, whenever demand is positive, there is at least one fully performant machine, then there is at least one machine running. Your constraint $$\sum_{i\in I}^{} x_{ijk}\ge 1~\forall j\in J, k\in K \mid W_{jk}>0$$ correctly imposes the second constraint. To get the value of $x$ correct, you just need $$y_{ijk} \ge x_{ijk}\quad\forall i,j,k,$$ which says that if a machine is "fully performant" then it must be running at level 1.

You are correct that this allows $y_{ijk} = 1$ and $x_{ijk} = 0$ (a machine is running at full blast but not considered "fully performant"), but this does no harm. In any period with demand, at least one machine will be flagged as "fully performant" ($x_{ijk} = 1$), and that machine will be forced to run full blast. If any other machines are running full blast but not flagged as the one required "fully performant" machine, the solution will still work.

$\endgroup$
6
  • $\begingroup$ Great, thank you very much. I still have one question. I want to implement the whole thing in Gurobi, for example, if $y_{ijk}=0.9$, then $x_{ijk}$, which is binary, cannot become 1. Do the solvers then automatically set the value to zero? $\endgroup$
    – mingabua
    Commented May 7 at 21:10
  • $\begingroup$ If you are talking about $y_{ijk}$ being 0.9 in the final (hopefully optimal) solution, then yes, the solver will set $x_{ijk} = 0.$ $\endgroup$
    – prubin
    Commented May 7 at 22:47
  • $\begingroup$ I see, but couldnt it be also the case, that if $y_{ijk}=1$ in the optimal solution, that the solver could also assign $x_{ijk}=0$? How can i force it to take the respective values? $\endgroup$
    – mingabua
    Commented May 8 at 7:34
  • $\begingroup$ Yes, but if $y_{ijk}=1$ and $x_{ijk}=0,$ there will be at least one other machine $i'$ for which $y_{i'jk}=x_{i'jk}=1,$ i.e., some other machine that "gets credit" for running at maximum intensity. In any case, the final (optimal) solution will be valid, and you can always edit it manually once you have it and set $x_{ijk}=1$ in cases like this if it really bothers you. $\endgroup$
    – prubin
    Commented May 8 at 15:56
  • $\begingroup$ Okay, but isn't there any possible constraint that states this lower bound? As I want the model to do this by it self, rather than doing it manually? $\endgroup$
    – mingabua
    Commented May 8 at 22:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.