@Override
 public void solvingStarted(DefaultSolverScope solverScope) {
   // Starting bestSolution is already set by Solver.setPlanningProblem()
   int uninitializedVariableCount =
       solverScope.getScoreDirector().countWorkingSolutionUninitializedVariables();
   solverScope.setBestUninitializedVariableCount(uninitializedVariableCount);
   Score score = solverScope.calculateScore();
   solverScope.setBestScore(score);
   solverScope.setBestSolutionTimeMillis(System.currentTimeMillis());
   // The original bestSolution might be the final bestSolution and should have an accurate Score
   solverScope.getBestSolution().setScore(score);
   if (uninitializedVariableCount == 0) {
     solverScope.setStartingInitializedScore(score);
   } else {
     solverScope.setStartingInitializedScore(null);
   }
 }
Пример #2
0
 private Score doProblemFactChange(ProblemFactChange problemFactChange) {
   problemFactChange.doChange(solverScope.getScoreDirector());
   Score score = solverScope.calculateScore();
   logger.debug("    Done ProblemFactChange: new score ({}).", score);
   return score;
 }