1
$\begingroup$

I have a list of paired variables(paired_list) like below and a resultant variable(my_res). paired_list = [[a,b],[c,d],[e,f],...].

Here a,b,c,d,e,f are also binary decision variables.

I have to set a constraint which is a combination of and and or operator as below

my_res = [(a and b) or (c and d) or (e and f)...].

How can I translate this into a ILP constraint?

$\endgroup$
  • $\begingroup$ In general, if $x_i \in \{0, 1\}$, you can write the constraint $x_i \wedge x_j$ as $x_i x_j = 1$ and the constraint $x_i \vee x_j$ as $x_i + x_j = 1$. In your case, you would have $x_a x_b + x_c x_d + x_e x_f = 1$. $\endgroup$ – VHarisop May 11 '18 at 16:48
0
$\begingroup$

Assume $x$, $y$ and $z$ are binary variables.

  • For $z$ to be $x$ OR $y$ (inclusive or): $z\le x + y$; $z\ge x$; $z\ge y$.
  • For $z$ to be $x$ XOR $y$ (exclusive or): $z\le x + y$; $z\le 2 - (x + y)$; $z\ge x - y$; $z\ge y - x$.
  • For $z$ to be $x$ AND $y$: $z\ge x + y - 1$; $z\le x$; $z\le y$.
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.