Multiplication of multiple variables
I’m currently using Gurobi optimizer for a cost optimization, but encounter a very annoying problem.
I would like to add constraints in which I multiply three variables, all binary, but results in a QuadExpr() error. Is there any way to overcome this issue?
Kind regards
Michiel

Gurobi only supports products of pairs of variables, not triples. To overcome this issue, you need to introduce auxiliary variables and build the more complex expression using those. For example, in order to model
y = x1*x2*x3
you could write
z12 = x1*x2
y = z12*x3For binary variables, this should just work out of the box. For nonbinary variables, this is only supported since Gurobi 9.0, and only if you set the "NonConvex" parameter to 2.
Regards,
Tobias
Please sign in to leave a comment.
Comments
1 comment