Linearization of logical AND of binary & integer decision variables in the IF condition

445 Views Asked by At

I want to linearize following If-else constraint with many logical AND of binary & integer decision variables in the if condition.

$if(x_{i,k}=1\;AND\; x_{j,k}=1\; AND\; s[i]\leq s[j]\; AND\; cost[i]!=s[j]) then\\ temp[i][j]=y[i]-23.514$

where $x_{i,k}\;,x_{j,k}$ are binary decision variables and $s[i],\;s[j],\;cost[i],\;temp[i][j],\;y[j]$ are integer decision variables.

Can someone please help me.

Thank you.

1

There are 1 best solutions below

15
On BEST ANSWER

So effectively you have $\textbf{if } q \textbf{ then } f(x) = 0$. where $q$ is a complex expression $q = a \textbf{ and } b \textbf{ and } c \textbf{ and } d$ where some of the terms here come from inequalities.

$\textbf{if } q \textbf{ then } f(x) = 0$ can be written using the big-M model $-M(1-q) \leq f(x) \leq M(1-q)$

$q = a \textbf{ and } b \textbf{ and } c \textbf{ and } d$ is $q\geq a+b+c+d-3, q\leq a, q\leq b, q\leq c, q\leq d$.

$a$ and $b$ correspond to binary variables in your model, so already done,. i.e., just use those variables.

The variable corresponding to the binary $c$ is activated when some integer function $s_1(x)\leq 0$, which is can be modelled as $s(x)\geq \frac{1}{2}-Mc$

The variable corresponding to the binary $d$ is activated when some integer function $s_2(x)\ne 0$, which can be represented using two new binary variables $e$ and $f$ and the model $-Mf-\frac{1}{2}\leq s_2(x) \leq \frac{1}{2} + Me, d = e+f$