Exception: type 'sage.rings.real_mpfr.RealLiteral' is not a valid type for a Constant value.

asked 2014-01-09 12:50:35 -0500

Behzad gravatar image

updated 2014-01-09 12:51:12 -0500

I added cvxpy and ecos to my Sage installation. When I run the following code for the first time, I get the exception in the title. However, the second time the code runs fine.

RealNumber=float

Integer=int

import numpy

from pylab import *

import math

from cvxopt import matrix as m

from cvxpy import *

x = Variable(1)

y = Variable(1)

constraints

constraints = [ x+y >= -1.0, x+y <= 10.0]

objective

objective = Maximize(x+y)

p = Problem(objective, constraints)

result = p.solve()

print result

The optimal value

print x.value

print y.value

edit retag flag offensive close merge delete