Class TournamentSelection

java.lang.Object
org.moeaframework.core.selection.TournamentSelection
All Implemented Interfaces:
Selection

public class TournamentSelection extends Object implements Selection
Deterministic tournament selection operator. The tournament size specifies the number of candidate solutions selected randomly from a population. The winner of a tournament is the best solution in the pool. Unlike probabilistic tournament selection, the best solution is always returned in deterministic tournament selection. If two or more solutions are the best in the pool, one solution is randomly selected with equal probability as the tournament winner.

Binary tournament selection exhibits the same selection pressure as linear ranking but without the computational overhead required for ranking. Larger tournament sizes result in greedier selection. Solutions are selected with replacement.

  • Constructor Details

    • TournamentSelection

      public TournamentSelection()
      Constructs a binary tournament selection operator using Pareto dominance.
    • TournamentSelection

      public TournamentSelection(DominanceComparator comparator)
      Constructs a binary tournament selection operator using the specified dominance comparator.
      Parameters:
      comparator - the comparator used to determine the tournament winner
    • TournamentSelection

      public TournamentSelection(int size)
      Constructs a tournament selection operator of the specified size using Pareto dominance.
      Parameters:
      size - the tournament size
    • TournamentSelection

      public TournamentSelection(int size, DominanceComparator comparator)
      Constructs a tournament selection operator of the specified size and using the specified dominance comparator.
      Parameters:
      size - the tournament size
      comparator - the comparator used to determine the tournament winner
  • Method Details

    • getSize

      public int getSize()
      Returns the tournament size.
      Returns:
      the tournament size
    • setSize

      public void setSize(int size)
      Sets the tournament size.
      Parameters:
      size - the new tournament size
    • getComparator

      public DominanceComparator getComparator()
      Returns the dominance comparator used to determine the tournament winner.
      Returns:
      the comparator used to determine the tournament winner
    • select

      public Solution[] select(int arity, Population population)
      Description copied from interface: Selection
      Returns an array of length arity of solutions selected from the specified population.
      Specified by:
      select in interface Selection
      Parameters:
      arity - the number of solutions selected from the specified population
      population - the population from which solutions are selected
      Returns:
      an array of length arity of solutions selected from the specified population
    • binaryTournament

      public static Solution binaryTournament(Solution solution1, Solution solution2, DominanceComparator comparator)
      Performs binary tournament selection.
      Parameters:
      solution1 - the first solution
      solution2 - the second solution
      comparator - the comparison operator
      Returns:
      the solution that wins the tournament
    • binaryTournament

      public static Solution binaryTournament(Solution solution1, Solution solution2)
      Performs binary tournament selection with Pareto dominance.
      Parameters:
      solution1 - the first solution
      solution2 - the second solution
      Returns:
      the solution that wins the tournament