## Wednesday, February 17, 2016

### Strange restriction

In this post the question is posed how to model the restriction
$x \in \{1,2,3,4,5,6,8,10,12,..,100\}.$
Note that this is $$\{1,2,3,4,5\} \cup \{6,8,10,..,98,100\}$$.  Never seen a thing like this, but here is a way to model this in a MIP model:
\begin{align} & 6 - (1-\delta)M \le x \le 5 + \delta M\\ & 2y -(1-\delta)M \le x \le 2y+(1-\delta)M \\ & 1 \le x \le 100 \\ & x \> \text{integer}\\ & y \> \text{integer}\\ & \delta \> \text{binary} \end{align}
Note that this essentially means:
\begin{align} & \delta=0 \implies x\le 5 \\ & \delta=1 \implies x\ge 6, x = 2y \end{align}
We can use $$M=100$$ (or even refine that a little bit).