Package io.jenetics

Interface Selector<G extends Gene<?,G>,C extends Comparable<? super C>>

Type Parameters:
G - The gene type this GA evaluates,
C - The result type (of the fitness function).
All Known Implementing Classes:
BoltzmannSelector, EliteSelector, ExponentialRankSelector, LinearRankSelector, MonteCarloSelector, NSGA2Selector, ProbabilitySelector, RouletteWheelSelector, StochasticUniversalSelector, TournamentSelector, TruncationSelector, UFTournamentSelector, WeaselSelector
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface Selector<G extends Gene<?,G>,C extends Comparable<? super C>>
Selectors are responsible for selecting a given number of individuals from the population. The selectors are used to divide the population into survivors and offspring. The selectors for offspring and for the survivors can be chosen independently.
final Engine<DoubleGene, Double> engine = Engine
    .builder(gtf, ff)
    .offspringSelector(new RouletteWheelSelector<>())
    .survivorsSelector(new TournamentSelector<>())
    .build();
Since:
1.0
Version:
4.0
  • Method Summary

    Modifier and Type
    Method
    Description
    select(Seq<Phenotype<G,C>> population, int count, Optimize opt)
    Select phenotypes from the Population.
  • Method Details

    • select

      ISeq<Phenotype<G,C>> select(Seq<Phenotype<G,C>> population, int count, Optimize opt)
      Select phenotypes from the Population.
      Parameters:
      population - The population to select from.
      count - The number of phenotypes to select.
      opt - Determines whether the individuals with higher fitness values or lower fitness values must be selected. This parameter determines whether the GA maximizes or minimizes the fitness function.
      Returns:
      The selected phenotypes (a new Population).
      Throws:
      NullPointerException - if the arguments is null.
      IllegalArgumentException - if the select count is smaller than zero.