Why does Gurobi ignore the non-convex quadratic constraints?
AnsweredHi there,
I am modelling a non-convex quadratically constrained mixed-integer (binary) problem. The non-linearity occurs both in the objective function and one set of constraints. The form of non-linearity in the objective function is bascially omega1*x1+u1 while in the constraints they look like c1*u1+x1*y <= c2*u2+x2*y, c1*u1+x1*y <= c3*u3+x3*y, ... where omega,x,y,u are variables and c is parameter. There are 16 such constraints. I don't think the objective function is convex or the feasible region induced by those constraints are convex. When I solve the problem after setting the non-convex parameter to 2 and print all constraints in the model using .getConstrs(), I observe that the model ignores these 16 constraints (they don't show up when I print out the name of all constraints). To verify whether there are any problems with these constraints or to test whether the model can recognize them, I remove the non-convex terms from these 16 constraints, i.e. the first one becomes simply c1*u1 <= c2*u2 and I find that these 16 constraints show up when using .getConstrs().
To verify if Gurobi detects the non-convexity in those 16 constraints, I change the objective function to some random linear function and use the default value of the non-convex parameter, and it tells me the Q matrix is not PSD meaning Gurobi detects the non-convexity in the constraints.
So I am wondering what I possibly did such that the non-convex quadratic constraints are ignored by the solver. I can attach the code if it helps resolve the problem. Thank you very much.
Yuzhou,
Thanks
-
Hi Yuzhou,
The documentation of the function Model.getConstrs() states
Retrieve a list of all linear constraints in the model.
Thus, it is expected that the quadratic constraints are not returned by this function.
In order to retrieve all quadratic constraints you have to use the Model.getQConstrs() function.
Best regards,
Jaromił
Please sign in to leave a comment.
Comments
2 comments