TournamentSelection (JEvolution)
Date: 2013-03-21

evSOLve.JEvolution.selection

## Class TournamentSelection

- java.lang.Object
- - evSOLve.JEvolution.selection.TournamentSelection

- All Implemented Interfaces:
    Selection

      public class TournamentSelection
      extends java.lang.Object
      implements Selection

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `TournamentSelection()` Default constructor for binary tournament selection.
    `TournamentSelection(int tournamentSize)` Constructor for tournament selection with a given tournament size.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `doSelect(SubPopulation parents, SubPopulation offspring)` JEvolution native and default (binary tournaments) selection method.
    `int` | `getTournamentSize()` Gives the tournament size tournament size.
    `void` | `setTournamentSize(int tournamentSize)` Sets tournament size.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### TournamentSelection

          public TournamentSelection()

      Default constructor for binary tournament selection.

    - #### TournamentSelection

          public TournamentSelection(int tournamentSize)

      Constructor for tournament selection with a given tournament size.
      Parameters:
        `tournamentSize` - number of Individuals in a single tournament

  - ### Method Detail

    - #### getTournamentSize

          public int getTournamentSize()

      Gives the tournament size tournament size.
      Returns:
        tournamentSize number of Individuals in a single tournament

    - #### setTournamentSize

          public void setTournamentSize(int tournamentSize)
                                 throws JEvolutionException

      Sets tournament size.
      Parameters:
        `tournamentSize` - number of Individuals in a single tournament
      Throws:
        `JEvolutionException` - if size < 2

    - #### doSelect

          public void doSelect(SubPopulation parents,
                      SubPopulation offspring)

      JEvolution native and default (binary tournaments) selection method. Works for arbitrary tournament and population sizes.
      Specified by:
        `doSelect` in interface `Selection`
      Parameters:
        `parents` - the SubPopulation under pressure
        `offspring` - the SubPopulation of survivors