Solution_
- the solution type, the class with the PlanningSolution
annotationpublic abstract class AbstractSolver<Solution_> extends Object implements Solver<Solution_>
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.
Solver
,
DefaultSolver
Modifier and Type | Field and Description |
---|---|
protected BestSolutionRecaller<Solution_> |
bestSolutionRecaller |
protected PhaseLifecycleSupport<Solution_> |
phaseLifecycleSupport |
protected List<Phase<Solution_>> |
phaseList |
protected SolverEventSupport<Solution_> |
solverEventSupport |
protected Termination |
termination |
Constructor and Description |
---|
AbstractSolver(BestSolutionRecaller<Solution_> bestSolutionRecaller,
Termination termination,
List<Phase<Solution_>> phaseList) |
Modifier and Type | Method and Description |
---|---|
void |
addEventListener(SolverEventListener<Solution_> eventListener) |
void |
addPhaseLifecycleListener(PhaseLifecycleListener<Solution_> phaseLifecycleListener)
Add a
PhaseLifecycleListener that is notified
of SolverLifecycleListener.solvingStarted(DefaultSolverScope) solving} events
and also of the phase
and the PhaseLifecycleListener.stepStarted(AbstractStepScope) step} starting/ending events of all phases. |
void |
removeEventListener(SolverEventListener<Solution_> eventListener) |
void |
removePhaseLifecycleListener(PhaseLifecycleListener<Solution_> phaseLifecycleListener) |
protected void |
runPhases(DefaultSolverScope<Solution_> solverScope) |
void |
solvingEnded(DefaultSolverScope<Solution_> solverScope) |
void |
solvingStarted(DefaultSolverScope<Solution_> solverScope) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addProblemFactChange, addProblemFactChanges, explainBestScore, getBestScore, getBestSolution, getScoreDirectorFactory, getTimeMillisSpent, isEveryProblemFactChangeProcessed, isSolving, isTerminateEarly, solve, terminateEarly
protected final SolverEventSupport<Solution_> solverEventSupport
protected final PhaseLifecycleSupport<Solution_> phaseLifecycleSupport
protected final BestSolutionRecaller<Solution_> bestSolutionRecaller
protected final Termination termination
public AbstractSolver(BestSolutionRecaller<Solution_> bestSolutionRecaller, Termination termination, List<Phase<Solution_>> phaseList)
public void solvingStarted(DefaultSolverScope<Solution_> solverScope)
protected void runPhases(DefaultSolverScope<Solution_> solverScope)
public void solvingEnded(DefaultSolverScope<Solution_> solverScope)
public void addEventListener(SolverEventListener<Solution_> eventListener)
addEventListener
in interface Solver<Solution_>
eventListener
- never nullpublic void removeEventListener(SolverEventListener<Solution_> eventListener)
removeEventListener
in interface Solver<Solution_>
eventListener
- never nullpublic void addPhaseLifecycleListener(PhaseLifecycleListener<Solution_> phaseLifecycleListener)
PhaseLifecycleListener
that is notified
of SolverLifecycleListener.solvingStarted(DefaultSolverScope)
solving} events
and also of the phase
and the PhaseLifecycleListener.stepStarted(AbstractStepScope)
step} starting/ending events of all phases.
To get notified for only 1 phase, use Phase.addPhaseLifecycleListener(PhaseLifecycleListener)
instead.
phaseLifecycleListener
- never nullpublic void removePhaseLifecycleListener(PhaseLifecycleListener<Solution_> phaseLifecycleListener)
phaseLifecycleListener
- never nulladdPhaseLifecycleListener(PhaseLifecycleListener)
Copyright © 2006–2019 JBoss by Red Hat. All rights reserved.