Let $x$ be an integer variable that takes the values $1$, $2$ or $3$. Let $y_1$ and $y_2$ be binary variables.
I want to express the two following logical constraints:
if $x=2$ then $y_1=1$ if $x=3$ then $y_2=1$
That's all. I have looked around here but usually the constraints are inequalities or continuous variables.
Edit:
I have come up with the following solutions:
$-1y_1=(x-1)(x-3)$
when $x=1 \rightarrow y_1=0$,
when $x=3 \rightarrow y_1=0$,
when $x=2 \rightarrow y_1=1$.
$2y_2=(x-1)(x-2)$
when $x=1 \rightarrow y_2=0$,
when $x=2 \rightarrow y_2=0$,
when $x=3 \rightarrow y_2=1$.
It breaks the linearity, but the constraints are in a Mixed Integer Nonlinear Programming problem.
Could be that a valid solution?