org.encog.ml.ea.opp.selection

## Class TruncationSelection

- java.lang.Object
- - org.encog.ml.ea.opp.selection.TruncationSelection

- All Implemented Interfaces:
    Serializable, SelectionOperator

      public class TruncationSelection
      extends Object
      implements SelectionOperator, Serializable

  Truncation selection chooses a random genome from the top genomes in the population. A percent determines how large this group of top genomes is. http://en.wikipedia.org/wiki/Truncation_selection
  See Also:
    Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `TruncationSelection(EvolutionaryAlgorithm theTrainer, double thePercent)` Construct the truncation selector.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `EvolutionaryAlgorithm` | `getTrainer()`
    `int` | `performAntiSelection(Random rnd, Species species)` Selects an unfit genome.
    `int` | `performSelection(Random rnd, Species species)` Selects an fit genome.

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

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

- - ### Constructor Detail

    - #### TruncationSelection

          public TruncationSelection(EvolutionaryAlgorithm theTrainer,
                             double thePercent)

      Construct the truncation selector.
      Parameters:
        `theTrainer` - The trainer.
        `thePercent` - The top percent to select from.

  - ### Method Detail

    - #### performSelection

          public int performSelection(Random rnd,
                             Species species)

      Selects an fit genome.
      Specified by:
        `performSelection` in interface `SelectionOperator`
      Parameters:
        `rnd` - A random number generator.
        `species` - The species to select the genome from.
      Returns:
        The selected genome.

    - #### performAntiSelection

          public int performAntiSelection(Random rnd,
                                 Species species)

      Selects an unfit genome.
      Specified by:
        `performAntiSelection` in interface `SelectionOperator`
      Parameters:
        `rnd` - A random number generator.
        `species` - The species to select the genome from.
      Returns:
        The selected genome.

    - #### getTrainer

          public EvolutionaryAlgorithm getTrainer()

      Specified by:
        `getTrainer` in interface `SelectionOperator`
      Returns:
        The trainer being used.

Copyright © 2014. All Rights Reserved.