I have variables $x \in \{0,1,\dots,5\}$ and $y \in \{0,1\}$, where
$$y = \begin{cases} 0 & \text{if } x = 5\\ 1 & \text{if } x \neq 5\end{cases}$$
My problem is to maximize $y$. How can I use linear constraints for this?
I tried certain cases like Cast to boolean, for integer linear programming but that won't work if the problem is to maximize $y$.