}
public void processWorkingSolutionDuringMove(
int uninitializedVariableCount, Score score, AbstractStepScope stepScope) {
AbstractPhaseScope phaseScope = stepScope.getPhaseScope();
DefaultSolverScope solverScope = phaseScope.getSolverScope();
int bestUninitializedVariableCount = solverScope.getBestUninitializedVariableCount();
Score bestScore = solverScope.getBestScore();
boolean bestScoreImproved;
if (uninitializedVariableCount == bestUninitializedVariableCount) {
bestScoreImproved = score.compareTo(bestScore) > 0;
} else {
bestScoreImproved = uninitializedVariableCount < bestUninitializedVariableCount;
}
// The method processWorkingSolutionDuringMove() is called 0..* times
// stepScope.getBestScoreImproved() is initialized on false before the first call here
if (bestScoreImproved) {
stepScope.setBestScoreImproved(bestScoreImproved);
}
if (bestScoreImproved) {
phaseScope.setBestSolutionStepIndex(stepScope.getStepIndex());
Solution newBestSolution = solverScope.getScoreDirector().cloneWorkingSolution();
updateBestSolution(solverScope, newBestSolution, uninitializedVariableCount);
} else if (assertBestScoreIsUnmodified) {
solverScope.assertScoreFromScratch(solverScope.getBestSolution());
}
}