Class AbstractEAConfiguration<T extends Comparable<T>>

Type Parameters:
T - Type of the fitness measurement
Direct Known Subclasses:
EAConfiguration, EAConfigurationBulkAsync, GPUEAConfiguration

public abstract class AbstractEAConfiguration<T extends Comparable<T>> extends Object
Evolutionary Algorithm Configuration.

This describe the set of strategies to use. They describe the genotype, the different policies for selection, combination as well as mutation, and other relevant parameters

Fitness computation is delegated to subclasses to better match the various ways in which they can be computed

  • Field Details


      public static final double DEFAULT_OFFSPRING_RATIO
      Default offspring ratio
      See Also:

      public static final Optimization DEFAULT_OPTIMIZATION
      Default optimization strategy
  • Constructor Details

    • AbstractEAConfiguration

      public AbstractEAConfiguration()
  • Method Details

    • chromosomeSpecs

      public abstract List<ChromosomeSpec> chromosomeSpecs()
      Genotype of the population
    • parentSelectionPolicy

      public abstract SelectionPolicy parentSelectionPolicy()
      Defines the policy to select the parents. The selected parents will be used for generating the new offsprings
    • combinationPolicy

      public abstract CombinationPolicy combinationPolicy()
      Defines the policy to generate new offsprings from two parents
    • mutationPolicies

      public abstract List<MutationPolicy> mutationPolicies()
      Defines what mutations to be performed on the offsprings
    • replacementStrategy

      @Default public ReplacementStrategy replacementStrategy()
      Defines the replacement strategy

      The replacement strategy is what will determine the next population based on the generated and mutated offsprings along with the current population

      If not specified, the default replacement strategy will be to use Elitism with tournament selection of 3 individuals for both offsprings and survivors. The default offspring ratio is Elitism.DEFAULT_OFFSPRING_RATIO

    • postEvaluationProcessor

      public abstract Optional<Function<Population<T>,Population<T>>> postEvaluationProcessor()
      Post-processing of a population after it got evaluated

      This gives the opportunity to filter out, repair or rescore individuals

      Population to be used by the remaining evolution process
    • termination

      public abstract Termination<T> termination()
      Defines termination condition
    • genotypeGenerator

      public abstract Optional<Supplier<Genotype>> genotypeGenerator()
      Defines how to generate individuals

      If not specified, the system will rely on the chromosome factories

    • seedPopulation

      @Default public Collection<Genotype> seedPopulation()
      Seed the initial population with specific individuals
    • genotypeCombinator

      @Default public GenotypeCombinator genotypeCombinator()
      Defines how to combine the offspring chromosomes generated

      Combination of individuals is done on a per chromosome basis. This means some parents may generate a different number of children for each chromosome. This method will therefore define how to take all these generated chromosomes and combine them into offspring individuals

      The current default implementation is to generate as many individual as there are combinations of generated chromosomes

    • offspringGeneratedRatio

      @Default public double offspringGeneratedRatio()
      Defines how many children will be generated at each iteration. Value must be between 0 and 1 (inclusive) and represents a fraction of the population size
    • optimization

      @Default public Optimization optimization()
      Defines the optimization goal, whether we want to maximize the fitness or minimize it
    • check

      @Check protected void check()
      Validates the configuration
    • getChromosomeSpec

      public ChromosomeSpec getChromosomeSpec(int index)
      Returns a specific chromosome spec from the genotype definition
      index -
    • numChromosomes

      public int numChromosomes()
      Returns the currently number of chromosomes defined in the genotype
    • fitnessComparator

      public Comparator<T> fitnessComparator()
      Return a comparator based on the optimization method and natural order