The primal/dual formulation seemingly does not work

33 views
Skip to first unread message

bin liu

unread,
Dec 15, 2016, 8:52:56 AM12/15/16
to YALMIP
When solving the following problem in primal and dual formulation, the optimal solutions are not consistent. I'm quite fused of why this happens...
if anyone knows, please help.
Thanks a lot.
clear;clc;
%variables: X and sigX
X=sdpvar(3,3);
sigX=sdpvar(3,1);
%parameters: z
z=[    0.7913    0.9018    0.8870
    0.5942    0.0931    0.6574
    0.3096    0.3190    0.6845];
%constraints/objective: cons/obj
cons=[sum(z.*X)==1]+[X>=0]+[sigX>=0];
obj=sum(sum(abs(X)))+sum(sigX);
%solve problem in primal formulation
optimize(cons,obj);
sigV(:,1)=value(sigX);
y(1)=value(obj);
%solve problem in dual formulation
optimize(cons,obj,sdpsettings('dualize',1));
sigV(:,2)=value(sigX);
y(2)=value(obj);
%compare computation results
sigV
y
% the two problems are solved by MOSEK 8 with the latest yalmip, i.e.
% YALMIP-R20160930-patched and MATLAB 2015b.

Johan Löfberg

unread,
Dec 15, 2016, 9:06:30 AM12/15/16
to YALMIP
Appears to be a bug, will look into it

Johan Löfberg

unread,
Dec 15, 2016, 9:15:38 AM12/15/16
to YALMIP
At least it is not a recently introduced bug, as it happens in old versions too.

You've managed to run in to some edge-case, through the trivial parts of the model you have. The variable sigX only enters the objective and nowhere else (except being a LP cone), i.e, it is effectively redundant as sigX = 0 is trivially optimal

bin liu

unread,
Dec 15, 2016, 10:01:16 AM12/15/16
to YALMIP
Thanks a lot. 

However, according to the computation information given below under the latter formulation, i.e. dual formulation, the final optimal objective value seems to be reported incorrectly...

Besides, the information of the computation process provided by two formulations are quite similar to each other.



ITE PFEAS    DFEAS    GFEAS    PRSTATUS   POBJ              DOBJ              MU       TIME  
0   1.0e+000 1.0e+000 1.0e+000 0.00e+000  0.000000000e+000  0.000000000e+000  1.0e+000 0.00  
1   1.7e-001 1.7e-001 4.1e-001 1.33e+000  5.158650700e+000  5.247905316e+000  1.7e-001 0.02  
2   2.9e-002 2.9e-002 1.9e-001 1.16e+000  5.405773152e+000  5.406338183e+000  2.9e-002 0.02  
3   6.3e-003 6.3e-003 8.5e-002 9.96e-001  5.446908078e+000  5.448129895e+000  6.3e-003 0.02  
4   5.4e-004 5.4e-004 2.5e-002 9.56e-001  5.427037114e+000  5.427068989e+000  5.4e-004 0.02  
5   5.2e-006 5.2e-006 2.5e-003 9.99e-001  5.427601007e+000  5.427600732e+000  5.2e-006 0.02  
6   3.3e-007 3.3e-007 6.4e-004 1.00e+000  5.427607543e+000  5.427607524e+000  3.3e-007 0.02  
7   3.6e-008 3.6e-008 2.1e-004 1.00e+000  5.427607847e+000  5.427607845e+000  3.6e-008 0.02  
8   3.6e-009 3.6e-009 6.6e-005 1.00e+000  5.427607880e+000  5.427607880e+000  3.6e-009 0.02  
Interior-point optimizer terminated. Time: 0.02. 

Optimizer terminated. Time: 0.03    

Interior-point solution summary
  Problem status  : PRIMAL_AND_DUAL_FEASIBLE
  Solution status : OPTIMAL
  Primal.  obj: 5.4276078804e+000   nrm: 3e+000   Viol.  con: 6e-009   var: 2e-009   barvar: 0e+000 
  Dual.    obj: 5.4276078801e+000   nrm: 4e+000   Viol.  con: 0e+000   var: 7e-009   barvar: 6e-009 



>> value(obj)

ans =

    8.4276
Reply all
Reply to author
Forward
0 new messages