Package io.jenetics.engine
Class EvolutionStatistics<C extends Comparable<? super C>,FitnessStatistics>
- java.lang.Object
-
- io.jenetics.engine.EvolutionStatistics<C,FitnessStatistics>
-
- All Implemented Interfaces:
Consumer<EvolutionResult<?,C>>
public abstract class EvolutionStatistics<C extends Comparable<? super C>,FitnessStatistics> extends Object implements Consumer<EvolutionResult<?,C>>
This class can be used to gather additional statistic information of an evolution process. The additional information can be useful during the development phase of the GA or while testing the GA's performance. The following example shows how to integrate the statistics object into your evolution stream.Example outputfinal Engine<DoubleGene, Double> engine = ... final EvolutionStatistics<Double, DoubleMomentStatistics> statistics = EvolutionStatistics.ofNumber(); final Phenotype<DoubleGene, Double> result = engine.stream() .limit(bySteadyFitness(7)) .limit(100) .peek(statistics) .collect(toBestPhenotype()); System.println(statistics);
+---------------------------------------------------------------------------+ | Time statistics | +---------------------------------------------------------------------------+ | Selection: sum=0.046538278000 s; mean=0.003878189833 s | | Altering: sum=0.086155457000 s; mean=0.007179621417 s | | Fitness calculation: sum=0.022901606000 s; mean=0.001908467167 s | | Overall execution: sum=0.147298067000 s; mean=0.012274838917 s | +---------------------------------------------------------------------------+ | Evolution statistics | +---------------------------------------------------------------------------+ | Generations: 12 | | Altered: sum=7,331; mean=610.916666667 | | Killed: sum=0; mean=0.000000000 | | Invalids: sum=0; mean=0.000000000 | +---------------------------------------------------------------------------+ | Population statistics | +---------------------------------------------------------------------------+ | Age: max=11; mean=1.951000; var=5.545190 | | Fitness: | | min = 0.000000000000 | | max = 481.748227114537 | | mean = 384.430345078660 | | var = 13006.132537301528 | | std = 114.044432 | +---------------------------------------------------------------------------+
- Since:
- 3.0
- Version:
- 6.0
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
accept(EvolutionResult<?,C> result)
DoubleMomentStatistics
alterDuration()
Return the duration statistics needed for altering the population, in seconds.IntMomentStatistics
altered()
Return the statistics about the altered individuals during the evolution process.DoubleMomentStatistics
evaluationDuration()
Return the duration statistics needed for evaluating the fitness function of the new individuals, in seconds.DoubleMomentStatistics
evolveDuration()
Return the duration statistics needed for the whole evolve step, in seconds.FitnessStatistics
fitness()
Return the minimal and maximal fitness.IntMomentStatistics
invalids()
Return the statistics about the invalid individuals during the evolution process.IntMomentStatistics
killed()
Return the statistics about the killed individuals during the evolution process.static <C extends Comparable<? super C>>
EvolutionStatistics<C,MinMax<C>>ofComparable()
static <N extends Number & Comparable<? super N>>
EvolutionStatistics<N,DoubleMomentStatistics>ofNumber()
LongMomentStatistics
phenotypeAge()
Return the statistics about the individuals age.DoubleMomentStatistics
selectionDuration()
Return the duration statistics needed for selecting the population, in seconds.String
toString()
-
-
-
Method Detail
-
accept
public void accept(EvolutionResult<?,C> result)
- Specified by:
accept
in interfaceConsumer<C extends Comparable<? super C>>
-
selectionDuration
public DoubleMomentStatistics selectionDuration()
Return the duration statistics needed for selecting the population, in seconds.- Returns:
- the duration statistics needed for selecting the population
-
alterDuration
public DoubleMomentStatistics alterDuration()
Return the duration statistics needed for altering the population, in seconds.- Returns:
- the duration statistics needed for altering the population
-
evaluationDuration
public DoubleMomentStatistics evaluationDuration()
Return the duration statistics needed for evaluating the fitness function of the new individuals, in seconds.- Returns:
- the duration statistics needed for evaluating the fitness function of the new individuals
-
evolveDuration
public DoubleMomentStatistics evolveDuration()
Return the duration statistics needed for the whole evolve step, in seconds.- Returns:
- the duration statistics needed for the whole evolve step
-
killed
public IntMomentStatistics killed()
Return the statistics about the killed individuals during the evolution process.- Returns:
- killed individual statistics
-
invalids
public IntMomentStatistics invalids()
Return the statistics about the invalid individuals during the evolution process.- Returns:
- invalid individual statistics
-
altered
public IntMomentStatistics altered()
Return the statistics about the altered individuals during the evolution process.- Returns:
- altered individual statistics
-
phenotypeAge
public LongMomentStatistics phenotypeAge()
Return the statistics about the individuals age.- Returns:
- individual age statistics
-
fitness
public FitnessStatistics fitness()
Return the minimal and maximal fitness.- Returns:
- minimal and maximal fitness
-
ofComparable
public static <C extends Comparable<? super C>> EvolutionStatistics<C,MinMax<C>> ofComparable()
-
ofNumber
public static <N extends Number & Comparable<? super N>> EvolutionStatistics<N,DoubleMomentStatistics> ofNumber()
-
-