public void decideNextStep(GreedyFitStepScope stepScope) {
Object planningEntity = stepScope.getPlanningEntity();
int moveIndex = 0;
Iterator<Move> moveIterator = planningVariableWalker.moveIterator(planningEntity);
while (moveIterator.hasNext()) {
Move move = moveIterator.next();
GreedyMoveScope moveScope = new GreedyMoveScope(stepScope);
moveScope.setMoveIndex(moveIndex);
moveScope.setMove(move);
// Filter out not doable moves
if (move.isMoveDoable(stepScope.getScoreDirector())) {
doMove(moveScope);
if (forager.isQuitEarly()) {
break;
}
} else {
logger.trace(" Ignoring not doable move ({}).", move);
}
moveIndex++;
// TODO break when terminator returns false. See DefaultDecider
}
GreedyMoveScope pickedMoveScope = forager.pickMove(stepScope);
if (pickedMoveScope != null) {
Move step = pickedMoveScope.getMove();
stepScope.setStep(step);
if (logger.isDebugEnabled()) {
stepScope.setStepString(step.toString());
}
stepScope.setUndoStep(pickedMoveScope.getUndoMove());
stepScope.setScore(pickedMoveScope.getScore());
}
}