This appeared in #sage-devel:

00:55 < mabshoff> vgermrk: hirnport is a pretty cool name for a computer.
00:55 < vgermrk> thanks! is there a way to solve semidefinite programs in sage?
00:56 < mabshoff> probably, the question is more how much effort it would be.

I have no idea who vgermrk is but if that person sees this or somebody
knows that
person, let them know that semidefinite programming is already included in Sage,
since Sage includes cvxopt, which can do it:

CVXOPT Example page about this:

http://abel.ee.ucla.edu/cvxopt/documentation/users-guide/node48.html

ACTUAL Example (in the notebook, with %python mode to
avoid preparsing issues):

{{{
%python

from cvxopt.base import matrix
from cvxopt import solvers
c = matrix([1.,-1.,1.])
G = [ matrix([[-7., -11., -11., 3.],
                  [ 7., -18., -18., 8.],
                  [-2.,  -8.,  -8., 1.]]) ]
G += [ matrix([[-21., -11.,   0., -11.,  10.,   8.,   0.,   8., 5.],
                   [  0.,  10.,  16.,  10., -10., -10.,  16., -10., 3.],
                   [ -5.,   2., -17.,   2.,  -6.,   8., -17.,  -7., 6.]]) ]
h = [ matrix([[33., -9.], [-9., 26.]]) ]
h += [ matrix([[14., 9., 40.], [9., 91., 10.], [40., 10., 15.]]) ]
sol = solvers.sdp(c, Gs=G, hs=h)
print sol['x']
///
     pcost       dcost       gap    pres   dres   k/t
 0: -1.2037e+00 -1.8539e+02  2e+02  2e-16  8e+00  1e+00
 1: -1.2937e+00 -6.8551e+00  5e+00  7e-16  3e-01  3e-02
 2: -2.8964e+00 -3.7331e+00  7e-01  4e-16  4e-02  5e-02
 3: -3.0150e+00 -3.2556e+00  2e-01  4e-16  1e-02  2e-02
 4: -3.1389e+00 -3.1932e+00  5e-02  2e-15  3e-03  5e-03
 5: -3.1533e+00 -3.1547e+00  1e-03  4e-16  7e-05  1e-04
 6: -3.1535e+00 -3.1536e+00  5e-05  6e-16  3e-06  6e-06
 7: -3.1535e+00 -3.1535e+00  1e-06  6e-16  7e-08  2e-07
  -3.6767e-01
   1.8983e+00
  -8.8755e-01
}}}

-- 
William Stein
Associate Professor of Mathematics
University of Washington
http://wstein.org

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://sage.math.washington.edu/sage/ and http://sage.scipy.org/sage/
-~----------~----~----~----~------~----~------~--~---

Reply via email to