ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Thu, 09 Jan 2014 19:50:35 +0100Exception: type 'sage.rings.real_mpfr.RealLiteral' is not a valid type for a Constant value.https://ask.sagemath.org/question/10898/exception-type-sageringsreal_mpfrrealliteral-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.valueBehzadThu, 09 Jan 2014 19:50:35 +0100https://ask.sagemath.org/question/10898/How can I add cvxpy to Sagehttps://ask.sagemath.org/question/10856/how-can-i-add-cvxpy-to-sage/It is not easy to describe convex optimization problems for CVXOPT because CVXOPT is just the solver and there is almost no "modeling" (or user friendly interface). Take Yalmip as an example. With Yalmip, you can add constraints as:
x1+2*x2<=0 and much more (including matrices). The closest thing I found for CVXOPT was cvxpy. I was wondering how I can add cvxpy to my Sage installation.
ThanksBehzadMon, 23 Dec 2013 22:55:27 +0100https://ask.sagemath.org/question/10856/