How to enforce a constraint that a decision variable can only take 1 of $k$ integer values?

894 Views Asked by At

How would you enforce the constraint that $x$, a decision variable, can only take values -3, 7, or 19?

I think I probably need to introduce a binary variable here but not sure where to start. Thanks.

1

There are 1 best solutions below

0
On BEST ANSWER

Let $w,x,y,z \in \mathbb{Z}$ such that:

$x,y,z \in \{0,1\}$

$x+y+z=1$

$w=-3x+7y+19z$

Then $w$ will be exactly one out of $-3,7,19$.