dual

Tags:

Updated:


dual is used to extract the dual variable related to a constraint.

Syntax

Z = dual(F)

Examples

After solving an optimization problem we can, e.g., extract the dual variable of the 2nd constraint.

A = [-1 2;-3 -4];
P = sdpvar(2,2);
F = [P >= 0, A'*P+P*A <= 0, trace(P) == 1];
optimize(F);
Z2 = dual(F(2));

If a constraint has been tagged, we can use the tag to index the constraint.

F = [P >= 0, (A'*P+P*A <= 0):'Lyapunov', trace(P) == 1];
optimize(F);
Z2 = dual(F('Lyapunov'));

Leave a Comment