Nonconvex optimization problem

174 views
Skip to first unread message

BRIDGETHUA

unread,
Nov 2, 2023, 1:05:32 AM11/2/23
to YALMIP

My solver is gurobi and the latest version of yalmip is installed.

Besides, the "callgurobi.m" I have add to the param.NonConvex=2, since I first run the code a nonconvex error  appears.

gurobi.JPG

Capture.JPG

I am new to optimization, is it related to the non-convex optimization problem? In that case, what should I do to make this problem feasible?

Attached "main1102.m" is to run."gurobi1102.m" is the MPC controller I designed for the "testmodel.slx"

Thanks in advance for your help and time!

parameters.mat
predictionmodel.mat
main1102.m
gurobi1102.m
testmodel.slx

Johan Löfberg

unread,
Nov 2, 2023, 3:30:09 AM11/2/23
to YALMIP
Normally you never touch gurobi.nonconvex as YALMIP does this internally automatically. However, in this case inside an optimizer constructs (which prunes the options structure for performance reasons) something goes wrong in the logic, so you have to hack around that with

s = Controller.options;
s.gurobi.nonconvex = 2;
Controller.options = s;

I would also recommend you to set verbose to 2 so you actually see that gurobi is running (and of course takes a long time to solve the problem as you are requesting a global solution to a large nonconvex QP)

It is not infeasible and gurobi finds a feasible solution rather quickly (does not manage to close gap though (or even generate a lower bound) so struggles to prove any kind of optimality)

Root relaxation: unbounded, 101 iterations, 0.00 seconds (0.00 work units)

    Nodes    |    Current Node    |     Objective Bounds      |     Work
 Expl Unexpl |  Obj  Depth IntInf | Incumbent    BestBd   Gap | It/Node Time

     0     0  postponed    0               -          -      -     -    0s
     0     0  postponed    0               -          -      -     -    0s
H    0     0                      36.5590239          -      -     -    0s
     0     2  postponed    0        36.55902          -      -     -    0s
  3232  1872  postponed  220        36.55902          -      -   0.6    5s
  6392  4118  postponed  563        36.55902          -      -   0.5   10s

you are however declaring any non-zero diagnostic code (such as time-out) as infeasible

BRIDGETHUA

unread,
Nov 2, 2023, 6:15:45 AM11/2/23
to YALMIP
Hi Prof.,

thank you for your prompt reply. I revised the controller synthesis as you suggested. I also removed "model.param.NonConvex=2" from the "callgurobi.m".
 gurobiupdate.JPG
I set alpha to 1 and rerun the code. But the controller of the first step takes a lot of time and I never get the synthesized controller of the first time step.  Is it normal to take so long to compute?
Capture1.JPGCapture2.JPG
Meanwhile,  how to read the table? What does the third column mean "infeasible""cutoff" and number? What should a feasible solution look like?
Attached the code again

Johan Löfberg 在 2023年11月2日 星期四下午3:30:09 [UTC+8] 的信中寫道:
main1102.m
gurobi1102.m
parameters.mat
predictionmodel.mat
testmodel.slx

Johan Löfberg

unread,
Nov 2, 2023, 7:28:25 AM11/2/23
to YALMIP
Yes, it can take almost arbitrarily long time, as you are setting up a nonconvex objective ((2E-4)*f(k).^2-f(k)*yo{k}(4)) and ask for a global solution

for interpreting the log of a global nonlinear b&b code you will have to first study this topic. infeasible means investigated node was infeasible, cutoff means investigated node must be sub-optimal and thus can be eliminated. gurobi essentially implements this https://yalmip.github.io/tutorial/envelopesinbmibnb

Message has been deleted

BRIDGETHUA

unread,
Nov 3, 2023, 12:25:55 AM11/3/23
to YALMIP

Hi Prof.,

Appreciate for your thorough and detailed reply!

I still have some questions on the definition of the non-convex and convex LQ problems. Specifically, how to determine if my problem is non-convex?

Capture.JPG

2)     If this is not correct, how to check the non-convex value function plot against the state vector?  Given that the computational time for the non-convex global optimization problem is arbitrarily long, I plan to plot the value function against the initial state vector through dynamic programming by MPT toolbox. But the dynamic programming solution (a convex one, I suppose?) could only be regarded as the approximation of the non-convex global optimization problem.  Will the initial non-convexity characteristics be inherited by the dynamic programming value function?

Thanks again for your time and patience!

Johan Löfberg 在 2023年11月2日 星期四晚上7:28:25 [UTC+8] 的信中寫道:

Johan Löfberg

unread,
Nov 3, 2023, 2:44:13 AM11/3/23
to YALMIP
Correct, for alpha=0 the problem is purely quadratic in y thus positive semidefinite in (y,f), when alpha=1 it is not convex as you have bilinears in y and f and a f^2 but no y^2 thus impossibly convex. for alpha in-between it will be some point where it goes from positive semidefinite to indefinite

BRIDGETHUA

unread,
Nov 3, 2023, 3:57:17 AM11/3/23
to YALMIP
Many thanks for your comment and help! I got it.

Johan Löfberg 在 2023年11月3日 星期五下午2:44:13 [UTC+8] 的信中寫道:
Reply all
Reply to author
Forward
0 new messages