5

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?

RobPratt
  • 32,006
  • 1
  • 44
  • 84
tcokyasar
  • 1,249
  • 5
  • 12

1 Answers1

9

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]$.

RobPratt
  • 32,006
  • 1
  • 44
  • 84