id summary reporter owner description type status priority milestone component resolution keywords cc merged author reviewer upstream work_issues branch commit dependencies stopgaps
15583 sage.numerical.linear_functions.LinearConstraint is not a hashable type cbowen "I'd like to have `sage.numerical.linear_functions.LinearConstraint` to be a hashable type.
Currently it is not:
{{{
sage: p = MixedIntegerLinearProgram()
sage: b = p.new_variable()
sage: b[0] <= b[1] <= 2
x_0 <= x_1 <= 2
sage: hash(b[0] <= b[1] <= 2)
...
TypeError: unhashable type: 'sage.numerical.linear_functions.LinearConstraint'
}}}
This is for the following reasons:
1) When adding constraints to an instance of a `MixedIntegerLinearProgram`, it is not necessary to add the same or equivalent constraint multiple times. A hash could be used to determine distinct linear constraints that are added into a MILP instance.
2) By having hashable linear constraints, one could allow for linear constraints to be added into sets (http://docs.python.org/2/library/sets.html) or used as keys in dictionaries.
Thanks,
Clinton" enhancement closed trivial sage-duplicate/invalid/wontfix linear programming wontfix linear constraint, mixed integer linear program ncohen vbraun dimpase Dima Pasechnik N/A