private LocalSearchDecider buildDecider( HeuristicConfigPolicy configPolicy, Termination termination) { LocalSearchDecider decider = new LocalSearchDecider(); decider.setTermination(termination); MoveSelector moveSelector = buildMoveSelector(configPolicy); decider.setMoveSelector(moveSelector); AcceptorConfig acceptorConfig_ = acceptorConfig == null ? new AcceptorConfig() : acceptorConfig; decider.setAcceptor(acceptorConfig_.buildAcceptor(configPolicy)); ForagerConfig foragerConfig_ = foragerConfig == null ? new ForagerConfig() : foragerConfig; Forager forager = foragerConfig_.buildForager(configPolicy); decider.setForager(forager); if (moveSelector.isNeverEnding() && !forager.supportsNeverEndingMoveSelector()) { throw new IllegalStateException( "The moveSelector (" + moveSelector + ") has neverEnding (" + moveSelector.isNeverEnding() + "), but the forager (" + forager + ") does not support it." + " Configure the <forager> with <acceptedCountLimit>."); } EnvironmentMode environmentMode = configPolicy.getEnvironmentMode(); if (environmentMode.isNonIntrusiveFullAsserted()) { decider.setAssertMoveScoreFromScratch(true); } if (environmentMode.isIntrusiveFastAsserted()) { decider.setAssertExpectedUndoMoveScore(true); } return decider; }
public LocalSearchSolverPhase buildSolverPhase( int phaseIndex, HeuristicConfigPolicy solverConfigPolicy, Termination solverTermination) { HeuristicConfigPolicy phaseConfigPolicy = solverConfigPolicy.createPhaseConfigPolicy(); DefaultLocalSearchSolverPhase phase = new DefaultLocalSearchSolverPhase(); configureSolverPhase(phase, phaseIndex, phaseConfigPolicy, solverTermination); phase.setDecider(buildDecider(phaseConfigPolicy, phase.getTermination())); EnvironmentMode environmentMode = phaseConfigPolicy.getEnvironmentMode(); if (environmentMode.isNonIntrusiveFullAsserted()) { phase.setAssertStepScoreFromScratch(true); } if (environmentMode.isIntrusiveFastAsserted()) { phase.setAssertExpectedStepScore(true); } return phase; }