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

LocalSearch after CustomPhase doesn't work with variable listeners because commitMove() isn't called in CustomPhaseCommand

XMLWordPrintable

    • NEW
    • NEW

      Here is the deal:
      in bxms test-suite we have few tests that uses custom phase first to initialize solution and then run LS. This specific one uses (very) old VRP even without shadow variables, so it's basically a primitive chaining problem.

      Custom phase creates a well designed solution. Problem is, that if I pass this solution into another phase, I've got:

      The planning value (1 vehicle-0) has multiple inverse entities ([2(after 1), 2(after 1)]) pointing to it from sourceVariable (previousAppearance).
      	at org.optaplanner.core.impl.domain.variable.inverserelation.ExternalizedSingletonInverseVariableSupply.getInverseSingleton(ExternalizedSingletonInverseVariableSupply.java:129)
      	at org.optaplanner.core.impl.heuristic.selector.move.generic.chained.ChainedChangeMove.doMoveOnGenuineVariables(ChainedChangeMove.java:56)
      	at org.optaplanner.core.impl.heuristic.move.AbstractMove.doMove(AbstractMove.java:34)
      

      when I take solution after custom phase and create new solver instance with LS only and run it there, everything is fine, so there is some inconsistency.

      there are two scenarios:
      1. custom phase is broken due to your refactoring which is fine because custom phase is not public api, but I don't see any comment about it in upgrade-recipe.
      2. there must be some kind of bug.

      What custom phase does:

      for (int i = 0; i < customers.size(); i++) {
                  VrpCustomer customer = customers.get(i);
                  VrpAppearance tmpAppearance = (i == 0) ? vehicles.get(0) : customers.get(i - 1);
      
                  scoreDirector.beforeVariableChanged(customer, "previousAppearance");
                  customer.setPreviousAppearance(tmpAppearance);
                  scoreDirector.afterVariableChanged(customer, "previousAppearance");
              }
      

            gdesmet@redhat.com Geoffrey De Smet (Inactive)
            jvahala Jiří Vahala (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: