Interface TerminationCondition
- All Superinterfaces:
Named
- All Known Implementing Classes:
CancellationSignal
,CompoundTerminationCondition
,MaxElapsedTime
,MaxFunctionEvaluations
,TargetObjectiveTermination
,TemperatureBasedTerminationCondition
Interface used to implement conditions for when an algorithm should terminate. The
initialize
method is
invoked when the algorithm is first created to collect any initial conditions, such as the starting time,
and shouldTerminate
is invoked every step to check if the algorithm should terminate.-
Method Summary
Modifier and TypeMethodDescriptiondefault String
getName()
Returns the name of this object.double
getPercentComplete
(Algorithm algorithm) Returns the percentage that this condition is complete, as a value between0.0
and100.0
.void
initialize
(Algorithm algorithm) Invoked when the algorithm is created to collect any initial conditions.boolean
shouldTerminate
(Algorithm algorithm) Invoked after every step to check if the algorithm should terminate.
-
Method Details
-
initialize
Invoked when the algorithm is created to collect any initial conditions. Note that the algorithm may not have been initialized at this point.- Parameters:
algorithm
- the algorithm
-
shouldTerminate
Invoked after every step to check if the algorithm should terminate.- Parameters:
algorithm
- the algorithm- Returns:
true
if the algorithm should terminate;false
otherwise
-
getPercentComplete
Returns the percentage that this condition is complete, as a value between0.0
and100.0
. If the percentage can not be determined, returns 0d/0d.- Parameters:
algorithm
- the algorithm- Returns:
- the percentage completion
-
getName
Description copied from interface:Named
Returns the name of this object. The format for the name depends on the specific implementation, but in general we recommend:- Prefer using alphanumeric characters including
'_'
and'-'
. - Avoid whitespace and other control characters.
null
can be returned, if allowed by the implementation, to indicate the object is anonymous or has no assigned name.
- Prefer using alphanumeric characters including
-