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.Tue, 24 Feb 2015 14:35:43 +0100Change in linear programming syntaxhttps://ask.sagemath.org/question/25913/change-in-linear-programming-syntax/Until the recent update in SMC to the latest version of Sage, the following would work:
p = MixedIntegerLinearProgram()
x=p.new_variable(nonnegative=True)
y=p.new_variable(nonnegative=True)
z=p.new_variable(nonnegative=True)
p.set_objective(x + y+ 3*z)
This now gives an error saying that * and + are not defined for these objects.
The following does work, however:
p = MixedIntegerLinearProgram()
x=p.new_variable(nonnegative=True)
y=p.new_variable(nonnegative=True)
z=p.new_variable(nonnegative=True)
p.set_objective(x[0] + y[0]+ 3*z[0])
So, are all new variables in an MILP assumed to be arrays? Is there are way to work with variables as in my first example without using subscripts? (This is mainly for teaching purposes.)
calc314Tue, 24 Feb 2015 14:35:43 +0100https://ask.sagemath.org/question/25913/How to stop a MILP before it reaches the optimal solution (using different backends)?https://ask.sagemath.org/question/25909/how-to-stop-a-milp-before-it-reaches-the-optimal-solution-using-different-backends/Sometimes you don't need an optimal solution. A feasible solution is a must, but a decent value of the objective function will do. At least that's better than waiting forever...
Some backends (most?, all?) for the MixedIntegerLinearProgram support different stop criteria. But it took me quite some time to find them. How to tell MixedIntegerLinearProgram not to continue until the optimal solution is found?
PD: I found the answer (at least part of it) before I submitted this question, but I think it's good to ask the question for reference:pangTue, 24 Feb 2015 10:19:05 +0100https://ask.sagemath.org/question/25909/