logger.trace(" Move treeId ({}), score ({}), expandable ({}), move ({}).",
moveNode.getTreeId(), moveNode.getScore(), moveNode.isExpandable(), moveNode.getMove());
}
private void processMove(ExhaustiveSearchStepScope stepScope, ExhaustiveSearchNode moveNode) {
ExhaustiveSearchPhaseScope phaseScope = stepScope.getPhaseScope();
int uninitializedVariableCount = moveNode.getUninitializedVariableCount();
boolean lastLayer = moveNode.isLastLayer();
if (!scoreBounderEnabled) {
if (lastLayer) {
Score score = phaseScope.calculateScore();
moveNode.setScore(score);
if (assertMoveScoreFromScratch) {
phaseScope.assertWorkingScoreFromScratch(score, moveNode.getMove());
}
bestSolutionRecaller.processWorkingSolutionDuringMove(uninitializedVariableCount, score, stepScope);
} else {
phaseScope.addExpandableNode(moveNode);
}
} else {
Score score = phaseScope.calculateScore();
moveNode.setScore(score);
if (assertMoveScoreFromScratch) {
phaseScope.assertWorkingScoreFromScratch(score, moveNode.getMove());
}
if (lastLayer) {
// There is no point in bounding a fully initialized score
phaseScope.registerPessimisticBound(score);
bestSolutionRecaller.processWorkingSolutionDuringMove(uninitializedVariableCount, score, stepScope);
} else {
InnerScoreDirector scoreDirector = phaseScope.getScoreDirector();
Score optimisticBound = scoreBounder.calculateOptimisticBound(scoreDirector, score);
moveNode.setOptimisticBound(optimisticBound);
if (optimisticBound.compareTo(phaseScope.getBestPessimisticBound()) > 0) {
// It's still worth investigating this node further (no need to prune it)
phaseScope.addExpandableNode(moveNode);
Score pessimisticBound = scoreBounder.calculatePessimisticBound(scoreDirector, score);
phaseScope.registerPessimisticBound(pessimisticBound);
}
}
}
}