#12091: bug in add_constraint to MixedIntegerLinearProgram
--------------------------------------+-------------------------------------
Reporter: dimpase | Owner: ncohen
Type: defect | Status: new
Priority: critical | Milestone: sage-5.0
Component: linear programming | Resolution:
Keywords: | Work issues:
Report Upstream: N/A | Reviewers:
Authors: | Merged in:
Dependencies: | Stopgaps:
--------------------------------------+-------------------------------------
Comment (by ppurka):
The problem with the `a <= b <= c` is actually a problem with python.
According to [http://www.python.org/dev/peps/pep-0207/ this], chained
inequalities behave as follows:
{{{
# Trying to do x < y < z
temp1 = x < y
if temp1:
return y < z
else:
return temp1
}}}
According to one of my colleagues this behavior is different in python-3
(and that python-3 has the behavior we want), but I haven't checked (I
will need to install python-3).
One workaround is to explicitly group the inequalities. So, instead of
inputting `a <= b <= c`, if we do `(a <= b) <= c` then it works. Since we
are not moving to python-3 any time soon, the documentation should be
updated to either discourage chained inequalities or to use explicitly
grouped chained inequalities.
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/12091#comment:22>
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 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-trac?hl=en.