Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.commons.math.genetics
Class TournamentSelection

    java.lang.Object
      org.apache.commons.math.genetics.TournamentSelection

All Implemented Interfaces:
  SelectionPolicy

    public class TournamentSelection

extends Object
implements SelectionPolicy

Tournament selection scheme. Each of the two selected chromosomes is selected based on n-ary tournament -- this is done by drawing `arity` random chromosomes without replacement from the population, and then selecting the fittest chromosome among them.

Since:
  2.0
Version:
  $Revision: 811685 $ $Date: 2009-09-05 19:36:48 +0200 (sam. 05 sept. 2009) $

Constructor Summary
`TournamentSelection(int arity)` Creates a new TournamentSelection instance.

Method Summary
`int` | `getArity()` Gets the arity (number of chromosomes drawn to the tournament).
`ChromosomePair` | `select(Population population)` Select two chromosomes from the population.
`void` | `setArity(int arity)` Sets the arity (number of chromosomes drawn to the tournament).

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### TournamentSelection

    public TournamentSelection(int arity)

  Creates a new TournamentSelection instance.

  Parameters:
    `arity` - how many chromosomes will be drawn to the tournament

Method Detail

### select

    public ChromosomePair select(Population population)

  Select two chromosomes from the population. Each of the two selected chromosomes is selected based on n-ary tournament -- this is done by drawing `arity` random chromosomes without replacement from the population, and then selecting the fittest chromosome among them.

  Specified by:
    `select` in interface `SelectionPolicy`
  Parameters:
    `population` - the population from which the chromosomes are choosen.
  Returns:
    the selected chromosomes.

### getArity

    public int getArity()

  Gets the arity (number of chromosomes drawn to the tournament).

  Returns:
    arity of the tournament

### setArity

    public void setArity(int arity)

  Sets the arity (number of chromosomes drawn to the tournament).

  Parameters:
    `arity` - arity of the tournament

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2003-2011 The Apache Software Foundation. All Rights Reserved.