quadprog output: this problem is non-convex
Show older comments
I am trying to solve a quadratic optimization problem but quadprog keeps telling me that my problem is non-convex.
After several experiments, I found that the problem comes from the equation constraints matrix A, which is a 57250*57441 matrix.
For the following code,
[m, n] = size(A);
assert(m < n);
options = optimoptions('quadprog','Display','off');
[Pwp,fval,exitflag,output] = quadprog(speye(n), zeros(n,1), [], [], A, zeros(m, 1), [], [], [], options);
obviously the solution should be the all-zero vector. But the output still said that this is a nonconvex problem.
=============
Update: I am using matlab 2022b. Here is the link for the mat file of my matrix A:
I am sorry that it's larger than 5MB so I can only put the link here instead of directly attaching it to this post.
11 Comments
Matt J
on 14 Aug 2024
You haven't indicated what release you're using, but I don't get that message in R2023b.
Changhe
on 14 Aug 2024
Matt J
on 14 Aug 2024
Is A in sparse form?
Changhe
on 14 Aug 2024
Walter Roberson
on 14 Aug 2024
It works in R2024b. I am going back to test in R2022b.
Walter Roberson
on 14 Aug 2024
It works for me in R2022b. The resulting Pwp is all ones.
Matt J
on 14 Aug 2024
It works for me in R2022b. The resulting Pwp is all ones.
Clearly the wrong result. Are you sure there isn't a premultiplying constant scaling it down close to zero?
Matt J
on 14 Aug 2024
but quadprog keeps telling me that my problem is non-convex.
I have reproduced this with the given A matrix in R2023b. Hmmm...
Torsten
on 14 Aug 2024
Walter Roberson
on 14 Aug 2024
All, I was counting on the fact that there was no error message, and was not checking exitflag . exitflag is showing up as -6, non-convex problem detected.
Walter Roberson
on 14 Aug 2024
Unfortunately the invoked routine, ipqpsparse, is a .p file, so we cannot examine what is going on internally.
Accepted Answer
More Answers (1)
Maybe there are Inf or NaN coefficients in your A ? The following small example works.
A = rand(53,66);
[m,n] = size(A);
options = optimoptions('quadprog','Display','off');
[Pwp,fval,exitflag,output] = quadprog(speye(n), zeros(n,1), [], [], A, zeros(m, 1), [], [], [], options)
6 Comments
Changhe
on 14 Aug 2024
Walter Roberson
on 14 Aug 2024
Store A in a .mat file and attach the .mat file. If that would be too large, try zipping the .mat file and attaching the zip
Changhe
on 14 Aug 2024
Changhe
on 14 Aug 2024
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!