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

asked 2014-01-09 19:50:35 +0100

Behzad gravatar image

updated 2014-01-09 19:51:12 +0100

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.



import numpy

from pylab import *

import math

from cvxopt import matrix as m

from cvxpy import *

x = Variable(1)

y = Variable(1)


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


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