org.apache.commons.math3.genetics
public class FixedGenerationCount extends Object implements StoppingCondition
isSatisfied(Population)
is invoked, a generation
counter is incremented. Once the counter reaches the configured maxGenerations
value,
isSatisfied(Population)
returns true.Modifier and Type | Field and Description |
---|---|
private int |
maxGenerations
Maximum number of generations (stopping criteria)
|
private int |
numGenerations
Number of generations that have passed
|
Constructor and Description |
---|
FixedGenerationCount(int maxGenerations)
Create a new FixedGenerationCount instance.
|
Modifier and Type | Method and Description |
---|---|
int |
getNumGenerations()
Returns the number of generations that have already passed.
|
boolean |
isSatisfied(Population population)
Determine whether or not the given number of generations have passed.
|
private int numGenerations
private final int maxGenerations
public FixedGenerationCount(int maxGenerations) throws NumberIsTooSmallException
maxGenerations
- number of generations to evolveNumberIsTooSmallException
- if the number of generations is < 1public boolean isSatisfied(Population population)
isSatisfied
in interface StoppingCondition
population
- ignored (no impact on result)true
IFF the maximum number of generations has been exceededpublic int getNumGenerations()
Copyright (c) 2003-2013 Apache Software Foundation