LocalSearchStepScope stepScope = createNextStepScope(solverPhaseScope, null);
while (!termination.isPhaseTerminated(solverPhaseScope)) {
stepScope.setTimeGradient(termination.calculatePhaseTimeGradient(solverPhaseScope));
beforeDeciding(stepScope);
decider.decideNextStep(stepScope);
Move nextStep = stepScope.getStep();
if (nextStep == null) {
logger.warn(" Cancelled step index ({}), time spend ({}): there is no doable move. Terminating phase early.",
stepScope.getStepIndex(),
solverPhaseScope.calculateSolverTimeMillisSpend());
break;
}
nextStep.doMove(stepScope.getScoreDirector());
// there is no need to recalculate the score, but we still need to set it
solverPhaseScope.getWorkingSolution().setScore(stepScope.getScore());
if (assertStepScoreIsUncorrupted) {
solverPhaseScope.assertWorkingScore(stepScope.getScore());
}