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.
final 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);
Example output

 +---------------------------------------------------------------------------+
 |  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