5
$\begingroup$

When I come across with a situation needs an if-then constraints I visit Larry's post. I am a bit confused with the titled constraint this time because I am not trying to set $y$ based on $x$ but trying to fix $x$ to $0$ if $x<c$, e.g., $c=0.5$.

I have a linear program with $x\in\mathbb{R}_{\geq 0}$, and an objective of $\max \textbf{Ax}$, where $\textbf{A}\in\mathbb{R}_{>0}$. There are readily some upper bound constraints on $x$, where all upper bounds are strictly greater than $c$. I would like $x=0$ if $x<0.5$.

If I set a constraint $x\geq 0.5$, then $x$ will not be allowed to be $0$. So, I want to exclude the range $(0,c)$ from the solution space of $x$. How can we set such a constraint?

$\endgroup$
9
$\begingroup$

This is a semicontinuous variable, and you can enforce it by introducing a binary variable $y$ and imposing linear constraints $$cy\le x \le My.$$ If $y=0$, then $x=0$. If $y=1$, then $x\in[c,M]$.

$\endgroup$
3
  • $\begingroup$ $x\in[c,M]$ but not possible to be in $\{0\}$. $\endgroup$
    – tcokyasar
    Oct 14 at 13:14
  • $\begingroup$ Not sure what you mean. It is possible to have $x=0$ by taking $y=0$. $\endgroup$
    – RobPratt
    Oct 14 at 13:18
  • $\begingroup$ Well, it was confusing in beginning and now all makes sense :) Thanks a lot! $\endgroup$
    – tcokyasar
    Oct 14 at 13:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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