I have a problem where I have a continuous decision variable (let's call it $m$) that is bounded between $(0, T]$ where $T>0$ is a predefined parameter. I also have another binary decision variable (let's call it $x$) that I want to use to represent whether $m > Z$ for $Z \in (0, T)$.

So in summary, if $m < Z$, then $x = 0$ and if $m\ge Z$, then $x=1$.

How can I enforce such relation in my program?


1 Answer 1


$m<Z \Rightarrow x=0$ can be modelled as $m\geq Zx$: if $m<Z$ there is only one feasible value for binary $x$, namely $0$. If $m\geq Z$, $x$ can be both 0 and 1.

$m\geq Z\Rightarrow x=1$ is the same as $x=0\Rightarrow m<Z$. This can be modelled (for a small $\epsilon>0$) as $m\leq T-(T-Z+\epsilon)(1-x)$: If $x=0$ then $m\leq Z-\epsilon$. If $x=1$ we have $m\leq T$ which is always true.


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.