Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Exception: <type 'sage.rings.real_mpfr.realliteral'=""> is not a valid type for a Constant value.

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

Exception: <type 'sage.rings.real_mpfr.realliteral'=""> type 'sage.rings.real_mpfr.RealLiteral' is not a valid type for a Constant value.

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