Class EvolutionParams.Builder<G extends Gene<?,G>,C extends Comparable<? super C>>

java.lang.Object
io.jenetics.engine.EvolutionParams.Builder<G,C>
Type Parameters:
G - the gene type
C - the fitness function result type
Enclosing class:
EvolutionParams<G extends Gene<?,G>,C extends Comparable<? super C>>

public static final class EvolutionParams.Builder<G extends Gene<?,G>,C extends Comparable<? super C>> extends Object
Builder class for the evolution parameter.
  • Method Details

    • evolutionParams

    • offspringSelector

      The selector used for selecting the offspring population. Default values is set to TournamentSelector<>(3).
      Parameters:
      selector - used for selecting the offspring population
      Returns:
      this builder, for command chaining
    • survivorsSelector

      The selector used for selecting the survivor population. Default values is set to TournamentSelector<>(3).
      Parameters:
      selector - used for selecting survivor population
      Returns:
      this builder, for command chaining
    • selector

      The selector used for selecting the survivors and offspring population. Default values is set to TournamentSelector<>(3).
      Parameters:
      selector - used for selecting survivors and offspring population
      Returns:
      this builder, for command chaining
    • alterers

      @SafeVarargs public final EvolutionParams.Builder<G,C> alterers(Alterer<G,C> first, Alterer<G,C>... rest)
      The alterers used for alter the offspring population. Default values is set to new SinglePointCrossover<>(0.2) followed by new Mutator<>(0.15).
      Parameters:
      first - the first alterer used for alter the offspring population
      rest - the rest of the alterers used for alter the offspring population
      Returns:
      this builder, for command chaining
      Throws:
      NullPointerException - if one of the alterers is null.
    • populationSize

      The number of individuals which form the population. Default values is set to 50.
      Parameters:
      size - the number of individuals of a population
      Returns:
      this builder, for command chaining
      Throws:
      IllegalArgumentException - if size < 1
    • offspringFraction

      public EvolutionParams.Builder<G,C> offspringFraction(double fraction)
      The offspring fraction.
      Parameters:
      fraction - the offspring fraction
      Returns:
      this builder, for command chaining
      Throws:
      IllegalArgumentException - if the fraction is not within the range [0, 1].
    • maximalPhenotypeAge

      The maximal allowed age of a phenotype. Default values is set to 70.
      Parameters:
      age - the maximal phenotype age
      Returns:
      this builder, for command chaining
      Throws:
      IllegalArgumentException - if age < 1
    • build

      public EvolutionParams<G,C> build()
      Builds a new EvolutionParams instance from the set properties.
      Returns:
      a new EvolutionParams instance from the set properties
    • alterer

      public Alterer<G,C> alterer()
      Return the used Alterer of the GA.
      Returns:
      the used Alterer of the GA.
    • maximalPhenotypeAge

      public long maximalPhenotypeAge()
      Return the maximal allowed phenotype age.
      Returns:
      the maximal allowed phenotype age
    • offspringSelector

      Return the used offspring Selector of the GA.
      Returns:
      the used offspring Selector of the GA.
    • survivorsSelector

      Return the used survivor Selector of the GA.
      Returns:
      the used survivor Selector of the GA.
    • populationSize

      public int populationSize()
      Return the number of individuals of a population.
      Returns:
      the number of individuals of a population
    • offspringFraction

      public double offspringFraction()
      Return the offspring fraction.
      Returns:
      the offspring fraction.
    • offspringSize

      public int offspringSize()
      Return the number of offspring. This is a derived property.
      Returns:
      the offspring count.
    • survivorsSize

      public int survivorsSize()
      Return the number of survivors. This is a derived property.
      Returns:
      the number of survivors