@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);
   }
 }
 public void updateBestSolution(
     DefaultSolverScope solverScope, Solution solution, int uninitializedVariableCount) {
   if (uninitializedVariableCount == 0) {
     if (!solverScope.isBestSolutionInitialized()) {
       solverScope.setStartingInitializedScore(solution.getScore());
     }
   }
   solverScope.setBestUninitializedVariableCount(uninitializedVariableCount);
   solverScope.setBestSolution(solution);
   solverScope.setBestScore(solution.getScore());
   solverScope.setBestSolutionTimeMillis(System.currentTimeMillis());
   solverEventSupport.fireBestSolutionChanged(solution);
 }