Package org.optaplanner.core.impl.phase
Class AbstractPhase<Solution_>
java.lang.Object
org.optaplanner.core.impl.phase.AbstractPhase<Solution_>
- Type Parameters:
Solution_
- the solution type, the class with thePlanningSolution
annotation
- All Implemented Interfaces:
EventListener
,PhaseLifecycleListener<Solution_>
,Phase<Solution_>
,SolverLifecycleListener<Solution_>
- Direct Known Subclasses:
DefaultConstructionHeuristicPhase
,DefaultCustomPhase
,DefaultExhaustiveSearchPhase
,DefaultLocalSearchPhase
,DefaultPartitionedSearchPhase
,NoChangePhase
- See Also:
-
Nested Class Summary
-
Field Summary
Modifier and TypeFieldDescriptionprotected final boolean
protected final boolean
protected final boolean
protected final org.slf4j.Logger
protected final String
protected final int
protected PhaseLifecycleSupport<Solution_>
protected final Termination<Solution_>
protected AbstractSolver<Solution_>
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addPhaseLifecycleListener
(PhaseLifecycleListener<Solution_> phaseLifecycleListener) Add aPhaseLifecycleListener
that is only notified of thephase
and thestep
starting/ending events from this phase (and thesolving
events too of course).protected void
assertWorkingSolutionInitialized
(AbstractPhaseScope<Solution_> phaseScope) protected <Score_ extends Score<Score_>>
voidcalculateWorkingStepScore
(AbstractStepScope<Solution_> stepScope, Object completedAction) int
abstract String
boolean
boolean
boolean
void
phaseEnded
(AbstractPhaseScope<Solution_> phaseScope) void
phaseStarted
(AbstractPhaseScope<Solution_> phaseScope) protected <Score_ extends Score<Score_>>
voidpredictWorkingStepScore
(AbstractStepScope<Solution_> stepScope, Object completedAction) void
removePhaseLifecycleListener
(PhaseLifecycleListener<Solution_> phaseLifecycleListener) void
setSolver
(AbstractSolver<Solution_> solver) void
solvingEnded
(SolverScope<Solution_> solverScope) void
solvingStarted
(SolverScope<Solution_> solverScope) void
stepEnded
(AbstractStepScope<Solution_> stepScope) void
stepStarted
(AbstractStepScope<Solution_> stepScope) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.optaplanner.core.impl.solver.event.SolverLifecycleListener
solvingError
-
Field Details
-
logger
protected final transient org.slf4j.Logger logger -
phaseIndex
protected final int phaseIndex -
logIndentation
-
phaseTermination
-
assertStepScoreFromScratch
protected final boolean assertStepScoreFromScratch -
assertExpectedStepScore
protected final boolean assertExpectedStepScore -
assertShadowVariablesAreNotStaleAfterStep
protected final boolean assertShadowVariablesAreNotStaleAfterStep -
phaseLifecycleSupport
-
solver
-
-
Constructor Details
-
AbstractPhase
-
-
Method Details
-
getPhaseIndex
public int getPhaseIndex() -
getPhaseTermination
-
getSolver
-
setSolver
-
isAssertStepScoreFromScratch
public boolean isAssertStepScoreFromScratch() -
isAssertExpectedStepScore
public boolean isAssertExpectedStepScore() -
isAssertShadowVariablesAreNotStaleAfterStep
public boolean isAssertShadowVariablesAreNotStaleAfterStep() -
getPhaseTypeString
-
solvingStarted
- Specified by:
solvingStarted
in interfaceSolverLifecycleListener<Solution_>
-
solvingEnded
- Specified by:
solvingEnded
in interfaceSolverLifecycleListener<Solution_>
-
phaseStarted
- Specified by:
phaseStarted
in interfacePhaseLifecycleListener<Solution_>
-
phaseEnded
- Specified by:
phaseEnded
in interfacePhaseLifecycleListener<Solution_>
-
stepStarted
- Specified by:
stepStarted
in interfacePhaseLifecycleListener<Solution_>
-
calculateWorkingStepScore
protected <Score_ extends Score<Score_>> void calculateWorkingStepScore(AbstractStepScope<Solution_> stepScope, Object completedAction) -
predictWorkingStepScore
protected <Score_ extends Score<Score_>> void predictWorkingStepScore(AbstractStepScope<Solution_> stepScope, Object completedAction) -
stepEnded
- Specified by:
stepEnded
in interfacePhaseLifecycleListener<Solution_>
-
addPhaseLifecycleListener
Description copied from interface:Phase
Add aPhaseLifecycleListener
that is only notified of thephase
and thestep
starting/ending events from this phase (and thesolving
events too of course).To get notified for all phases, use
AbstractSolver.addPhaseLifecycleListener(PhaseLifecycleListener)
instead.- Specified by:
addPhaseLifecycleListener
in interfacePhase<Solution_>
- Parameters:
phaseLifecycleListener
- never null
-
removePhaseLifecycleListener
- Specified by:
removePhaseLifecycleListener
in interfacePhase<Solution_>
- Parameters:
phaseLifecycleListener
- never null- See Also:
-
assertWorkingSolutionInitialized
-