why the dual solution is not equal to its primal one?

65 views
Skip to first unread message

覃岭

unread,
Jul 13, 2015, 7:56:01 PM7/13/15
to yal...@googlegroups.com
Hi, Johan. I meet a problem when I did a dual transformation.
I have a linear programming with a equality constraints in it, and I need dualize it for some reason.
but I found my dual problem was not equal to the primal, and I can't find the problem.
So could you please help me check the key code as following:

A is a constant N*M matrix
Y
is a M*1 vector

lambda1
is N*N sdpvar
x
is M*N sdpvar

%primal problem


constr_sc_fsb
=[...
  A
'*diag(Y)*x == diag(ones(1,N)),...%lambda1
  ];
obj = 0;
Result=optimize( constr_sc_fsb, obj, sdpsettings('
solver', 'cplex', 'cplex.lpmethod', 4) );
Lambda1 = dual(constr_sc_fsb(1));

%dual problem
constr_sc_dual=[...
  (A'
*diag(Y]))'*lambda1 == 0,...%h
  ];

obj_dual = sum(sum(diag(ones(1,N)).*lambda1));

Result=optimize( constr_sc_dual, -obj_dual, sdpsettings('
solver', 'cplex', 'cplex.lpmethod', 4) ); %, 'cplex.timelimit', 3000

%check if the dual transformation is correct
disp(sum(sum(abs(Lambda1-value(lambda1)))));%here Lambda1 and lambda1 are all zero matrixes
disp(sum(sum(abs(value(x)-dual(constr_sc_dual(1))))));%x is different from the dual value of the dual problem


the solution shows that the value(x) is not equal to the dual value of the dual problem







Johan Löfberg

unread,
Jul 14, 2015, 4:01:25 AM7/14/15
to yal...@googlegroups.com
Aren't you missing positivity on some variable?

Otherwise I don't know. Wrong model, or non-uniqueness perhaps

覃岭

unread,
Jul 14, 2015, 7:32:13 PM7/14/15
to yal...@googlegroups.com
primal variable vector x is free.
dual variable lambda1 is also free for equality constraint in primal problem.
this problem puzzled me a long time.
Reply all
Reply to author
Forward
0 new messages