'mosek' slower then 'mosek-sdp' for a standard QP

263 views
Skip to first unread message

Lukas

unread,
May 12, 2014, 11:39:27 AM5/12/14
to yal...@googlegroups.com
Hey,

I have a standard Quadratic Program to solve. When using solvesdp and choosing the solver 'mosek' the command line output tells me that the QP-solver from mosek is used and if i choose 'mosek-sdp' then conic optimization is used. Strange is, that the 'mosek' solver is a way slower then 'mosek-sdp' and i do not have a clue why. For me it would be more obvious if the QP-solver from mosek, solves my QP the fastest.

does anybody know the reason why this could be? 

the setup is: the row vector x is my variable, objective = x'*C*x + c'*x, constraint = [Ax <= a, Bx == b]

i am wondering if it can happen that get wrong results because mosek is not using the qp-solver with 'mosek-sdp'. 

Thanks

Johan Löfberg

unread,
May 12, 2014, 1:35:51 PM5/12/14
to yal...@googlegroups.com
You would have to supply data as I cannot see anything on a quick test

n = 100;
x
= sdpvar(n,1);
Q
= randn(n);Q=Q*Q';
solvesdp([sum(x)==1,x>=0],x'
*Q*x,sdpsettings('solver','mosek'))
solvesdp
([sum(x)==1,x>=0],x'*Q*x,sdpsettings('solver','mosek-sdp'))

Note, 'mosek-sdp' actually doesn't solve the problem as an sdp. It formulates the problem as a qcqp and sets up that for mosek.

Joachim Dahl

unread,
May 13, 2014, 5:38:47 AM5/13/14
to yal...@googlegroups.com
The differences in speed you notice is probably due to fewer iterations in the SOCP solver, and I suppose that happens because your C matrix is badly scaled, whereas the factor of C used in the conic solver is better scaled.  But that is just a guess...

As an aside, if you have C in factored form to start with, i.e.,  C = V*V' where you know V, then it's often recommended to use the conic formulation instead of the quadratic formulation.


Johan Löfberg

unread,
May 13, 2014, 5:59:01 AM5/13/14
to yal...@googlegroups.com
Note that the SOCP formulation has been done by YALMIP based on the matrix C, hence it is not for sure that the SOCP problem is well-conditioned, as YALMIP might have had problems when creating a factorization. Would be interesting to see the data.

If you have C=V*V', it is much better to manually derive an SOCP-based model, than force YALMIP to first work with the typically huge symbolic object x'*C*x, and then come up with a suitable factorization (which can be problematic when C is singular or generally ill-conditioned) to get it into an SOCP form

Lukas

unread,
May 13, 2014, 11:06:41 AM5/13/14
to yal...@googlegroups.com
thanks for your help.
the matrix C has eigenvalues approximately between 1 and 4.4. So i guess this means C is not badly scaled! Furhermore most of the matrix elements are 0. Unfortunatly i have the matirx in form C= V*V' but i guess it is easy to compute V in matlab.
I attached *.mat file with the matrix C!

So your suggestion is (if C is definite) to compute V and then formulate the problem in an SOCP and using 'mosek-sdp'?
I have to rum the optimization severl times with different constraints and would be very nice if its a bit fast!

Thanks for your support,
Lukas
yalmip_qa.mat

Erling D. Andersen

unread,
May 14, 2014, 1:16:41 AM5/14/14
to yal...@googlegroups.com
It is almost always better to convert QP to SOCP by hand because some sparsity/structure is typically lost when forming the Q matrix from the raw data. The note


has discussion why that is the case.

Johan Löfberg

unread,
May 14, 2014, 1:53:18 AM5/14/14
to yal...@googlegroups.com
YALMIP computes a factorization if you select mosek-sdp, as YALMIP then must derive an SOCP model. However, going from  C=V*V' to W*W'=C (the same factorization is not obtained) might lose features in the original factorization.

In the data you supplied, I saw no difference in performance, so I guess it depends on the constraints too.
Reply all
Reply to author
Forward
0 new messages