abstractSolverScope.setBestScore(initialScore);
solverEventSupport.fireBestSolutionChanged(newBestSolution); // TODO if solution is initialized it should not fire an event
}
public void stepTaken(AbstractStepScope abstractStepScope) {
AbstractSolverScope abstractSolverScope = abstractStepScope.getAbstractSolverScope();
Score newScore = abstractStepScope.getScore();
Score bestScore = abstractSolverScope.getBestScore();
boolean bestScoreImproved = newScore.compareTo(bestScore) > 0;
abstractStepScope.setBestScoreImproved(bestScoreImproved);
if (bestScoreImproved) {
abstractSolverScope.setBestSolutionStepIndex(abstractStepScope.getStepIndex());
Solution newBestSolution = abstractStepScope.createOrGetClonedSolution();
abstractSolverScope.setBestSolution(newBestSolution);
abstractSolverScope.setBestScore(newBestSolution.getScore());
solverEventSupport.fireBestSolutionChanged(newBestSolution);
}
}