| Modifier and Type | Field and Description |
|---|---|
protected BasicPlumbingTermination |
basicPlumbingTermination |
protected BestSolutionRecaller<Solution_> |
bestSolutionRecaller |
protected boolean |
constraintMatchEnabledPreference |
protected EnvironmentMode |
environmentMode |
protected org.slf4j.Logger |
logger |
protected PhaseLifecycleSupport<Solution_> |
phaseLifecycleSupport |
protected List<Phase> |
phaseList |
protected RandomFactory |
randomFactory |
protected InnerScoreDirectorFactory<Solution_> |
scoreDirectorFactory |
protected SolverEventSupport<Solution_> |
solverEventSupport |
protected DefaultSolverScope<Solution_> |
solverScope |
protected AtomicBoolean |
solving |
protected Termination |
termination |
| Constructor and Description |
|---|
DefaultSolver() |
protected final transient org.slf4j.Logger logger
protected SolverEventSupport<Solution_> solverEventSupport
protected PhaseLifecycleSupport<Solution_> phaseLifecycleSupport
protected EnvironmentMode environmentMode
protected RandomFactory randomFactory
protected boolean constraintMatchEnabledPreference
protected InnerScoreDirectorFactory<Solution_> scoreDirectorFactory
protected BasicPlumbingTermination basicPlumbingTermination
protected Termination termination
protected BestSolutionRecaller<Solution_> bestSolutionRecaller
protected AtomicBoolean solving
protected DefaultSolverScope<Solution_> solverScope
public EnvironmentMode getEnvironmentMode()
public void setEnvironmentMode(EnvironmentMode environmentMode)
public RandomFactory getRandomFactory()
public void setRandomFactory(RandomFactory randomFactory)
public boolean isConstraintMatchEnabledPreference()
public void setConstraintMatchEnabledPreference(boolean constraintMatchEnabledPreference)
public InnerScoreDirectorFactory<Solution_> getScoreDirectorFactory()
SolvergetScoreDirectorFactory in interface Solver<Solution_>public void setScoreDirectorFactory(InnerScoreDirectorFactory<Solution_> scoreDirectorFactory)
public void setBasicPlumbingTermination(BasicPlumbingTermination basicPlumbingTermination)
public void setTermination(Termination termination)
public BestSolutionRecaller<Solution_> getBestSolutionRecaller()
public void setBestSolutionRecaller(BestSolutionRecaller<Solution_> bestSolutionRecaller)
public DefaultSolverScope<Solution_> getSolverScope()
public Solution_ getBestSolution()
Solverbest solution found during solving:
it might or might not be optimal, feasible or even initialized.
The #solve(Solution_) method also returns the best solution,
but this method is useful in rare asynchronous situations (although
SolverEventListener.bestSolutionChanged(BestSolutionChangedEvent) is often more appropriate).
This method is thread-safe.
getBestSolution in interface Solver<Solution_>PlanningSolution with a Score null.public Score getBestScore()
SolverScore of the Solver.getBestSolution().
This is useful for generic code, which doesn't know the type of the PlanningSolution
to retrieve the Score from the Solver.getBestSolution() easily.
getBestScore in interface Solver<Solution_>PlanningSolution is still uninitializedpublic long getTimeMillisSpent()
getTimeMillisSpent in interface Solver<Solution_>public boolean isSolving()
Solverpublic boolean terminateEarly()
Solver#solve(Solution_) to actually return.
This method is thread-safe.
terminateEarly in interface Solver<Solution_>Solver.isTerminateEarly(),
Future.cancel(boolean)public boolean isTerminateEarly()
SolverisTerminateEarly in interface Solver<Solution_>Solver started.Future.isCancelled()public boolean addProblemFactChange(ProblemFactChange<Solution_> problemFactChange)
SolverProblemFactChange to be processed.
As a side-effect, this restarts the Solver, effectively resetting all Terminations,
but not Solver.terminateEarly().
This method is thread-safe.
Follows specifications of BlockingQueue.add(Object) with by default
a capacity of Integer.MAX_VALUE.
addProblemFactChange in interface Solver<Solution_>problemFactChange - never nullCollection.add(E))public boolean isEveryProblemFactChangeProcessed()
SolverProblemFactChanges have been processed.
This method is thread-safe.
isEveryProblemFactChangeProcessed in interface Solver<Solution_>ProblemFactChanges left to dopublic final Solution_ solve(Solution_ planningProblem)
Solver
It can take seconds, minutes, even hours or days before this method returns,
depending on the Termination configuration.
To terminate a Solver early, call Solver.terminateEarly().
solve in interface Solver<Solution_>planningProblem - never null, usually its planning variables are uninitializedPlanningSolution with a Score null.Solver.terminateEarly()public void outerSolvingStarted(DefaultSolverScope<Solution_> solverScope)
public void solvingStarted(DefaultSolverScope<Solution_> solverScope)
protected void runPhases()
public void solvingEnded(DefaultSolverScope<Solution_> solverScope)
public void outerSolvingEnded(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–2016 JBoss by Red Hat. All rights reserved.