Solution printing with YALMIP

69 views
Skip to first unread message

Elias

unread,
Jan 29, 2014, 6:07:04 AM1/29/14
to yal...@googlegroups.com
Hi all,

I am quite new in MATLAB and YALMIP.
I am trying yalmip and whenever I use it, the solution of the problem is not printed. Just the statistics.
Maybe I have to add a few commands to get this done?

This is an example on a SOCP problem. I would like see the solution x, to compare with other method.
Thanks
Elias

>> x=sdpvar(3,1);
>> Constraints=[cone([x(2);x(3)],x(1)), cone([x(2);x(3)],-x(1)+1)];
>> Objective=x(1);
>> Objective=x(1);
>> sol=solvesdp(Constraints,Objective)
SeDuMi 1.3 by AdvOL, 2005-2008 and Jos F. Sturm, 1998-2003.
Alg = 2: xz-corrector, theta = 0.250, beta = 0.500
eqs m = 3, order n = 5, dim = 7, blocks = 3
nnz(A) = 6 + 0, nnz(ADA) = 9, nnz(L) = 6
 it :     b*y       gap    delta  rate   t/tP*  t/tD*   feas cg cg  prec
  0 :            5.68E+00 0.000
  1 :  -1.63E-01 1.64E+00 0.000 0.2890 0.9000 0.9000   1.73  1  1  1.5E+00
  2 :  -3.64E-02 1.51E-01 0.000 0.0917 0.9900 0.9900   1.75  1  1  6.1E-01
  3 :   1.13E-06 7.71E-06 0.000 0.0001 1.0000 1.0000   0.99  1  1  3.5E-04
  4 :   1.17E-13 7.98E-13 0.000 0.0000 1.0000 1.0000   1.00  1  1  3.6E-11

iter seconds digits       c*x               b*y
  4      0.0   8.5  1.9013237381e-13  1.1733977336e-13
|Ax-b| =   6.9e-14, [Ay-c]_+ =   8.3E-14, |x|=  1.0e+00, |y|=  1.2e-13

Detailed timing (sec)
   Pre          IPM          Post
3.993E-03    3.201E-02    9.958E-04    
Max-norms: ||b||=1, ||c|| = 1,
Cholesky |add|=0, |skip| = 0, ||L.L|| = 1.

sol = 

    yalmiptime: 0.0630
    solvertime: 0.0390
          info: 'Successfully solved (SeDuMi-1.3)'
       problem: 0

Johan Löfberg

unread,
Jan 29, 2014, 6:10:32 AM1/29/14
to yal...@googlegroups.com
You extract the solutions by applying the function double

http://users.isy.liu.se/johanl/yalmip/pmwiki.php?n=Tutorials.Basics

BTW, perhaps you really wanted to use the low level cone command, but the cone modelling can be done automatically by YALMIP

Constraints=[norm(x(2:3)) <= x(1), norm(x(2:3)) <= -x(1)+1];


Elias

unread,
Jan 29, 2014, 8:59:17 AM1/29/14
to yal...@googlegroups.com
Thanks a lot for that. The solutions are now printed.

As for your second suggestion, it help me notice something rather surprising:
I get completely different solutions depending on that I use one of the two modeling options:
Constraints=[cone(x(2:3), x(1)), cone(x(2:3),-x(1)+1)];

or 

Constraints=[norm(x(2:3)) <= x(1), norm(x(2:3)) <= -x(1)+1];

Please, how can this be explained?

Thanks again

Johan Löfberg

unread,
Jan 29, 2014, 9:22:57 AM1/29/14
to yal...@googlegroups.com
I get the same solution, the trivially optimal solution x=0
Reply all
Reply to author
Forward
0 new messages