4
$\begingroup$

I would like to seek some advice on modeling the following:

I have two integer decisions variables, $x, x'$, that are either equal or greater than zero and either of them is to be equated to a third integer decision variable, $z$, which is also equal or greater than zero in accordance to the value of a binary indicator variable, $\beta$.

$\beta=1$ $\implies$ $x=z$

$\beta=0$ $\implies$ $x'=z$

Appreciate your kind guidance.

Thank you!

$\endgroup$

1 Answer 1

4
$\begingroup$

$$ x \le z + M(1-\beta) \\ x \ge z - M(1-\beta) \\ x' \le z + M\beta \\ x' \ge z - M\beta \\ $$

If $\beta=1$, we have

$$ x \le z \\ x \ge z \\ x' \le z + M \\ x' \ge z - M \\ $$

which leads to $x=z$ and $x'$ unconstrained. And likewise if $\beta=0$.

$\endgroup$
13
  • $\begingroup$ Dear Kuifje, thank you for your speedy answer. May I ask you in detail with regard to the case of $\beta=1$. Would last two constraints that result in an interval of integers, i.e., $z-M$$\le$$x'$$\le$$z+M$ force $x'$ to be strictly positive? For my problem zero has to be included as $x'$ is set to zero due to other constraints in the model. Appreciate your inputs! $\endgroup$
    – Mike
    Sep 10, 2020 at 10:15
  • 1
    $\begingroup$ You can add another constraint $x' \ge 0$ if you need $x'$ to be non negative no matter what. In this case $z-M \le x'$ will have no effect (if $M$ is large enough). $\endgroup$
    – Kuifje
    Sep 10, 2020 at 10:24
  • $\begingroup$ Dear Kuifje, pardon me for missing out on the bottom portion on $x'$ unconstrained. Could you help elaborate on the mechanism which enables it to be unconstrained as I treating it from the perspective where $z$ is a integer decision variable though which might be equal or greater than zero, it could possibly be of a certain large value that could overwhelm M causing $x'$ to not include 0. Thank you! $\endgroup$
    – Mike
    Sep 10, 2020 at 10:28
  • 1
    $\begingroup$ Yes that is why you have to choose $M$ big enough, in this case larger than the upper bound for $z$. $\endgroup$
    – Kuifje
    Sep 10, 2020 at 10:31
  • 1
    $\begingroup$ Your last comment is exact: you need $M$ large enough to prevent $z-M >0$, but not too large otherwise you might run into numerical issues. $\endgroup$
    – Kuifje
    Sep 10, 2020 at 10:33

Your Answer

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