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

Drools Planner score corruption during construction heuristics if there are rules that check if planning variable is null

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 6.0.0.Beta1
    • None
    • optaplanner-core
    • None

      A score corruption occurs in DEBUG environment Mode during construction heuristics if there are rules that add constraints if planning variable is null e.g.

      rule "no foo without bar"
          when
              $foo : Foo(bar == null)
          then
              insertLogical( new IntConstraintOccurrence("foo without bar", ConstraintType.NEGATIVE_HARD, 1, $foo) );
      end
      

      Debugging show following sympthoms: While org.drools.planner.core.constructionheuristic.greedyFit.decider.DefaultGreedyDecider executed doMove() a deviation between undoScore and lastCompletedStepScore occur (around the 108th line of code):

      ...
              if (assertUndoMoveIsUncorrupted) {
                  GreedyFitSolverPhaseScope greedyFitSolverPhaseScope = moveScope.getGreedyFitStepScope()
                          .getGreedyFitSolverPhaseScope();
                  Score undoScore = greedyFitSolverPhaseScope.calculateScore();
                  Score lastCompletedStepScore = greedyFitSolverPhaseScope.getLastCompletedStepScope().getScore();
                  if (!undoScore.equals(lastCompletedStepScore)) { //<-- HERE scores deviate!
      ...
      

      Again, this occurs only in DEBUG environment mode!

              gdesmet@redhat.com Geoffrey De Smet (Inactive)
              reinis_jira Reinis Vicups (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: