Expressing a logical constraint in integer programming
Let $x \in [-10,10] \cap \mathbb Z$ and $y \in \{0,1\}$. Suppose that

$$y = \begin{cases} 1 &amp; \text{if } x \geq 3\\ 0 &amp; \text{if } x \leq 2\end{cases}$$

To ensure that $y \neq 0$ when $x \geq 3$, use

$$y \geq \frac{x-2}{8}$$

To ensure that $y \neq 1$ when $x \leq 2$, use

$$y \leq \frac{x+10}{13}$$

Pictorially,



The trivial inequality constraints are $-10 \leq x \leq 10$ and $0 \leq y \leq 1$. Lastly, the integrality constraints $x, y \in \mathbb Z$ should not be forgotten.