Quadprog new "feature"
4 views (last 30 days)
Show older comments
It seems that in the later versions of Matlab quadprog checks if the problem is convex. In principle I would be happy with such a feature, except that the check is obviously rather rudimental and classifies as nonconvex problems that in fact are convex. This situation can very easily occur in the presence of equality constraints. I understand that a warning could still be thrown at the user, I even understand that the default behaviour should be to return an error, but I do not understand why I cannot set an option to ignore the warning and solve the problem anyway.
0 Comments
Answers (2)
Bruno Luong
on 26 Sep 2018
Can you just switch off by WARNING('off',...) like any other warnings?
3 Comments
Bruno Luong
on 26 Sep 2018
Edited: Bruno Luong
on 26 Sep 2018
Can you provide a small example that creates the blocking?
Bruno Luong
on 26 Sep 2018
Edited: Bruno Luong
on 26 Sep 2018
It might be possible that with big matrix, degenerated semi-convex problem is detected as non-convex due to the numerical accuracy (e.g, eigs() are notoriously returns off eigen values).
You might try to add a small matrix
H = H + small*eye(size(H))
to make the non-convex detection gives less false warning.
Also if your matrix supposes to be symmetric, force it before calling quadprog by doing
H = 0.5*(H+H');
to make sure it is the case.
4 Comments
Steve Grikschat
on 27 Sep 2018
@Mario What release are you using?
In R2017a, a modified interior-point algorithm was introduced in quadprog for small problems with dense matrices. The convexity check is different from the sparse matrix version due to different factorizations in each.
If it had worked with the previous interior-point solver, then try casting the Hessian to sparse. Alternatively, in R2018b, you can set an option. See the release notes: https://www.mathworks.com/help/optim/release-notes.html
In either case, the solver checks convexity as it goes, which is why you'll see cases like Bruno has shown above. The downside is that it is subject to numerical error (which we try to compensate with some regularization).
The alternative that is prevalent in other IPM code is to simply check for a PSD Hessian and be done with it. In your case, it would never work.
If the sparse solver doesn't work, you can try the following undocumented option using an options structure:
options.ConvexCheck = 'off';
>> opts = optimset('quadprog');
>> quadprog([1 0; 0 -1],[1 1], [] ,[],[],[],zeros(2,1),[10; 10],[],opts);
The problem is non-convex.
>> opts.ConvexCheck = 'off';
>> quadprog([1 0; 0 -1],[1 1], [] ,[],[],[],zeros(2,1),[10; 10],[],opts);
Minimum found that satisfies the constraints.
<snip>
See Also
Categories
Find more on Quadratic Programming and Cone Programming in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!