public final class limit extends Object
EvolutionStream.limit(Predicate)
Modifier and Type | Method and Description |
---|---|
static <C extends Comparable<? super C>> |
bySteadyFitness(int generations)
Return a predicate, which will truncate the evolution stream if no
better phenotype could be found after the given number of
generations . |
public static <C extends Comparable<? super C>> Predicate<EvolutionResult<?,C>> bySteadyFitness(int generations)
generations
.
final Phenotype<DoubleGene, Double> result = engine.stream()
// Truncate the evolution stream after 5 "steady" generations.
.limit(bySteadyFitness(5))
// The evolution will stop after maximal 100 generations.
.limit(100)
.collect(toBestPhenotype());
C
- the fitness typegenerations
- the number of steady generationsgenerations
IllegalArgumentException
- if the generation is smaller than
one.© 2007-2014 Franz Wilhelmstötter (2014-12-28 10:45)