Class AcceptedLocalSearchForager<Solution_>
- java.lang.Object
-
- org.optaplanner.core.impl.solver.event.SolverLifecycleListenerAdapter<Solution_>
-
- org.optaplanner.core.impl.localsearch.event.LocalSearchPhaseLifecycleListenerAdapter<Solution_>
-
- org.optaplanner.core.impl.localsearch.decider.forager.AbstractLocalSearchForager<Solution_>
-
- org.optaplanner.core.impl.localsearch.decider.forager.AcceptedLocalSearchForager<Solution_>
-
- All Implemented Interfaces:
EventListener,LocalSearchForager<Solution_>,LocalSearchPhaseLifecycleListener<Solution_>,SolverLifecycleListener<Solution_>
public class AcceptedLocalSearchForager<Solution_> extends AbstractLocalSearchForager<Solution_>
ALocalSearchForagerwhich forages accepted moves and ignores unaccepted moves.- See Also:
LocalSearchForager,Acceptor
-
-
Field Summary
Fields Modifier and Type Field Description protected intacceptedCountLimitprotected longacceptedMoveCountprotected booleanbreakTieRandomlyprotected LocalSearchMoveScope<Solution_>earlyPickedMoveScopeprotected FinalistPodium<Solution_>finalistPodiumprotected LocalSearchPickEarlyTypepickEarlyTypeprotected longselectedMoveCount-
Fields inherited from class org.optaplanner.core.impl.localsearch.decider.forager.AbstractLocalSearchForager
logger
-
-
Constructor Summary
Constructors Constructor Description AcceptedLocalSearchForager(FinalistPodium<Solution_> finalistPodium, LocalSearchPickEarlyType pickEarlyType, int acceptedCountLimit, boolean breakTieRandomly)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddMove(LocalSearchMoveScope<Solution_> moveScope)protected voidcheckPickEarly(LocalSearchMoveScope<Solution_> moveScope)booleanisQuitEarly()voidphaseEnded(LocalSearchPhaseScope<Solution_> phaseScope)voidphaseStarted(LocalSearchPhaseScope<Solution_> phaseScope)LocalSearchMoveScope<Solution_>pickMove(LocalSearchStepScope<Solution_> stepScope)voidsolvingEnded(SolverScope<Solution_> solverScope)voidsolvingStarted(SolverScope<Solution_> solverScope)voidstepEnded(LocalSearchStepScope<Solution_> stepScope)voidstepStarted(LocalSearchStepScope<Solution_> stepScope)booleansupportsNeverEndingMoveSelector()StringtoString()
-
-
-
Field Detail
-
finalistPodium
protected final FinalistPodium<Solution_> finalistPodium
-
pickEarlyType
protected final LocalSearchPickEarlyType pickEarlyType
-
acceptedCountLimit
protected final int acceptedCountLimit
-
breakTieRandomly
protected final boolean breakTieRandomly
-
selectedMoveCount
protected long selectedMoveCount
-
acceptedMoveCount
protected long acceptedMoveCount
-
earlyPickedMoveScope
protected LocalSearchMoveScope<Solution_> earlyPickedMoveScope
-
-
Constructor Detail
-
AcceptedLocalSearchForager
public AcceptedLocalSearchForager(FinalistPodium<Solution_> finalistPodium, LocalSearchPickEarlyType pickEarlyType, int acceptedCountLimit, boolean breakTieRandomly)
-
-
Method Detail
-
solvingStarted
public void solvingStarted(SolverScope<Solution_> solverScope)
- Specified by:
solvingStartedin interfaceSolverLifecycleListener<Solution_>- Overrides:
solvingStartedin classSolverLifecycleListenerAdapter<Solution_>
-
phaseStarted
public void phaseStarted(LocalSearchPhaseScope<Solution_> phaseScope)
- Specified by:
phaseStartedin interfaceLocalSearchPhaseLifecycleListener<Solution_>- Overrides:
phaseStartedin classLocalSearchPhaseLifecycleListenerAdapter<Solution_>
-
stepStarted
public void stepStarted(LocalSearchStepScope<Solution_> stepScope)
- Specified by:
stepStartedin interfaceLocalSearchPhaseLifecycleListener<Solution_>- Overrides:
stepStartedin classLocalSearchPhaseLifecycleListenerAdapter<Solution_>
-
supportsNeverEndingMoveSelector
public boolean supportsNeverEndingMoveSelector()
- Returns:
- true if it can be combined with a
Selector.isNeverEnding()that returns true.
-
addMove
public void addMove(LocalSearchMoveScope<Solution_> moveScope)
- Parameters:
moveScope- never null
-
checkPickEarly
protected void checkPickEarly(LocalSearchMoveScope<Solution_> moveScope)
-
isQuitEarly
public boolean isQuitEarly()
- Returns:
- true if no further moves should be selected (and evaluated) for this step.
-
pickMove
public LocalSearchMoveScope<Solution_> pickMove(LocalSearchStepScope<Solution_> stepScope)
- Parameters:
stepScope- never null- Returns:
- sometimes null, for example if no move is selected
-
stepEnded
public void stepEnded(LocalSearchStepScope<Solution_> stepScope)
- Specified by:
stepEndedin interfaceLocalSearchPhaseLifecycleListener<Solution_>- Overrides:
stepEndedin classLocalSearchPhaseLifecycleListenerAdapter<Solution_>
-
phaseEnded
public void phaseEnded(LocalSearchPhaseScope<Solution_> phaseScope)
- Specified by:
phaseEndedin interfaceLocalSearchPhaseLifecycleListener<Solution_>- Overrides:
phaseEndedin classLocalSearchPhaseLifecycleListenerAdapter<Solution_>
-
solvingEnded
public void solvingEnded(SolverScope<Solution_> solverScope)
- Specified by:
solvingEndedin interfaceSolverLifecycleListener<Solution_>- Overrides:
solvingEndedin classSolverLifecycleListenerAdapter<Solution_>
-
-