Is it possible to solve quadratic inequalities with MILP? Trying to do so I 
get an error:

sage: p = MixedIntegerLinearProgram(maximization=False, solver='GLPK')
sage: x = p.new_variable(integer=False)
sage: eq = x[5] * x[0] + x[6] * x[1] + x[7] * x[2] + x[8] * x[3] + x[9] * x[
4]; eq
x_1 x_0 +x_3 x_2 +x_5 x_4 +x_7 x_6 +x_9 x_8


sage: p.add_constraint(eq <= 2)
Traceback (most recent call last): File "<stdin>", line 1, in <module> File 
"_sage_input_160.py", line 10, in <module> exec 
compile(u'open("___code___.py","w").write("# 
-*- coding: utf-8 -*-\\n" + 
_support_.preparse_worksheet_cell(base64.b64decode("cC5hZGRfY29uc3RyYWludChlcSA8PSAyKQ=="),globals())+"\\n");
 
execfile(os.path.abspath("___code___.py")) File "", line 1, in <module> 
File "/tmp/tmpAdb8Fi/___code___.py", line 3, in <module> exec compile(u'p.
add_constraint(eq <= _sage_const_2 ) File "", line 1, in <module> File 
"mip.pyx", line 1063, in 
sage.numerical.mip.MixedIntegerLinearProgram.add_constraint 
(sage/numerical/mip.c:6240) File "mip.pyx", line 1054, in sage.numerical.mip
.MixedIntegerLinearProgram.add_constraint (sage/numerical/mip.c:6123) File 
"glpk_backend.pyx", line 411, in sage.numerical.backends.glpk_backend.
GLPKBackend.add_linear_constraint (sage/numerical/backends/glpk_backend.cpp:
3722) AttributeError: LinearFunction instance has no attribute '__float__'



-- 
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org

Reply via email to