Mosek is slower than Yalmip calling mosek

42 views
Skip to first unread message

Bin Christian

unread,
Sep 11, 2025, 11:42:42 PMSep 11
to YALMIP
I solved my SDP problem with Mosek Python fusion and Yalmip calling Mosek, respectively. Both achieve the same optimal solution, but the solution time of Yalmip with Mosek is much shorter than that of Mosek Python fusion. I guess that it is because Yalmip dualizes my SDP problem and passes the dual problem to Mosek, which makes it much faster than using Mosek Python fusion directly. Am I right? How to cancel this dualization of Yalmip such that I can do a fair comparison between Mosek Python fusion and Yalmip calling Mosek.

Michal Adamaszek

unread,
Sep 12, 2025, 2:34:09 AMSep 12
to YALMIP
It is very likely that this is exactly what you are experiencing. A better approach would be to model the dual in Python and get a fair comparison between two naturally efficient models, rather than between two artificially inefficient models.

Michal

Johan Löfberg

unread,
Sep 12, 2025, 2:54:16 AMSep 12
to YALMIP
YALMIP does not dualize anything explicitly so there is not anything you can cancel. YALMIP *interprets* your model as a representation of the dual standard form max b^Ty s.t C-A(y)>=0 and I can only assume that is the natural way to represent your model. Impossible to answer though as we don't know what you are doing

Bin Christian

unread,
Sep 12, 2025, 3:44:32 AMSep 12
to YALMIP
I have attached the log files of running my instance. For the 'log(dualize=0)' log, I set the 'dualize' parameter in sdpsettings to 0 and for the 'log(dualize=1)' log, I set the 'dualize' parameter to 1. The former is much faster than the latter. I guess it is because I closed the dualize operation for Yalmip before calling Mosek. Am I right? Actually, I want to solve MISDP by Yalmip with bnb. However, we can not set the 'dualize' to 1 when solving MISDP. How can I avoid this automatic dualization of Yalmip for my MISDP?
log(dualize=0).txt
log(dualize=1).txt

Johan Löfberg

unread,
Sep 12, 2025, 3:53:59 AMSep 12
to YALMIP
Leaving dualize to 0, which is default, means that YALMIP interprets your model as a parameterization of the standard dual form, i.e. it extracts data under the assumption that you are modelling C-A(y)>=0, Fy=f. If that is the best way to interpret it, well then that is the best way. Applying dualize when working with bnb will not work, YALMIP will not waste time on moving back and forth between different representions in the nodes.

If you absolutely want a bad representation of say [10 - y 1+y;1+y y]>=0 y integer (which thus is a model (when releaxed) in dual space with 1 variable, i.e. 1 constraint in primal space) you would have to explicitly write it as X = sdpvar(2),y = intvar(1); X>=0, X(1)==10-y1, 1+y==X(1,2), X(2,2)=y, which needless to say will be a very expensive representation.

Bin Christian

unread,
Sep 12, 2025, 4:21:29 AMSep 12
to YALMIP
I see. Thanks.
Reply all
Reply to author
Forward
0 new messages