Uploaded image for project: 'OptaPlanner'
  1. OptaPlanner
  2. PLANNER-909

Implement equals/hashCode in ConstraintMatch, ConstraintMatchTotal and Indictment (for usage in Map, Set, etc)

    XMLWordPrintable

Details

    • Feature Request
    • Resolution: Done
    • Optional
    • 7.5.0.Final
    • 7.3.0.Final
    • optaplanner-core
    • None
    • NEW
    • NEW

    Description

      While implementing a ConstraintMatchAwareIncrementalScoreCalculator I noticed, that the removeConstraintMatch method in ConstraintMatchTotal is not working correctly, as there is no hashCode implementation for ConstraintMatch.
      I am trying to use the ConstraintMatchTotal.getScore method to return the score in the calculateScore method, but it fails, since the beforeVariableChanged method cannot remove the respective ConstraintMatch.
      Also, as it is today, the compareTo method of ConstraintMatch is not consistent with the equals method, thus it breaks the compareTo contract.
      (I have modified OptaPlanner to include the equals and hashCode methods - consistent with compareTo - and it is working fine.)

      Attachments

        Issue Links

          Activity

            People

              gdesmet@redhat.com Geoffrey De Smet (Inactive)
              trks1970_jira Tibor Kiss (Inactive)
              Votes:
              1 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: