3
$\begingroup$

I'm new to Gurobi in Python and I am wondering if there is way to express/code "for some" in the following constraint:

$x_i+x_j +x_k+x_l =2$ for some $i, j, k,l \in \{0,1,2,...., 10\}$, where $x_i$ are binary variables.

Question: Is there a way to express the "for some" $i, j,k,$ and $l$ in a certain set ?

$\endgroup$
0

1 Answer 1

6
$\begingroup$

The existence of some $4$-subset with sum $2$ is equivalent to having at least two $x_i=1$ and at least two $x_i=0$, so impose $2\le \sum_i x_i \le 9$.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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