Class TournamentSelection<C extends GASolution<C>>

java.lang.Object
edu.cnu.mdi.sim.ga.triimage.TournamentSelection<C>
All Implemented Interfaces:
SelectionOperator<C>

public final class TournamentSelection<C extends GASolution<C>> extends Object implements SelectionOperator<C>
Tournament selection operator for genetic algorithms. This operator selects parents by running a "tournament" among a random subset of the population. The tournament size is a parameter that controls the selection pressure: larger tournaments favor fitter individuals more strongly.
  • Constructor Details

    • TournamentSelection

      public TournamentSelection(int tournamentSize)
      Create a tournament selection operator with the given tournament size.
      Parameters:
      tournamentSize - the number of individuals to compete in each tournament
  • Method Details

    • select

      public C select(List<C> population, double[] fitnesses, Random rng)
      Description copied from interface: SelectionOperator
      Select one parent from an aligned population and fitness array.
      Specified by:
      select in interface SelectionOperator<C extends GASolution<C>>
      Parameters:
      population - candidate individuals
      fitnesses - fitness at each corresponding population index
      rng - source of randomness
      Returns:
      selected individual