Package org.apache.commons.math.genetics
Class FixedGenerationCount
- java.lang.Object
 - 
- org.apache.commons.math.genetics.FixedGenerationCount
 
 
- 
- All Implemented Interfaces:
 StoppingCondition
public class FixedGenerationCount extends java.lang.Object implements StoppingCondition
Stops after a fixed number of generations. Each timeisSatisfied(Population)is invoked, a generation counter is incremented. Once the counter reaches the configuredmaxGenerationsvalue,isSatisfied(Population)returns true.- Since:
 - 2.0
 
 
- 
- 
Constructor Summary
Constructors Constructor Description FixedGenerationCount(int maxGenerations)Create a new FixedGenerationCount instance. 
- 
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetNumGenerations()booleanisSatisfied(Population population)Determine whether or not the given number of generations have passed. 
 - 
 
- 
- 
Method Detail
- 
isSatisfied
public boolean isSatisfied(Population population)
Determine whether or not the given number of generations have passed. Increments the number of generations counter if the maximum has not been reached.- Specified by:
 isSatisfiedin interfaceStoppingCondition- Parameters:
 population- ignored (no impact on result)- Returns:
 trueIFF the maximum number of generations has been exceeded
 
- 
getNumGenerations
public int getNumGenerations()
- Returns:
 - the number of generations that have passed
 
 
 - 
 
 -