I am trying to solve this simple linear programming prob using
MixedIntegerLinearProgram and it gives an AttributeError:
LinearFunction instance has no attribute '__float__' exception



sage: p =
MixedIntegerLinearProgram(maximization=True)
sage: x =
p.new_variable()
sage: p.add_constraint(x[0] + x[1] ,
min=3)
sage: p.add_constraint(20*x[0] + 10*x[1] ,
max=80)
sage: p.add_constraint(x[1] ,
max=2*x[0])
sage: p.set_objective(2*x[0]+3*x[1])
p.show()
Maximization:
  2 x_0 +3 x_1
Constraints:
   3 <= x_0 +x_1
   20 x_0 +10 x_1 <= 80
   x_1 <= 2 x_0
Variables:
  x_0 is a real variable (min=0.0, max=+oo)
  x_1 is a real variable (min=0.0, max=+oo)
sage: p.solve()
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call
last)

/Hanoi/Storage.Hanoi/DL/<ipython console> in <module>()

/home/tnguyen/Src/Devel/sage/local/lib/python2.6/site-packages/sage/
numerical/mip.so in sage.numerical.mip.MixedIntegerLinearProgram.solve
(sage/numerical/mip.c:8036)()

/home/tnguyen/Src/Devel/sage/local/lib/python2.6/site-packages/sage/
numerical/mip_glpk.so in sage.numerical.mip_glpk.solve_glpk (sage/
numerical/mip_glpk.cpp:725)()

/home/tnguyen/Src/Devel/sage/local/lib/python2.6/site-packages/sage/
numerical/mip_glpk.so in sage.numerical.mip_glpk.build_glp_prob (sage/
numerical/mip_glpk.cpp:2272)()

AttributeError: LinearFunction instance has no attribute '__float__'

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

Reply via email to