7

I have the decision variable $X_{iz}$

And I have two parameters $T_i\in\{0,1\}$ and $IT_z\in\{0,1,2\}$. I can only assign $i$ to $z$ if the following holds:

  • for $T_i=0$, $IT_z$ needs to be $0$ or $2$
  • for $T_i=1$, $IT_z$ needs to be $1$ or $2$
  • So for every value of $T_i$, a value of $2$ for $IT_z$ must satisfy the constraint
  • Or $T_i$ needs to be equal to $IT_z$

I cannot seem to figure out how to make a valid constraint for this problem, any tips?

2 Answers2

5

For the new problem description, it seems like you just want to fix $X_{i,z}=0$ for some disallowed $(i,z)$ pairs. An even better approach is to avoid defining $X_{i,z}$ in those cases.

RobPratt
  • 32,006
  • 1
  • 44
  • 84
2

Introduce a new binary variable $z_i$ and linear constraints: \begin{align} -z_i \le \text{IT}_i - \text{T}_i &\le 2 z_i \\ \text{IT}_i &\ge 2 z_i \end{align} If $z_i=0$ then $\text{IT}_i = \text{T}_i$. If $z_i=1$ then $\text{IT}_i \ge 2$, hence $=2$.

RobPratt
  • 32,006
  • 1
  • 44
  • 84