How to access the dual variable of a convex optimization problem? #928
-
Hi, I am trying to solve following problem and find the Lagrange multiplier for the 3rd inequality constraint: y=sdpvar(N,1); both MOSEK and IPOPT could successfully find the optimal, and ipopt is slightly better. If I choose MOSEK, then I could get the Lagrange multiplier via "dual(const(3))" , however, if I choose IPOPT, "dual(const(3))" returns "NaN", How could I access the dual variable when using the ipopt? Many Thanks |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 4 replies
-
Duals are not captured for general nonlinear solvers. However, you should be careful with that model. The concave sqrt operator is implemented using an socp-representation, and this should not be possible in this case as you are using sqrt in a non convexity preserving fashion. It could be that you have R=I since YALMIP then automatically replaces that expression with norm(y) which then maps to an socp cone. However, that is not a good model for a general nonlinear solver, as YALMIP is forced to model the non-smooth socp cone for the nonlinear solver. A better model for a nonlinear solver is most likely the convex and smooth model gamma^2 >= y'Ry If you want to use a square-root with a nonlinear solver, use sqrtm https://yalmip.github.io/squareroots |
Beta Was this translation helpful? Give feedback.
-
https://yalmip.github.io/Extracting Note though, solving this problem via ipopt via YALMIP is a bad idea normally except in trivial cases, as ipopt is relies heavily on receiving the hessian, and this is not done by YALMIP. fmincon typically performs better without hessians, but in this case where you can use mosek, that is what you should do. |
Beta Was this translation helpful? Give feedback.
Duals are not captured for general nonlinear solvers.
However, you should be careful with that model. The concave sqrt operator is implemented using an socp-representation, and this should not be possible in this case as you are using sqrt in a non convexity preserving fashion. It could be that you have R=I since YALMIP then automatically replaces that expression with norm(y) which then maps to an socp cone. However, that is not a good model for a general nonlinear solver, as YALMIP is forced to model the non-smooth socp cone for the nonlinear solver.
A better model for a nonlinear solver is most likely the convex and smooth model gamma^2 >= y'Ry
If you want to use a square-root with a no…