Changes between Initial Version and Version 5 of Ticket #15583
 Timestamp:
 04/03/16 20:15:32 (5 years ago)
Legend:
 Unmodified
 Added
 Removed
 Modified

Ticket #15583

Property
Type
changed from
PLEASE CHANGE
toenhancement

Property
Milestone
changed from
sage6.1
tosage6.4

Property
Type
changed from

Ticket #15583 – Description
initial v5 1 Hello, 1 I'd like to have `sage.numerical.linear_functions.LinearConstraint` to be a hashable type. 2 Currently it is not: 3 {{{ 4 sage: p = MixedIntegerLinearProgram() 5 sage: b = p.new_variable() 6 sage: b[0] <= b[1] <= 2 7 x_0 <= x_1 <= 2 8 sage: hash(b[0] <= b[1] <= 2) 9 ... 10 TypeError: unhashable type: 'sage.numerical.linear_functions.LinearConstraint' 11 }}} 2 12 3 I'd like to have sage.numerical.linear_functions.LinearConstraint to be a hashable typefor the following reasons:13 This is for the following reasons: 4 14 5 6 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. 15 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. 7 16 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. 8 17