#16504: Fix the confusion in MILP.new_variable()
--------------------------------------+------------------------
Reporter: jdemeyer | Owner:
Type: defect | Status: new
Priority: major | Milestone: sage-6.3
Component: linear programming | Resolution:
Keywords: | Merged in:
Authors: | Reviewers:
Report Upstream: N/A | Work issues:
Branch: | Commit:
Dependencies: | Stopgaps:
--------------------------------------+------------------------
Comment (by jdemeyer):
Essentially, the code should look like
{{{
#!python
def new_variable(self, real=False, binary=False, integer=False,
nonnegative=None):
if sum([real, binary, integer]) >= 2:
raise ValueError("exactly one of the available types has to be
True")
if nonnegative is None:
deprecation(15521, "The default value of 'nonnegative' will
change, to "+
"False instead of True. " +
"You should add the explicit 'nonnegative=True'.")
nonnegative = True
if binary:
vtype = self.__BINARY
elif integer:
vtype = self.__INTEGER
else: # real is the default if no type is explicitly given
vtype = self.__REAL
# Set minimum value to 0 or -oo depending on "nonnegative"
...
}}}
--
Ticket URL: <http://trac.sagemath.org/ticket/16504#comment:5>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.