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 thePlanningSolutionannotation
- 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 Summary
Fields Modifier and Type Field Description protected BestSolutionRecaller<Solution_>bestSolutionRecallerprotected org.slf4j.Loggerloggerprotected List<Phase<Solution_>>phaseListprotected Termination<Solution_>solverTermination 
- 
Constructor Summary
Constructors Constructor Description AbstractSolver(BestSolutionRecaller<Solution_> bestSolutionRecaller, Termination<Solution_> solverTermination, List<Phase<Solution_>> phaseList) 
- 
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.api.solver.Solver
addProblemFactChange, addProblemFactChanges, isEveryProblemFactChangeProcessed, isSolving, isTerminateEarly, solve, terminateEarly 
 - 
 
 - 
 
- 
- 
Field Detail
- 
logger
protected final transient org.slf4j.Logger logger
 
- 
bestSolutionRecaller
protected final BestSolutionRecaller<Solution_> bestSolutionRecaller
 
- 
solverTermination
protected final Termination<Solution_> solverTermination
 
 - 
 
- 
Constructor Detail
- 
AbstractSolver
public AbstractSolver(BestSolutionRecaller<Solution_> bestSolutionRecaller, Termination<Solution_> solverTermination, List<Phase<Solution_>> phaseList)
 
 - 
 
- 
Method Detail
- 
solvingStarted
public void solvingStarted(SolverScope<Solution_> solverScope)
 
- 
runPhases
protected void runPhases(SolverScope<Solution_> solverScope)
 
- 
solvingEnded
public void solvingEnded(SolverScope<Solution_> solverScope)
 
- 
phaseStarted
public void phaseStarted(AbstractPhaseScope<Solution_> phaseScope)
 
- 
phaseEnded
public void phaseEnded(AbstractPhaseScope<Solution_> phaseScope)
 
- 
stepStarted
public void stepStarted(AbstractStepScope<Solution_> stepScope)
 
- 
stepEnded
public void stepEnded(AbstractStepScope<Solution_> stepScope)
 
- 
addEventListener
public void addEventListener(SolverEventListener<Solution_> eventListener)
- Specified by:
 addEventListenerin interfaceSolver<Solution_>- Parameters:
 eventListener- never null
 
- 
removeEventListener
public void removeEventListener(SolverEventListener<Solution_> eventListener)
- Specified by:
 removeEventListenerin interfaceSolver<Solution_>- Parameters:
 eventListener- never null
 
- 
addPhaseLifecycleListener
public 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
 
- 
removePhaseLifecycleListener
public void removePhaseLifecycleListener(PhaseLifecycleListener<Solution_> phaseLifecycleListener)
- Parameters:
 phaseLifecycleListener- never null- See Also:
 addPhaseLifecycleListener(PhaseLifecycleListener)
 
- 
getBestSolutionRecaller
public BestSolutionRecaller<Solution_> getBestSolutionRecaller()
 
 - 
 
 -