dualize

Tags:

Updated:

dualize is used to convert an SDP problem described in primal form to the corresponding dual problem which is the assumed form used in YALMIP. If your model is expressed in primal form, this can lead to a much faster solution.

Syntax

[Fd,objd,X,free] = dualize(F,obj)


Examples

Consider the following SDP problem naturally interpreted as a simple primal model

X = sdpvar(3,3);
Y = sdpvar(3,3);
F = [X>=0, Y>=0];
F = [F, X(1,3)==9, Y(1,1)==X(2,2)];
F = [F,sum(sum(X))+sum(sum(Y)) == 20];
obj = trace(X)+trace(Y);


We can solve this in the given format. This will however be very inefficient in YALMIP, since the matrices X and Y will be explicitly parametrized, and the problem will be solved in a dual form with equality constraints. Instead, we note that the problem is an SDP in standard primal form. We therefor let YALMIP extract this primal model, and return the dual of this. If we solve this problem, the dual of this will be the original primal. Confused yet? (note that the dual objective should be maximized)

[Fd,objd,XX,y] = dualize(F,obj);
optimize(Fd,-objd);


To obtain our original variables, we extract the duals and assign them to our original primals.

assign(XX{1},dual(Fd(1));
assign(XX{2},dual(Fd(2));


In most cases, the user does not have to bother about the details. Instead, a simple flag does it all.

optimize(F,obj,sdpsettings('dualize',1));