Class BestSolutionRecaller<Solution_>
- java.lang.Object
-
- org.optaplanner.core.impl.solver.event.SolverLifecycleListenerAdapter<Solution_>
-
- org.optaplanner.core.impl.phase.event.PhaseLifecycleListenerAdapter<Solution_>
-
- org.optaplanner.core.impl.solver.recaller.BestSolutionRecaller<Solution_>
-
- Type Parameters:
Solution_
- the solution type, the class with thePlanningSolution
annotation
- All Implemented Interfaces:
EventListener
,PhaseLifecycleListener<Solution_>
,SolverLifecycleListener<Solution_>
public class BestSolutionRecaller<Solution_> extends PhaseLifecycleListenerAdapter<Solution_>
Remembers thebest solution
that aSolver
encounters.
-
-
Field Summary
Fields Modifier and Type Field Description protected boolean
assertBestScoreIsUnmodified
protected boolean
assertInitialScoreFromScratch
protected boolean
assertShadowVariablesAreNotStale
protected org.slf4j.Logger
logger
protected SolverEventSupport<Solution_>
solverEventSupport
-
Constructor Summary
Constructors Constructor Description BestSolutionRecaller()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
processWorkingSolutionDuringMove(Score score, AbstractStepScope<Solution_> stepScope)
void
processWorkingSolutionDuringStep(AbstractStepScope<Solution_> stepScope)
void
setAssertBestScoreIsUnmodified(boolean assertBestScoreIsUnmodified)
void
setAssertInitialScoreFromScratch(boolean assertInitialScoreFromScratch)
void
setAssertShadowVariablesAreNotStale(boolean assertShadowVariablesAreNotStale)
void
setSolverEventSupport(SolverEventSupport<Solution_> solverEventSupport)
void
solvingStarted(SolverScope<Solution_> solverScope)
void
updateBestSolution(SolverScope<Solution_> solverScope)
protected void
updateBestSolution(SolverScope<Solution_> solverScope, Score bestScore, Solution_ bestSolution)
-
Methods inherited from class org.optaplanner.core.impl.phase.event.PhaseLifecycleListenerAdapter
phaseEnded, phaseStarted, stepEnded, stepStarted
-
Methods inherited from class org.optaplanner.core.impl.solver.event.SolverLifecycleListenerAdapter
solvingEnded
-
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
solvingEnded
-
-
-
-
Field Detail
-
logger
protected final transient org.slf4j.Logger logger
-
assertInitialScoreFromScratch
protected boolean assertInitialScoreFromScratch
-
assertShadowVariablesAreNotStale
protected boolean assertShadowVariablesAreNotStale
-
assertBestScoreIsUnmodified
protected boolean assertBestScoreIsUnmodified
-
solverEventSupport
protected SolverEventSupport<Solution_> solverEventSupport
-
-
Method Detail
-
setAssertInitialScoreFromScratch
public void setAssertInitialScoreFromScratch(boolean assertInitialScoreFromScratch)
-
setAssertShadowVariablesAreNotStale
public void setAssertShadowVariablesAreNotStale(boolean assertShadowVariablesAreNotStale)
-
setAssertBestScoreIsUnmodified
public void setAssertBestScoreIsUnmodified(boolean assertBestScoreIsUnmodified)
-
setSolverEventSupport
public void setSolverEventSupport(SolverEventSupport<Solution_> solverEventSupport)
-
solvingStarted
public void solvingStarted(SolverScope<Solution_> solverScope)
- Specified by:
solvingStarted
in interfaceSolverLifecycleListener<Solution_>
- Overrides:
solvingStarted
in classSolverLifecycleListenerAdapter<Solution_>
-
processWorkingSolutionDuringStep
public void processWorkingSolutionDuringStep(AbstractStepScope<Solution_> stepScope)
-
processWorkingSolutionDuringMove
public void processWorkingSolutionDuringMove(Score score, AbstractStepScope<Solution_> stepScope)
-
updateBestSolution
public void updateBestSolution(SolverScope<Solution_> solverScope)
-
updateBestSolution
protected void updateBestSolution(SolverScope<Solution_> solverScope, Score bestScore, Solution_ bestSolution)
-
-