# Linear constraint formulation (OR-statement)

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?

• Do you have 2 $T$ and 3 $IT$ or do you have one $T$ and one $IT$ where $T$ can be $\{0, 1\}$ and $IT$ can be $\{0, 1, 2\}$. If the latter, then you don't need the indices. Just say $T \in \{0,1\}$ and $IT \in \{0,1,2\}$ – EhsanK Nov 22 '19 at 14:50
• No I have multiple $i$'s and multiple $z$'s, each has their own value of $T\in\{0,1\}$ and $IT\in\{0,1,2\}$. – Harry van t Kamp Nov 22 '19 at 14:53
• Check this answer from Decision Variable Value from a Set – EhsanK Nov 22 '19 at 15:01

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.
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$$.
• I think this is not correct, because when $T_i=0$ and $IT_i=1$ the constraint also satisfies. And this should not be the case. That is what I am struggling with. – Harry van t Kamp Nov 22 '19 at 14:25
• Sorry, I misread $0$ or $2$ as $0$ to $2$. – Rob Pratt Nov 22 '19 at 14:54
• Note: all your indices are of type $i$, but actually $IT$ has index $z$. Is the $z$ (you introduced) of type $i$ or of type $z$? I tried some things now, but the model seems infeasible – Harry van t Kamp Nov 22 '19 at 16:44
• Hmm, you changed the question after I posted my answer, and I don't quite understand the new question. My binary variable $z_i$ has nothing to do with your new index $z$. Is $X_{i,z}$ a binary decision variable? Are $\text{T}_i$ and $\text{IT}_{z}$ now decision variables or constants? – Rob Pratt Nov 22 '19 at 18:18