An issue of solving quadratic programming

180 views
Skip to first unread message

wang lingyi

unread,
Jan 10, 2022, 8:28:40 AM1/10/22
to mosek
Hi,
I am trying to solve a quadratic programming (QP) problem using mosek within matlab 2018a. My problem has equality and inequality constraints. The mathematical description of optimization problem is attached as below. I respectively use quadprog function from matlab and mosek to solve the QP. I find that mosek always report exiflag=  -1 in the first iteration while matlab quadprog function can work and find the minimum. I guess it results from the equality constraint that makes the mosek hard to cope with. How can I deal with this problem? 

Thank you very much for any useful advice~

00b88e4d52d6920b07d745d8be687d4.png

Michal Adamaszek

unread,
Jan 10, 2022, 8:33:01 AM1/10/22
to mosek
Impossible to say anything useful without a reproducible example or at least a complete log output.

Having an equality constraint is itself not an issue.

Here is the documentation in case you want to increase verbosity and/or save a task file https://docs.mosek.com/latest/toolbox/reference.html#quadprog

Michal

Erling D. Andersen

unread,
Jan 10, 2022, 8:36:34 AM1/10/22
to mosek
Could be H is not positive semi-definite or otherwise ill-conditioned.
Maybe quadprog accepts such problems.

Mark L. Stone

unread,
Jan 10, 2022, 8:45:20 AM1/10/22
to mosek
MATLAB's quadprog accepts all QPs, convex or non-convex.

Mark L. Stone

unread,
Jan 10, 2022, 8:47:07 AM1/10/22
to mosek
MATLAB's quadprog attempts to find local (not global) minimum of non-convex QPs.

wang lingyi

unread,
Jan 10, 2022, 9:18:03 AM1/10/22
to mosek
Thank you for your advice. Attached below is my Diagnostics output. I surprisingly find that it shows that primal and dual feasible, while the exitflag= -1. And I tried to write my prob structure to an output file, but what format should I output ? In the instruction link listed above, it is myprob.opf. Is that ok that my output file is in opf format? Attached below is my programming interface. 

c663552a38dcebb443fa2f39801d4c1.png
      


 5eb2b5d0c8cc0b6e08edc4a32552883.png
52b6c289c4a865fbf6fc99c363e188e.png
01b6eee05249988fa7a50065a76b315.png
55ba52ee7a122a49e72c5e42a43ffe5.png

Michal Adamaszek

unread,
Jan 10, 2022, 9:33:39 AM1/10/22
to mosek
You may be right, I suspect that the stall termination code is not handled properly and leads to the -1. It's a minor bug we will need to fix.

In the meantime if all you want to do is solve QPs then find the file mskeflag.m in your toolbox installation and change line 6 from

if rcode==0 && isfield(res,'sol')

to

if isfield(res,'sol')

and see if that gives exitflag=1



wang lingyi

unread,
Jan 10, 2022, 10:04:20 AM1/10/22
to mosek

yeah, it gives exactly exitflag=1

Michal Adamaszek

unread,
Jan 10, 2022, 1:38:14 PM1/10/22
to mosek
Thanks for confirming. So just to clarify, the bug is only in a bit careless converting the response code from the solver into an exitflag, and not in the actual solution. Since this is a bit obscure corner of the API and the fix should work for you, it is possible we will just fix it officially in the upcoming version 10 and leave 9.3 as it is.

Thanks for reporting.

Reply all
Reply to author
Forward
0 new messages