evSOLve.JEvolution
Class TournamentSelection

java.lang.Object
  |
  +--evSOLve.JEvolution.TournamentSelection
All Implemented Interfaces:
Selection

public class TournamentSelection
extends java.lang.Object
implements Selection

Tournament Selection draws a number of Individuals randomly from the Population and conducts a tournament between the Individuals in the group where only the winner survives. Each Individual takes part in 'tournamentSize' tournaments which ensures that the size of the offspring Population is identical to the size of the parent Population. Before each new round of tournaments Indiviudals are shuffled within the Population so as to vary the participants in a specific tournament. In each round of tournaments each Individual takes part in exactly one tournament.

Version:
0.4
Author:
Helmut A. Mayer

Constructor Summary
TournamentSelection()
          Default constructor for binary tournament selection.
TournamentSelection(int tournamentSize)
          Constructor for tournament selection with a given tournament size.
 
Method Summary
 void doSelect(Population parents, Population 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.

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(Population parents,
                     Population 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 Population under pressure
offspring - the Population of survivors