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

Planning entity's hashCode() (used by tabu accepter) vs solutionHashCode() (used by solution equality)

    XMLWordPrintable

Details

    Description

      Discussion started in JBRULES-3439.

      Summary:
      1) Planning entity solutionHashCode() and hashCode() are both needed. What's the difference and why not one method?
      Reason: solutionHashCode() must include the variables, and hashCode() must not include the variables
      2) solutionHashCode() will be obsolete once Solution.equals/hashCode() gets implemented automatically by planner by just looking at the entities and variables.
      3) What if the users does want to include the variables in it's equals method. Can the tabu accepter work on some sort of entity.getId() value?
      Note: It can not work with IdentityHashMap because there will be different instances (especially in multi-threading or multi-vm).

      Attachments

        Issue Links

          Activity

            People

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

              Dates

                Created:
                Updated: