#20304: More error checking in MixedIntegerLinearProgram
-------------------------------------+-------------------------------------
Reporter: mkoeppe | Owner:
Type: defect | Status: needs_work
Priority: major | Milestone: sage-7.2
Component: numerical | Resolution:
Keywords: lp | Merged in:
Authors: Matthias Koeppe | Reviewers: Vincent Delecroix
Report Upstream: N/A | Work issues:
Branch: | Commit:
u/mkoeppe/more_error_checking_in_mixedintegerlinearprogram|
dc3895bb02227dff5b2f7130e43f877754c4861b
Dependencies: | Stopgaps:
-------------------------------------+-------------------------------------
Changes (by vdelecroix):
* status: needs_review => needs_work
* reviewer: => Vincent Delecroix
Comment:
Please use new style error {{{ValueError(msg)}}} instead of {{{ValueError,
msg}}} (Python 3 compatibility).
Would be better to use repr rather than str. The output of
`"{!r}".format(l)` is nicer than `str(l)`. As you can see
{{{
sage: l = 1
sage: str(l)
'1'
sage: "{!r}".format(l)
'1'
sage: l = '1'
sage: str(l)
'1'
sage: "{!r}".format(l)
"'1'"
}}}
The following are not caught correctly
{{{
sage: M1 = MixedIntegerLinearProgram()
sage: M2 = MixedIntegerLinearProgram()
sage: x = M1.new_variable()
sage: y = M1.new_variable()
sage: z = M2.new_variable()
sage: M2.add_constraint(z[0] <= 5)
sage: M2.solve()
0.0
sage: M2.get_values(x) # should be a ValueError
Traceback (most recent call last):
...
KeyError: x_0
sage: M2.get_values(y) # should be a ValueError
{}
}}}
--
Ticket URL: <http://trac.sagemath.org/ticket/20304#comment:4>
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 https://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.