Module io.jenetics.base
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 output
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);
+---------------------------------------------------------------------------+
| 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
Modifier and TypeMethodDescriptionvoid
accept
(EvolutionResult<?, C> result) Return the duration statistics needed for altering the population, in seconds.altered()
Return the statistics about the altered individuals during the evolution process.Return the duration statistics needed for evaluating the fitness function of the new individuals, in seconds.Return the duration statistics needed for the whole evolved step, in seconds.fitness()
Return the minimal and maximal fitness.invalids()
Return the statistics about the invalid individuals during the evolution process.killed()
Return the statistics about the killed individuals during the evolution process.static <C extends Comparable<? super C>>
EvolutionStatistics<C, MinMax<C>> static <N extends Number & Comparable<? super N>>
EvolutionStatistics<N, DoubleMomentStatistics> ofNumber()
Return the statistics about the individual's age.Return the duration statistics needed for selecting the population, in seconds.toString()
-
Method Details
-
accept
- Specified by:
accept
in interfaceConsumer<C extends Comparable<? super C>>
-
selectionDuration
Return the duration statistics needed for selecting the population, in seconds.- Returns:
- the duration statistics needed for selecting the population
-
alterDuration
Return the duration statistics needed for altering the population, in seconds.- Returns:
- the duration statistics needed for altering the population
-
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
Return the duration statistics needed for the whole evolved step, in seconds.- Returns:
- the duration statistics needed for the whole evolve step
-
killed
Return the statistics about the killed individuals during the evolution process.- Returns:
- killed individual statistics
-
invalids
Return the statistics about the invalid individuals during the evolution process.- Returns:
- invalid individual statistics
-
altered
Return the statistics about the altered individuals during the evolution process.- Returns:
- altered individual statistics
-
phenotypeAge
Return the statistics about the individual's age.- Returns:
- individual age statistics
-
fitness
Return the minimal and maximal fitness.- Returns:
- minimal and maximal fitness
-
toString
-
ofComparable
-
ofNumber
public static <N extends Number & Comparable<? super N>> EvolutionStatistics<N,DoubleMomentStatistics> ofNumber()
-