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 thePlanningSolutionannotation
- All Implemented Interfaces:
 EventListener,PhaseLifecycleListener<Solution_>,Phase<Solution_>,SolverLifecycleListener<Solution_>
- Direct Known Subclasses:
 DefaultConstructionHeuristicPhase,DefaultCustomPhase,DefaultExhaustiveSearchPhase,DefaultLocalSearchPhase,DefaultPartitionedSearchPhase,NoChangePhase
public abstract class AbstractPhase<Solution_> extends Object implements Phase<Solution_>
- See Also:
 DefaultLocalSearchPhase
 
- 
- 
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static classAbstractPhase.Builder<Solution_> 
- 
Field Summary
Fields Modifier and Type Field Description protected booleanassertExpectedStepScoreprotected booleanassertShadowVariablesAreNotStaleAfterStepprotected booleanassertStepScoreFromScratchprotected org.slf4j.Loggerloggerprotected StringlogIndentationprotected intphaseIndexprotected PhaseLifecycleSupport<Solution_>phaseLifecycleSupportprotected Termination<Solution_>phaseTerminationprotected AbstractSolver<Solution_>solver 
- 
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractPhase(AbstractPhase.Builder<Solution_> builder) 
- 
Method Summary
- 
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 Detail
- 
logger
protected final transient org.slf4j.Logger logger
 
- 
phaseIndex
protected final int phaseIndex
 
- 
logIndentation
protected final String logIndentation
 
- 
phaseTermination
protected final Termination<Solution_> phaseTermination
 
- 
assertStepScoreFromScratch
protected final boolean assertStepScoreFromScratch
 
- 
assertExpectedStepScore
protected final boolean assertExpectedStepScore
 
- 
assertShadowVariablesAreNotStaleAfterStep
protected final boolean assertShadowVariablesAreNotStaleAfterStep
 
- 
phaseLifecycleSupport
protected PhaseLifecycleSupport<Solution_> phaseLifecycleSupport
 
- 
solver
protected AbstractSolver<Solution_> solver
 
 - 
 
- 
Constructor Detail
- 
AbstractPhase
protected AbstractPhase(AbstractPhase.Builder<Solution_> builder)
 
 - 
 
- 
Method Detail
- 
getPhaseIndex
public int getPhaseIndex()
 
- 
getPhaseTermination
public Termination<Solution_> getPhaseTermination()
 
- 
getSolver
public AbstractSolver<Solution_> getSolver()
 
- 
setSolver
public void setSolver(AbstractSolver<Solution_> solver)
 
- 
isAssertStepScoreFromScratch
public boolean isAssertStepScoreFromScratch()
 
- 
isAssertExpectedStepScore
public boolean isAssertExpectedStepScore()
 
- 
isAssertShadowVariablesAreNotStaleAfterStep
public boolean isAssertShadowVariablesAreNotStaleAfterStep()
 
- 
getPhaseTypeString
public abstract String getPhaseTypeString()
 
- 
solvingStarted
public void solvingStarted(SolverScope<Solution_> solverScope)
- Specified by:
 solvingStartedin interfaceSolverLifecycleListener<Solution_>
 
- 
solvingEnded
public void solvingEnded(SolverScope<Solution_> solverScope)
- Specified by:
 solvingEndedin interfaceSolverLifecycleListener<Solution_>
 
- 
phaseStarted
public void phaseStarted(AbstractPhaseScope<Solution_> phaseScope)
- Specified by:
 phaseStartedin interfacePhaseLifecycleListener<Solution_>
 
- 
phaseEnded
public void phaseEnded(AbstractPhaseScope<Solution_> phaseScope)
- Specified by:
 phaseEndedin interfacePhaseLifecycleListener<Solution_>
 
- 
stepStarted
public void stepStarted(AbstractStepScope<Solution_> stepScope)
- Specified by:
 stepStartedin 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
public void stepEnded(AbstractStepScope<Solution_> stepScope)
- Specified by:
 stepEndedin interfacePhaseLifecycleListener<Solution_>
 
- 
addPhaseLifecycleListener
public void addPhaseLifecycleListener(PhaseLifecycleListener<Solution_> phaseLifecycleListener)
Description copied from interface:PhaseAdd aPhaseLifecycleListenerthat is only notified of thephaseand thestepstarting/ending events from this phase (and thesolvingevents too of course).To get notified for all phases, use
AbstractSolver.addPhaseLifecycleListener(PhaseLifecycleListener)instead.- Specified by:
 addPhaseLifecycleListenerin interfacePhase<Solution_>- Parameters:
 phaseLifecycleListener- never null
 
- 
removePhaseLifecycleListener
public void removePhaseLifecycleListener(PhaseLifecycleListener<Solution_> phaseLifecycleListener)
- Specified by:
 removePhaseLifecycleListenerin interfacePhase<Solution_>- Parameters:
 phaseLifecycleListener- never null- See Also:
 Phase.addPhaseLifecycleListener(PhaseLifecycleListener)
 
- 
assertWorkingSolutionInitialized
protected void assertWorkingSolutionInitialized(AbstractPhaseScope<Solution_> phaseScope)
 
 - 
 
 -