k. HADJ SALEM
k. HADJ SALEM

Reputation: 1

Gurobi optimizer (Python): Linearize quadratic constraint?

Question: How I may linearize the following constraint (joined figure), where r[x][y], c[y,j], a[j,t] and p[x,t+l] are binary variables.

Could someone help me please ?

Best

Quadratic constraint

enter image description here

Upvotes: 0

Views: 844

Answers (1)

sascha
sascha

Reputation: 33532

You can introduce an auxiliary binary variable ap, which holds the product of a and p.

Linearization can be done with:

ap <= a
ap <= p
ap >= a + p - 1

Then your remaining formula is ready to be formulated within gurobi (no more quadratic terms).

Upvotes: 3

Related Questions