[Csdp] Help to use CSDP in SDP program

Brian Borchers borchers.brian at gmail.com
Wed Dec 26 11:55:49 EST 2012


On Tue, Dec 25, 2012 at 9:17 PM, Wendel Melo <wendelalexandre at gmail.com>wrote:

> Hi experts
>
>
> I have a simple SDP problem to solve. Let Q be a constant symmetric matrix
> and R the decision variable. My model is:
>
> min tr(R)
> subject to:
>
> Q + R is positive semidefinite
> R is positive semidefinte
>
>
> But, reading the CSDP manual, i saw the CSDP form is:
>
> min tr(CR)
> subject to:
>
> A(X) = a
> X is positive semidefinite
>

That should be "tr(CX)" subject to "A(X)=a."  Note that in the MATLAB
interface to CSDP (which is built for compatibility with SeDuMi), we solve
problems with the minimization objective.

This is different in the C interface to CSDP, where we solve problems of
the form:

max tr(CX)
A(X)=b
X is positive semidefinite.

Switching between max and min is trivial (just change the sign of C) and
the MATLAB interface does the work for you.


>
>
> Is there a way of writting my model in the CSDP form?
>

>
Yes there is.  The idea is to make the X matrix a block diagonal matrix of
the form:

X=[X11 0; 0 X22]

where

X11=R
X22=R+Q

Then the problem becomes

min tr(CX)
X22-X11=Q
X is positive semidefinite

where

C=[I 0; 0 0]

This requires linear equality n*(n+1)/2 constraints (one for each element
in the upper triangle of R+Q.)

I've attached a MATLAB code and sample output showing how this can be done
using the MATLAB interface to CSDP.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://list.coin-or.org/pipermail/csdp/attachments/20121226/d91537fd/attachment.html>
-------------- next part --------------
examp
Number of constraints: 6 
Number of SDP blocks: 2 
Number of LP vars: 0 
Iter:  0 Ap: 0.00e+00 Pobj: -5.2190909e+02 Ad: 0.00e+00 Dobj:  0.0000000e+00 
Iter:  1 Ap: 1.00e+00 Pobj: -5.0035890e+02 Ad: 1.00e+00 Dobj: -6.4657746e-01 
Iter:  2 Ap: 1.00e+00 Pobj: -2.4205340e+01 Ad: 1.00e+00 Dobj: -7.9241769e-01 
Iter:  3 Ap: 1.00e+00 Pobj: -9.6992060e+00 Ad: 1.00e+00 Dobj: -3.6075962e+00 
Iter:  4 Ap: 1.00e+00 Pobj: -6.7882519e+00 Ad: 1.00e+00 Dobj: -5.7050340e+00 
Iter:  5 Ap: 1.00e+00 Pobj: -6.1599513e+00 Ad: 1.00e+00 Dobj: -6.0923441e+00 
Iter:  6 Ap: 9.98e-01 Pobj: -6.1242502e+00 Ad: 1.00e+00 Dobj: -6.1220688e+00 
Iter:  7 Ap: 9.99e-01 Pobj: -6.1231403e+00 Ad: 1.00e+00 Dobj: -6.1230805e+00 
Iter:  8 Ap: 9.99e-01 Pobj: -6.1231067e+00 Ad: 1.00e+00 Dobj: -6.1231070e+00 
Iter:  9 Ap: 9.70e-01 Pobj: -6.1231057e+00 Ad: 9.70e-01 Dobj: -6.1231057e+00 
Success: SDP solved
Primal objective value: -6.1231057e+00 
Dual objective value: -6.1231057e+00 
Relative primal infeasibility: 3.46e-16 
Relative dual infeasibility: 7.42e-09 
Real Relative Gap: -2.34e-09 
XZ Relative Gap: 4.68e-09 
DIMACS error measures: 3.99e-16 0.00e+00 1.43e-08 0.00e+00 -2.34e-09 4.68e-09
Elements time: 0.000028 
Factor time: 0.000122 
Other time: 0.002180 
Total time: 0.002331 
0.000u 0.002s 0:00.00 0.0%	0+0k 0+8io 0pf+0w

R =

    6.0317   -0.7425         0
   -0.7425    0.0914         0
         0         0    0.0000


RplusQ =

    0.0317    0.2575         0
    0.2575    2.0914         0
         0         0    3.0000

Trace(R)=6.123106
Eigenvalues of R: 0.000000
Eigenvalues of R: 0.000000
Eigenvalues of R: 6.123106
Eigenvalues of RplusQ: 0.000000
Eigenvalues of RplusQ: 2.123106
Eigenvalues of RplusQ: 3.000000
diary off
-------------- next part --------------
A non-text attachment was scrubbed...
Name: examp.m
Type: application/octet-stream
Size: 1819 bytes
Desc: not available
URL: <http://list.coin-or.org/pipermail/csdp/attachments/20121226/d91537fd/attachment.obj>


More information about the Csdp mailing list