}
public void decideNextStep(GreedyFitStepScope greedyFitStepScope) {
GreedyFitSolverPhaseScope greedyFitSolverPhaseScope = greedyFitStepScope.getGreedyFitSolverPhaseScope();
planningVariableWalker.initWalk(greedyFitStepScope.getPlanningEntity());
Score lastStepScore = greedyFitSolverPhaseScope.getLastCompletedStepScope().getScore();
Score maxScore = greedyFitSolverPhaseScope.getScoreDefinition().getPerfectMinimumScore();
while (planningVariableWalker.hasWalk()) {
planningVariableWalker.walk();
Score score = greedyFitSolverPhaseScope.calculateScoreFromWorkingMemory();
if (assertMoveScoreIsUncorrupted) {
greedyFitSolverPhaseScope.assertWorkingScore(score);
}
if (score.compareTo(maxScore) > 0) {
greedyFitStepScope.setVariableToValueMap(planningVariableWalker.getVariableToValueMap());
maxScore = score;
}
// TODO refactor to usage of Move and MoveScope
logger.trace(" Move score ({}) for planning entity ({}) for move (TODO).",
new Object[]{score, greedyFitStepScope.getPlanningEntity()});
if (constructionHeuristicPickEarlyType
== ConstructionHeuristicPickEarlyType.FIRST_LAST_STEP_SCORE_EQUAL_OR_IMPROVING
&& lastStepScore != null
&& score.compareTo(lastStepScore) >= 0) {
break;
}
}
greedyFitStepScope.setScore(maxScore);
}