Problem when using quadprog solver with the 'active-set' algorithm

15 views (last 30 days)
I don't know what's the best way to explain it, but basically I am unable to solve an optimization problem with function quadprog and active-set algorithm while interior-point did it with no problems. The exit flag that I get is 0 (The maximum number of iterations was reached. Solution x might be suboptimal or infeasible). I don't understand, since the only thing that changes from the interior-point case is the fact that I now have to give an initial value as input. I don't see why it would be the number of iterations either, I've already tried to increase it. I have also tried to debug it but when I try to step into the asqpdense function it takes me to the optimget function, so I don´t really know what is going on.
My code is a little extense and it calls many custom functions, so I don´t know what´s the best way upload it here. It is a MPC problem based on the code provided in GitHub - ARMSLab/slmpc: Successive Linearization Model Predictive Control and explained in Successive linearization based model predictive control of variable stiffness actuated robots | IEEE Conference Publication | IEEE Xplore. It seems that I need to have the solver options set to use the active-set algorithm in order to generate code (which I need), so that's why I am trying to make active-set work.
Edit: Added the .mat file with the inputs to quadprog:
[u, ~, exitflag, output] = quadprog(H, f, Acon, Bcon, [], [], [], [], initpoint, opts);
Edit 2: I've found the problem, it was in the construction of the lifted system matrices. Now it is working with active-set, however, I still don't understand why it worked with interior-point before.
  4 Comments
Pedro Carvalho
Pedro Carvalho on 4 Jun 2024
@Torsten It's the same problem for both, the thing is that I want to generate C code from that later, and it says here Code Generation for quadprog Background - MATLAB & Simulink (mathworks.com) that the algorithm must be set to 'active-set'.

Sign in to comment.

Accepted Answer

Shivansh
Shivansh on 22 Jun 2024
Hi Pedro,
The difference in behavior between the 'active-set' and 'interior-point' algorithms in 'quadprog' can be attributed to the fundamental differences in how these algorithms approach the optimization problem.
The success in optimization in the first case using initial point can be attributed to its robustness to the initial starting point, better handling of complex or ill-conditoned problem or the use of barrier function to keep the iterate in the feasible region.
The active-set method can be helpful for certain types of problems as it is more sensitive to the initial point and the problem's structure. The interior-point method's robustness and better handling of complex constraints likely allowed it to succeed for the earlier case.
I hope it helps!

More Answers (0)

Categories

Find more on Financial Toolbox in Help Center and File Exchange

Products


Release

R2024a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!