Nonconvex problem considered convex by Pyomo/ Gurobi solver ! Weird?
Awaiting user inputQUESTION 1:
We have an optimization problem with objective function
f(x,y,z,p) =
0.12 * x^2 + 14.8 * x + 89 +
0.17 * y^2 + 16.57 * y + 83 +
0.15 * z^2 + 15.55 * z + 100 +
0.19 * p^2 + 16.21 * p + 70
And the Hessian of this Objective function is :
(0.24 | 0 | 0 | 0
0 | 0.34 | 0 | 0
0 | 0 | 0.3 | 0
0 | 0 | 0 | 0.38)
Therefore the eigenvalues are : 0.24, 0.34, 0.3 and 0.38 i.e all are positive and so the Hessian is positive semidefinite.
As a result, the objective function is convex.
All other constraints are convex / linear in this optimization problem, and so the gurobi solver will solve it without issues.
Agree?
QUESTION 2:
Now assume that in the above problem we add the following equality constraint:
1.2 * x^2 - 5 * x + 3 +
2.3 * y^2 - 4.24 * y + 6.09 +
1.1 * z^2 - 2.15 * z + 5.69 +
1.1 * p^2 - 3.99 * p + 6.2 = 0
The above is a NONCONVEX constraint and I see that Gurobi can only solve it by having :
solver.options['NonConvex'] = 2.
Do you agree with the above observations?
QUESTION 3
Is there a way by pyomo / gurobi to tell us quickly if an objective function or if a constraint is convex or non convex?
-
All other constraints are convex / linear in this optimization problem, and so the gurobi solver will solve it without issues.
Agree?Yes.
The above is a NONCONVEX constraint and I see that Gurobi can only solve it by having :
solver.options['NonConvex'] = 2.
Do you agree with the above observations?Yes.
Is there a way by pyomo / gurobi to tell us quickly if an objective function or if a constraint is convex or non convex?
I don't know about Pyomo but there is currently no way to ask Gurobi whether an objective function or a constraint is convex or nonconvex. One way would be to solve a model \(\min f(x)\) without constraints and check whether the NonConvex parameter has to be set. If not, then function \(f\) is convex or Gurobi has found a way to turn the optimization problem into a convex one. This can happen if, e.g., you have binary variables and one can add diagonal terms to make the \(Q\) matrix PSD by exploiting the property that \(b = b^2\) if \(b\) is binary.
The title of you post states
Nonconvex problem considered convex by Pyomo / Gurobi. Weird?
Could you please elaborate what exactly is weird? Do you have a case where you think that a function is nonconvex but then you don't have to set the NonConvex parameter?
Best regards,
Jaromił0
Please sign in to leave a comment.
Comments
1 comment