I have these two constraints :

$z \leq My$

$t \leq M'y $

where $z$ and $t$ are two integer variables $ z, t\geq 0$, $y$ is a binary variable, and $M$, $M'$ are two big numbers.

So basically these constraints ensure that if $y = 1$ then $z, t \leq M , M'$ respectively, otherwise $z,t = 0$.

However these constraints won't give me a positive value for $t$ if $z > 0$.

My question is : how to connect variables $z$ and $t$ to ensure that if $z > 0$ then $t > 0$ .

The logical constraint that I want to write is as following:

if $y= 1$ then $z >0$ and $t>0$ .

Thank you.


1 Answer 1


Let $\epsilon > 0$ be a tolerance for what you consider positive. Now impose linear constraints $z \ge \epsilon y$ and $t \ge \epsilon y$. Because $z$ and $t$ are integer variables, you can take $\epsilon=1$.

  • $\begingroup$ Thank you very much, you've been a great help. $\endgroup$
    – che
    Sep 11, 2020 at 8:23

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.

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