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
 
 public abstract class AbstractSolver<Solution_> extends Object implements Solver<Solution_> Common code betweenDefaultSolverand child solvers (such asPartitionSolver.Do not create a new child Solverto implement a new heuristic or metaheuristic, just use a newPhasefor that.- See Also:
- Solver,- DefaultSolver
 
- 
- 
Field SummaryFields Modifier and Type Field Description protected BestSolutionRecaller<Solution_>bestSolutionRecallerprotected org.slf4j.Loggerloggerprotected PhaseLifecycleSupport<Solution_>phaseLifecycleSupportprotected List<Phase<Solution_>>phaseListprotected SolverEventSupport<Solution_>solverEventSupportprotected Termination<Solution_>termination
 - 
Constructor SummaryConstructors Constructor Description AbstractSolver(BestSolutionRecaller<Solution_> bestSolutionRecaller, Termination<Solution_> termination, List<Phase<Solution_>> phaseList)
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddEventListener(SolverEventListener<Solution_> eventListener)voidaddPhaseLifecycleListener(PhaseLifecycleListener<Solution_> phaseLifecycleListener)Add aPhaseLifecycleListenerthat is notified ofSolverLifecycleListener.solvingStarted(SolverScope)solving} events and also of thephaseand thePhaseLifecycleListener.stepStarted(AbstractStepScope)step} starting/ending events of all phases.voidremoveEventListener(SolverEventListener<Solution_> eventListener)voidremovePhaseLifecycleListener(PhaseLifecycleListener<Solution_> phaseLifecycleListener)protected voidrunPhases(SolverScope<Solution_> solverScope)voidsolvingEnded(SolverScope<Solution_> solverScope)voidsolvingStarted(SolverScope<Solution_> solverScope)- 
Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 - 
Methods inherited from interface org.optaplanner.core.api.solver.SolveraddProblemFactChange, addProblemFactChanges, isEveryProblemFactChangeProcessed, isSolving, isTerminateEarly, solve, terminateEarly
 
- 
 
- 
- 
- 
Field Detail- 
loggerprotected final transient org.slf4j.Logger logger 
 - 
solverEventSupportprotected final SolverEventSupport<Solution_> solverEventSupport 
 - 
phaseLifecycleSupportprotected final PhaseLifecycleSupport<Solution_> phaseLifecycleSupport 
 - 
bestSolutionRecallerprotected final BestSolutionRecaller<Solution_> bestSolutionRecaller 
 - 
terminationprotected final Termination<Solution_> termination 
 
- 
 - 
Constructor Detail- 
AbstractSolverpublic AbstractSolver(BestSolutionRecaller<Solution_> bestSolutionRecaller, Termination<Solution_> termination, List<Phase<Solution_>> phaseList) 
 
- 
 - 
Method Detail- 
solvingStartedpublic void solvingStarted(SolverScope<Solution_> solverScope) 
 - 
runPhasesprotected void runPhases(SolverScope<Solution_> solverScope) 
 - 
solvingEndedpublic void solvingEnded(SolverScope<Solution_> solverScope) 
 - 
addEventListenerpublic void addEventListener(SolverEventListener<Solution_> eventListener) - Specified by:
- addEventListenerin interface- Solver<Solution_>
- Parameters:
- eventListener- never null
 
 - 
removeEventListenerpublic void removeEventListener(SolverEventListener<Solution_> eventListener) - Specified by:
- removeEventListenerin interface- Solver<Solution_>
- Parameters:
- eventListener- never null
 
 - 
addPhaseLifecycleListenerpublic void addPhaseLifecycleListener(PhaseLifecycleListener<Solution_> phaseLifecycleListener) Add aPhaseLifecycleListenerthat is notified ofSolverLifecycleListener.solvingStarted(SolverScope)solving} events and also of thephaseand thePhaseLifecycleListener.stepStarted(AbstractStepScope)step} starting/ending events of all phases.To get notified for only 1 phase, use Phase.addPhaseLifecycleListener(PhaseLifecycleListener)instead.- Parameters:
- phaseLifecycleListener- never null
 
 - 
removePhaseLifecycleListenerpublic void removePhaseLifecycleListener(PhaseLifecycleListener<Solution_> phaseLifecycleListener) - Parameters:
- phaseLifecycleListener- never null
- See Also:
- addPhaseLifecycleListener(PhaseLifecycleListener)
 
 
- 
 
-