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_>
ALocalSearchForager
which forages accepted moves and ignores unaccepted moves.- See Also:
LocalSearchForager
,Acceptor
-
-
Field Summary
Fields Modifier and Type Field Description protected int
acceptedCountLimit
protected long
acceptedMoveCount
protected boolean
breakTieRandomly
protected LocalSearchMoveScope<Solution_>
earlyPickedMoveScope
protected FinalistPodium<Solution_>
finalistPodium
protected LocalSearchPickEarlyType
pickEarlyType
protected long
selectedMoveCount
-
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 void
addMove(LocalSearchMoveScope<Solution_> moveScope)
protected void
checkPickEarly(LocalSearchMoveScope<Solution_> moveScope)
boolean
isQuitEarly()
void
phaseEnded(LocalSearchPhaseScope<Solution_> phaseScope)
void
phaseStarted(LocalSearchPhaseScope<Solution_> phaseScope)
LocalSearchMoveScope<Solution_>
pickMove(LocalSearchStepScope<Solution_> stepScope)
void
solvingEnded(SolverScope<Solution_> solverScope)
void
solvingStarted(SolverScope<Solution_> solverScope)
void
stepEnded(LocalSearchStepScope<Solution_> stepScope)
void
stepStarted(LocalSearchStepScope<Solution_> stepScope)
boolean
supportsNeverEndingMoveSelector()
String
toString()
-
-
-
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:
solvingStarted
in interfaceSolverLifecycleListener<Solution_>
- Overrides:
solvingStarted
in classSolverLifecycleListenerAdapter<Solution_>
-
phaseStarted
public void phaseStarted(LocalSearchPhaseScope<Solution_> phaseScope)
- Specified by:
phaseStarted
in interfaceLocalSearchPhaseLifecycleListener<Solution_>
- Overrides:
phaseStarted
in classLocalSearchPhaseLifecycleListenerAdapter<Solution_>
-
stepStarted
public void stepStarted(LocalSearchStepScope<Solution_> stepScope)
- Specified by:
stepStarted
in interfaceLocalSearchPhaseLifecycleListener<Solution_>
- Overrides:
stepStarted
in 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:
stepEnded
in interfaceLocalSearchPhaseLifecycleListener<Solution_>
- Overrides:
stepEnded
in classLocalSearchPhaseLifecycleListenerAdapter<Solution_>
-
phaseEnded
public void phaseEnded(LocalSearchPhaseScope<Solution_> phaseScope)
- Specified by:
phaseEnded
in interfaceLocalSearchPhaseLifecycleListener<Solution_>
- Overrides:
phaseEnded
in classLocalSearchPhaseLifecycleListenerAdapter<Solution_>
-
solvingEnded
public void solvingEnded(SolverScope<Solution_> solverScope)
- Specified by:
solvingEnded
in interfaceSolverLifecycleListener<Solution_>
- Overrides:
solvingEnded
in classSolverLifecycleListenerAdapter<Solution_>
-
-