I am trying to create a set of constraints that forces a binary variable $y$ to be set to a certain value when a variable $x$ is greater than or equal to zero. I have,
$-1 \leq x \leq 1, \qquad x \in {\rm I\!R}$
$y = \begin{cases} 1 & \text{if } x \geq 0\\ 0 & \text{if } x < 0 \end{cases}$
I believe the way to practically do this is as follows:
$x \leq My - \epsilon$
$-x \leq M(1-y)$
Note that $M$ is a very large number and $\epsilon$ is a very small number.
I am unsure if there is a better way to do this, let me know if there is. I don't like the fact that I need to use the $\epsilon$ value to separate from the $0$ boundary, but I may have no other choice.