Class EvolutionListeners

java.lang.Object
net.bmahe.genetics4j.core.evolutionlisteners.EvolutionListeners

public class EvolutionListeners extends Object
  • Constructor Details

    • EvolutionListeners

      private EvolutionListeners()
  • Method Details

    • ofLogTopN

      public static <U extends Comparable<U>> EvolutionListener<U> ofLogTopN(org.apache.logging.log4j.Logger logger, int topN)
    • ofLogTopN

      public static <U extends Comparable<U>> EvolutionListener<U> ofLogTopN(org.apache.logging.log4j.Logger logger, int topN, int skipN)
    • ofLogTopN

      public static <U extends Comparable<U>> EvolutionListener<U> ofLogTopN(org.apache.logging.log4j.Logger logger, int topN, Comparator<U> comparator)
    • ofLogTopN

      public static <U extends Comparable<U>> EvolutionListener<U> ofLogTopN(org.apache.logging.log4j.Logger logger, int topN, Comparator<U> comparator, Function<Genotype,String> prettyPrinter)
    • ofLogTopN

      public static <U extends Comparable<U>> EvolutionListener<U> ofLogTopN(org.apache.logging.log4j.Logger logger, int topN, Function<Genotype,String> prettyPrinter)
    • ofLogTopN

      public static <U extends Comparable<U>> EvolutionListener<U> ofLogTopN(org.apache.logging.log4j.Logger logger, int topN, int skipN, Comparator<U> comparator)
    • ofLogTopN

      public static <U extends Comparable<U>> EvolutionListener<U> ofLogTopN(org.apache.logging.log4j.Logger logger, int topN, int skipN, Comparator<U> comparator, Function<Genotype,String> prettyPrinter)
    • ofDefault

      public static <U extends Comparable<U>> EvolutionListener<U> ofDefault()
      Creates a default evolution listener that outputs to System.out without external logging dependencies. Shows the best individual each generation.
      Type Parameters:
      U - the fitness type, must be Comparable
      Returns:
      a new DefaultEvolutionListener instance
    • ofDefault

      public static <U extends Comparable<U>> EvolutionListener<U> ofDefault(int skipN)
      Creates a default evolution listener with generation skipping.
      Type Parameters:
      U - the fitness type, must be Comparable
      Parameters:
      skipN - the number of generations to skip between outputs (0 = no skipping)
      Returns:
      a new DefaultEvolutionListener instance
    • ofDefault

      public static <U extends Comparable<U>> EvolutionListener<U> ofDefault(int topN, int skipN)
      Creates a default evolution listener that shows the top N individuals.
      Type Parameters:
      U - the fitness type, must be Comparable
      Parameters:
      topN - the number of top individuals to display
      skipN - the number of generations to skip between outputs
      Returns:
      a new DefaultEvolutionListener instance
    • ofDefault

      public static <U extends Comparable<U>> EvolutionListener<U> ofDefault(int topN, Function<Genotype,String> prettyPrinter)
      Creates a default evolution listener with custom genotype formatting.
      Type Parameters:
      U - the fitness type, must be Comparable
      Parameters:
      topN - the number of top individuals to display
      prettyPrinter - function to format genotypes for display
      Returns:
      a new DefaultEvolutionListener instance
    • ofDefault

      public static <U extends Comparable<U>> EvolutionListener<U> ofDefault(int topN, int skipN, Function<Genotype,String> prettyPrinter)
      Creates a fully configurable default evolution listener.
      Type Parameters:
      U - the fitness type, must be Comparable
      Parameters:
      topN - the number of top individuals to display
      skipN - the number of generations to skip between outputs
      prettyPrinter - function to format genotypes for display
      Returns:
      a new DefaultEvolutionListener instance