Convex optimization problem successfully solved but some constraints violated

145 views
Skip to first unread message

Zhe Yu

unread,
Feb 23, 2019, 3:11:05 PM2/23/19
to YALMIP
Hello,

I am trying to solve a convex optimization problem using YALMIP. It automatically selects fmincon to solve and displays 'Local minimum possible. Constraints satisfied'. I have following two questions:

1. At the last iteration 1103, is f(x) value 4.340317e+05 the optimal objective value? When I output the optimal objective value, it was 9.849023e+04.
2. When I plugged in the optimal values of some decision variables, it turned out some constraints were actually not met.

Please find attached for solver display.

Thank you very much!



Capture.PNG

Johan Löfberg

unread,
Feb 23, 2019, 3:15:32 PM2/23/19
to YALMIP
1. Yes. If those do not match, it's weird, and you would have to supply a reproducible example
2. How are you manually plugging in some values? Why not simply use check to see the feasibility? However, you always have https://yalmip.github.io/faq/solutionviolated/

Zhe Yu

unread,
Feb 23, 2019, 3:31:34 PM2/23/19
to YALMIP
Hello Prof. Johan,

Thank you very much for your prompt reply.

Thank you for the tips to use check. Please find attached for the codes and feasibility check.

Thank you for your help!
small_main.m
trajectory.m
Check Constraints.PNG

Johan Löfberg

unread,
Feb 23, 2019, 4:11:37 PM2/23/19
to YALMIP
You are using cpower, indicating you think th problem isSOCP representable. However, it is not or at least YALIP can not derive this automatically otherwise fmincon would not have been selected. As it is now, you get a very bad model combining socp representations but using fmincon (which isn't good as YALMIP has to hack around the fact that fmincon doesn't support socp cones natively)

When I run the model fmincon struggles massively. You shouldn't need 10000 iterations, that just tells you the model is bad. fmincon terminates due to iteration limit, and the final iterate is infeasible. The discrepancy between fmincon objective and actual objective is probably due to some effect that the objective contains terms that are modelled by epigraph representations and thus only are correct when the constraints actually are satisfied and the solution has run until they are tight, which isn't the case here

This constraint moves you outside the SOCP world
K>> L.*C.*(1/2*(cpower(beta_u + 1./f_u,2) - beta_u_ini.^2 - (1./f_u_ini).^2) - beta_u_ini.*(beta_u-beta_u_ini) + 1./f_u_ini.^3.*(1./f_u-1./f_u_ini))<=z
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|   ID|                                         Constraint|       Coefficient range|
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|   #1|   Element-wise inequality (sigmonial,derived) 10x1|   1.66e-19 to 420000000|
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
K>> 

You have to model the 1/f_u terms carefully using cpower operators and possibly new temporary variables, if you want to use an SOCP solver

Adding to the badness, this is just silly
K>> 1./f_u_ini.^3

ans =

   1.0e-27 *

    1.0000
    1.0000
    1.0000
    1.0000
    1.0000
    1.0000
    1.0000
    1.0000
    1.0000
    1.0000



Zhe Yu

unread,
Feb 24, 2019, 8:49:41 PM2/24/19
to YALMIP
Hello Prof. Johan,

I tried to replace 1/f_u using cpower(f_u,-1) and all other reciprocal terms. The above constraint becomes (derived) instead of (sigmonial,derived). However, fmincon was again chosen to solve it with feasibility not met.

I am sure that the optimization problem is convex. If I do not use cpower but .^, what solvers could I use to solve this problem?

Thanks!

Johan Löfberg

unread,
Feb 25, 2019, 1:20:22 AM2/25/19
to YALMIP
If it still picks fmincon, you have more terms which aren't modelled carefully

If you simply use powers, fmincon will be selected (or any other general nonlinear solver such as ipopt etc). However, if you claim it is convex and SOCP representable, you should be able to pose it using cpower and get an SOCP representable model

Zhe Yu

unread,
Feb 25, 2019, 12:43:47 PM2/25/19
to YALMIP
I realized that this optimization problem is not SOCP representable. Basically, I have following simplified formulations:

minimize x1^2 + y1^2 + (x1-r1)^2 + (y1-s1)^2 + x2 + 1/y2 + (x2-r2)^2 + (y2-s2)^2 + 1/v + (v-r3)^2 + z
Subject to
a1 * (x1 + 1/y1)^2 + b1*x1 + c1/y1 <= z
a2 * (x2 + 1/w)^2 + b2*x2 + c2/w <= z
a3 - b3 * ((x3-d1)^2 + (y3-e1)^2 + h1^2) >= w
a4 - b4 * ((x3-d2)^2 + (y3-e2)^2 + h2^2) >= v

where variables are in boldface and non-negative. I did use epigraph representations in both constraints and objective function. Any suggestions about how to model the powers and inverse terms so YALMIP could solve it?

Thank you very much!

Johan Löfberg

unread,
Feb 25, 2019, 1:51:02 PM2/25/19
to YALMIP
That's SOCP representable (assuming the constant data adheres to convexity requirements)

If you don't want to use cpower (i.e. start the epigraph socp machinery) you simply use ^-1 etc as you will be forced to use a standard nonlinear solver anyway
Reply all
Reply to author
Forward
0 new messages