hello
the new version of the drools-solver supports multiple move factories.
i happily split my move factory to take advantage of the
relativeSelection parameter.
now the problem is that not all move factories can produce moves for
every possible
current solution. and the
org.drools.solver.core.localsearch.decider.selector.MoveFactorySelector
crashes, when a move factory does not return a single move.
public final List<Move> selectMoveList(StepScope stepScope) {
List<Move> moveList =
moveFactory.createMoveList(stepScope.getWorkingSolution());
if (shuffle) {
Collections.shuffle(moveList, stepScope.getWorkingRandom());
}
if (relativeSelection != null) {
int selectionSize = (int) Math.ceil(relativeSelection *
moveList.size());
if (selectionSize == 0) {
selectionSize = 1;
}
moveList = moveList.subList(0, selectionSize); // <--
CRASH, if moveList is empty
}
return moveList;
}
currently i solve it by always returning at least a "null-move".
but a better solution would be to change the
MoveFactorySelector.selectMoveList(), so that it tests for an
empty list.
best, tim