|
OptaPlanner core 6.2.0.Beta2 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.optaplanner.core.impl.solver.event.SolverLifecycleListenerAdapter
org.optaplanner.core.impl.phase.event.PhaseLifecycleListenerAdapter
org.optaplanner.core.impl.solver.termination.AbstractTermination
org.optaplanner.core.impl.solver.BasicPlumbingTermination
public class BasicPlumbingTermination
Concurrency notes:
Condition predicate on (problemFactChangeQueue
is not empty or terminatedEarly
is true)
Field Summary | |
---|---|
protected boolean |
daemon
|
protected BlockingQueue<ProblemFactChange> |
problemFactChangeQueue
|
protected boolean |
problemFactChangesBeingProcessed
|
protected boolean |
terminatedEarly
|
Fields inherited from class org.optaplanner.core.impl.solver.termination.AbstractTermination |
---|
logger |
Constructor Summary | |
---|---|
BasicPlumbingTermination(boolean daemon)
|
Method Summary | |
---|---|
boolean |
addProblemFactChange(ProblemFactChange problemFactChange)
Concurrency note: unblocks waitForRestartSolverDecision() |
double |
calculatePhaseTimeGradient(AbstractPhaseScope phaseScope)
See Termination.calculateSolverTimeGradient(DefaultSolverScope) . |
double |
calculateSolverTimeGradient(DefaultSolverScope solverScope)
A timeGradient is a relative estimate of how long the search will continue. |
void |
endProblemFactChangesProcessing()
|
boolean |
isEveryProblemFactChangeProcessed()
|
boolean |
isPhaseTerminated(AbstractPhaseScope phaseScope)
Called by the Phase after every step and every move to determine if the search should stop. |
boolean |
isSolverTerminated(DefaultSolverScope solverScope)
Called by the Solver after every phase to determine if the search should stop. |
boolean |
isTerminateEarly()
|
void |
resetTerminateEarly()
|
BlockingQueue<ProblemFactChange> |
startProblemFactChangesProcessing()
|
boolean |
terminateEarly()
Concurrency note: unblocks waitForRestartSolverDecision() |
boolean |
waitForRestartSolverDecision()
If this returns true, then the problemFactChangeQueue is definitely not empty. |
Methods inherited from class org.optaplanner.core.impl.phase.event.PhaseLifecycleListenerAdapter |
---|
phaseEnded, phaseStarted, stepEnded, stepStarted |
Methods inherited from class org.optaplanner.core.impl.solver.event.SolverLifecycleListenerAdapter |
---|
solvingEnded, solvingStarted |
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.impl.phase.event.PhaseLifecycleListener |
---|
phaseEnded, phaseStarted, stepEnded, stepStarted |
Methods inherited from interface org.optaplanner.core.impl.solver.event.SolverLifecycleListener |
---|
solvingEnded, solvingStarted |
Field Detail |
---|
protected final boolean daemon
protected boolean terminatedEarly
protected BlockingQueue<ProblemFactChange> problemFactChangeQueue
protected boolean problemFactChangesBeingProcessed
Constructor Detail |
---|
public BasicPlumbingTermination(boolean daemon)
Method Detail |
---|
public void resetTerminateEarly()
public boolean terminateEarly()
waitForRestartSolverDecision()
public boolean isTerminateEarly()
public boolean waitForRestartSolverDecision()
problemFactChangeQueue
is not empty or terminatedEarly
is true.
public boolean addProblemFactChange(ProblemFactChange problemFactChange)
waitForRestartSolverDecision()
problemFactChange
- never null
Collection.add(E)
public BlockingQueue<ProblemFactChange> startProblemFactChangesProcessing()
public void endProblemFactChangesProcessing()
public boolean isEveryProblemFactChangeProcessed()
public boolean isSolverTerminated(DefaultSolverScope solverScope)
Termination
Solver
after every phase to determine if the search should stop.
solverScope
- never null
public boolean isPhaseTerminated(AbstractPhaseScope phaseScope)
Termination
Phase
after every step and every move to determine if the search should stop.
phaseScope
- never null
public double calculateSolverTimeGradient(DefaultSolverScope solverScope)
Termination
SimulatedAnnealingAcceptor
) require a correctly implemented timeGradient.
A Termination's timeGradient can be requested after they are terminated, so implementations
should be careful not to return a timeGradient above 1.0.
solverScope
- never null
public double calculatePhaseTimeGradient(AbstractPhaseScope phaseScope)
Termination
Termination.calculateSolverTimeGradient(DefaultSolverScope)
.
phaseScope
- never null
|
OptaPlanner core 6.2.0.Beta2 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |