If continuous variable < constant then same variable = 0

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, 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?

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]$$.
• $x\in[c,M]$ but not possible to be in $\{0\}$. Oct 14 '21 at 13:14
• Not sure what you mean. It is possible to have $x=0$ by taking $y=0$. Oct 14 '21 at 13:18