Class SimpleEvolutionListener<T extends Number>

java.lang.Object
net.bmahe.genetics4j.core.evolutionlisteners.SimpleEvolutionListener<T>
All Implemented Interfaces:
EvolutionListener<T>

public class SimpleEvolutionListener<T extends Number> extends Object implements EvolutionListener<T>
  • Field Details

    • logger

      public static final org.apache.logging.log4j.Logger logger
  • Constructor Details

    • SimpleEvolutionListener

      public SimpleEvolutionListener()
  • Method Details

    • onEvolution

      public void onEvolution(long generation, List<Genotype> population, List<T> fitness, boolean isDone)
      Description copied from interface: EvolutionListener
      Called after each generation to notify about evolution progress.

      This method is invoked by the evolutionary algorithm after each generation has been completed, providing access to the current population state and fitness values. The implementation can use this information for monitoring, logging, or adaptive control.

      The method is called with:

      • Current generation number (starting from 0)
      • Complete population of genotypes for this generation
      • Corresponding fitness values for each individual
      • Flag indicating whether evolution has completed

      Important notes:

      • Population and fitness lists are guaranteed to have the same size
      • Fitness values correspond to genotypes at the same index
      • Data may be shared with the evolution algorithm; avoid modification
      • Method should execute quickly to avoid impacting evolution performance
      Specified by:
      onEvolution in interface EvolutionListener<T extends Number>
      Parameters:
      generation - the current generation number (0-based)
      population - the list of genotypes in the current generation
      fitness - the list of fitness values corresponding to each genotype
      isDone - true if the evolution has completed, false otherwise