Changes between Initial Version and Version 5 of Ticket #15583


Ignore:
Timestamp:
04/03/16 20:15:32 (5 years ago)
Author:
mkoeppe
Comment:

Added example to the description.

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #15583

    • Property Type changed from PLEASE CHANGE to enhancement
    • Property Milestone changed from sage-6.1 to sage-6.4
  • Ticket #15583 – Description

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