Package org.optaplanner.core.impl.solver
Class AbstractSolver<Solution_>
java.lang.Object
org.optaplanner.core.impl.solver.AbstractSolver<Solution_>
- Type Parameters:
- Solution_- the solution type, the class with the- PlanningSolutionannotation
- All Implemented Interfaces:
- Solver<Solution_>
- Direct Known Subclasses:
- DefaultSolver,- PartitionSolver
Common code between 
DefaultSolver and child solvers (such as PartitionSolver).
 
 Do not create a new child Solver to implement a new heuristic or metaheuristic,
 just use a new Phase for that.
- See Also:
- 
Field SummaryFieldsModifier and TypeFieldDescriptionprotected final BestSolutionRecaller<Solution_>protected final org.slf4j.Loggerprotected final Termination<Solution_>
- 
Constructor SummaryConstructorsConstructorDescriptionAbstractSolver(BestSolutionRecaller<Solution_> bestSolutionRecaller, Termination<Solution_> solverTermination, List<Phase<Solution_>> phaseList) 
- 
Method SummaryModifier and TypeMethodDescriptionvoidaddEventListener(SolverEventListener<Solution_> eventListener) voidaddPhaseLifecycleListener(PhaseLifecycleListener<Solution_> phaseLifecycleListener) Add aPhaseLifecycleListenerthat is notified ofsolvingevents and also of thephaseand thestepstarting/ending events of all phases.voidphaseEnded(AbstractPhaseScope<Solution_> phaseScope) voidphaseStarted(AbstractPhaseScope<Solution_> phaseScope) voidremoveEventListener(SolverEventListener<Solution_> eventListener) voidremovePhaseLifecycleListener(PhaseLifecycleListener<Solution_> phaseLifecycleListener) protected voidrunPhases(SolverScope<Solution_> solverScope) voidsolvingEnded(SolverScope<Solution_> solverScope) voidsolvingError(SolverScope<Solution_> solverScope, Exception exception) voidsolvingStarted(SolverScope<Solution_> solverScope) voidstepEnded(AbstractStepScope<Solution_> stepScope) voidstepStarted(AbstractStepScope<Solution_> stepScope) Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.optaplanner.core.api.solver.SolveraddProblemChange, addProblemChanges, addProblemFactChange, addProblemFactChanges, isEveryProblemChangeProcessed, isEveryProblemFactChangeProcessed, isSolving, isTerminateEarly, solve, terminateEarly
- 
Field Details- 
loggerprotected final transient org.slf4j.Logger logger
- 
bestSolutionRecaller
- 
solverTermination
- 
phaseList
 
- 
- 
Constructor Details- 
AbstractSolverpublic AbstractSolver(BestSolutionRecaller<Solution_> bestSolutionRecaller, Termination<Solution_> solverTermination, List<Phase<Solution_>> phaseList) 
 
- 
- 
Method Details- 
solvingStarted
- 
runPhases
- 
solvingEnded
- 
solvingError
- 
phaseStarted
- 
phaseEnded
- 
stepStarted
- 
stepEnded
- 
addEventListener- Specified by:
- addEventListenerin interface- Solver<Solution_>
- Parameters:
- eventListener- never null
 
- 
removeEventListener- Specified by:
- removeEventListenerin interface- Solver<Solution_>
- Parameters:
- eventListener- never null
 
- 
addPhaseLifecycleListenerAdd aPhaseLifecycleListenerthat is notified ofsolvingevents and also of thephaseand thestepstarting/ending events of all phases.To get notified for only 1 phase, use Phase.addPhaseLifecycleListener(PhaseLifecycleListener)instead.- Parameters:
- phaseLifecycleListener- never null
 
- 
removePhaseLifecycleListener- Parameters:
- phaseLifecycleListener- never null
- See Also:
 
- 
getBestSolutionRecaller
- 
getPhaseList
 
-