org.drools.planner.core.localsearch.termination
Interface Termination

All Superinterfaces:
LocalSearchSolverAware, LocalSearchSolverLifecycleListener
All Known Implementing Classes:
AbstractCompositeTermination, AbstractTermination, AndCompositeTermination, OrCompositeTermination, ScoreAttainedTermination, StepCountTermination, TimeMillisSpendTermination, UnimprovedStepCountTermination

public interface Termination
extends LocalSearchSolverAware, LocalSearchSolverLifecycleListener

A Termination determines when the LocalSearchSolver should stop.


Method Summary
 double calculateTimeGradient(LocalSearchStepScope localSearchStepScope)
          A timeGradient is a relative estimate of how long the search will continue.
 boolean isTerminated(LocalSearchStepScope localSearchStepScope)
          Called by the LocalSearchSolver after every step to determine if the search should stop.
 
Methods inherited from interface org.drools.planner.core.localsearch.LocalSearchSolverAware
setLocalSearchSolver
 
Methods inherited from interface org.drools.planner.core.localsearch.LocalSearchSolverLifecycleListener
beforeDeciding, solvingEnded, solvingStarted, stepDecided, stepTaken
 

Method Detail

isTerminated

boolean isTerminated(LocalSearchStepScope localSearchStepScope)
Called by the LocalSearchSolver after every step to determine if the search should stop.

Parameters:
localSearchStepScope - never null
Returns:
true if the search should terminate.

calculateTimeGradient

double calculateTimeGradient(LocalSearchStepScope localSearchStepScope)
A timeGradient is a relative estimate of how long the search will continue.

Clients that use a timeGradient should cache it at the start of a single step because some implementations are not time-stable.

If a timeGradient can not be calulated, it should return -1.0. Several implementations (such a similated annealing) require a correctly implemented timeGradient.

A Termination's timeGradient can be requested after they are terminated, so implementations should be carefull not to return a tempature above 1.0.

Parameters:
localSearchStepScope - never null
Returns:
timeGradient t for which 0.0 <= t <= 1.0 or -1.0 when it is not supported. At the start of a search t is 0.0 and at the end of a search t would be 1.0.


Copyright © 2001-2011 JBoss Inc.. All Rights Reserved.