Interface Selector<T extends Comparable<T>>

Type Parameters:
T - the type of the fitness values, must be comparable for ranking operations
All Known Implementing Classes:
DoubleTournamentSelector, NeatSelectorImpl, NSGA2Selector, ProportionalTournamentSelector, TournamentNSGA2Selector, TournamentSelector
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<T extends Comparable<T>>
Functional interface for selecting individuals from a population in evolutionary algorithms.

Selection is a fundamental operator in evolutionary algorithms that determines which individuals from the current population will be chosen to participate in reproduction. The selection pressure influences the direction and speed of evolution by favoring individuals with better fitness values.

Selection operates on a population with associated fitness values and returns a subset of individuals based on the specific selection strategy. The selected individuals typically become parents for the next generation through crossover and mutation operations.

Common selection strategies include:

  • Tournament selection: Randomly sample candidates and select the best
  • Roulette wheel selection: Probabilistic selection based on fitness proportion
  • Rank-based selection: Selection based on fitness ranking rather than raw values
  • Proportional selection: Probability proportional to relative fitness
  • Elitism: Always select the best individuals

Selection balances two competing objectives:

  • Exploitation: Favor high-fitness individuals to improve solution quality
  • Exploration: Maintain diversity by giving lower-fitness individuals a chance

Implementations should be:

  • Stochastic: Use randomization to prevent premature convergence
  • Fitness-aware: Consider fitness values when making selection decisions
  • Configurable: Support parameters to adjust selection pressure
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    select(AbstractEAConfiguration<T> eaConfiguration, int numIndividuals, List<Genotype> population, List<T> fitnessScore)
    Selects a specified number of individuals from the given population based on their fitness values.
  • Method Details

    • select

      Population<T> select(AbstractEAConfiguration<T> eaConfiguration, int numIndividuals, List<Genotype> population, List<T> fitnessScore)
      Selects a specified number of individuals from the given population based on their fitness values.

      This method implements the core selection logic, choosing individuals according to the specific selection strategy. The selection process typically involves evaluating fitness values and applying probabilistic or deterministic rules to choose parents for reproduction.

      The selection process should:

      • Consider fitness values when making selection decisions
      • Return exactly the requested number of individuals
      • Allow for the possibility of selecting the same individual multiple times
      • Maintain the integrity of the original population
      Parameters:
      eaConfiguration - the evolutionary algorithm configuration containing selection parameters
      numIndividuals - the number of individuals to select from the population
      population - the list of genotypes in the current population
      fitnessScore - the list of fitness values corresponding to each genotype
      Returns:
      a new population containing the selected individuals
      Throws:
      IllegalArgumentException - if numIndividuals is negative, if population and fitnessScore have different sizes, or if any parameter is null
      IllegalStateException - if the selection process cannot complete successfully