Class FixedElapsedTime
java.lang.Object
org.apache.commons.math3.genetics.FixedElapsedTime
- All Implemented Interfaces:
StoppingCondition
Stops after a fixed amount of time has elapsed.
The first time isSatisfied(Population) is invoked, the end time of the evolution is determined based on the
provided maxTime value. Once the elapsed time reaches the configured maxTime value,
isSatisfied(Population) returns true.
- Since:
- 3.1
-
Constructor Summary
ConstructorsConstructorDescriptionFixedElapsedTime(long maxTime) Create a newFixedElapsedTimeinstance.FixedElapsedTime(long maxTime, TimeUnit unit) Create a newFixedElapsedTimeinstance. -
Method Summary
Modifier and TypeMethodDescriptionbooleanisSatisfied(Population population) Determine whether or not the maximum allowed time has passed.
-
Constructor Details
-
FixedElapsedTime
Create a newFixedElapsedTimeinstance.- Parameters:
maxTime- maximum number of seconds generations are allowed to evolve- Throws:
NumberIsTooSmallException- if the provided time is < 0
-
FixedElapsedTime
Create a newFixedElapsedTimeinstance.- Parameters:
maxTime- maximum time generations are allowed to evolveunit-TimeUnitof the maxTime argument- Throws:
NumberIsTooSmallException- if the provided time is < 0
-
-
Method Details
-
isSatisfied
Determine whether or not the maximum allowed time has passed. The termination time is determined after the first generation.- Specified by:
isSatisfiedin interfaceStoppingCondition- Parameters:
population- ignored (no impact on result)- Returns:
trueIFF the maximum allowed time period has elapsed
-