I am wondering what would be the efficient way of formulating the following constraint in (Python) Gurobi:
# The big-Mx_i (i=1,...,n), eta, and gamma are binary variables and px_i (i=1,...,n) are integer variables.
M = 10**9
for i in range(n):
for k inrange(n):
if (i!=k) and (x[i]==1) and (x[k]==1):
# OR constraints already linearized via Big-M
px[i] - px[k] +M*eta <= M-l[i]
px[k] - px[i] -M*eta <= -l[k]
Please sign in to leave a comment.