Package ec.spatial

# Class SpatialTournamentSelection

java.lang.Object
ec.BreedingSource
ec.SelectionMethod
ec.select.TournamentSelection
ec.spatial.SpatialTournamentSelection

All Implemented Interfaces:
  `Prototype`, `Setup`, `SteadyStateBSourceForm`, `RandomChoiceChooserD`, `Serializable`, `Cloneable`

public class SpatialTournamentSelection extends TournamentSelection
A slight modification of the tournament selection procedure for use with spatially-embedded EAs. When selecting an individual, the SpatialTournamentSelection is told a specific individual. It then picks N individuals at random which are within a certain distance (the neighborhood size) of that individual. These individuals then enter a tournament a-la standard Tournament Selection.

The method of picking individuals is either `uniform` (picking individuals using the Space interface's getRandomIndividual(...)) or `random-walk` (wandering distance steps at random). You can also stipulate whether the original individual must be in the tournament.

Parameters

base.`neighborhood-size` int >= 1 | (the neighborhood size)
base.`ind-competes` bool = `true` or `false` (default) | (Do we include the base individual in the tournament?)
base.`type` String: uniform (default) or random-walk | Method for selecting individuals in neighborhood

Further parameters may be found in ec.select.TournamentSelection.

Default Base
spatial.tournament

See Also:
  - Serialized Form

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final String`
  `P_IND_COMPETES`
  Some models assume an individual is always selected to compete for breeding a child that would take its location in space.
  `static final String`
  `P_N_SIZE`
  The size of the neighborhood from where parents are selected.
  `static final String`
  `P_TYPE`
  Selection procedure.
  `static final int`
  `TYPE_RANDOM_WALK`
  `static final int`
  `TYPE_UNIFORM`
  `static final String`
  `V_RANDOM_WALK`
  `static final String`
  `V_UNIFORM`

  ### Fields inherited from class ec.select.TournamentSelection

  `P_PICKWORST, P_SIZE, P_TOURNAMENT, pickWorst, probabilityOfPickingSizePlusOne, size`

  ### Fields inherited from class ec.SelectionMethod

  `INDS_PRODUCED, KEY_PARENTS`

  ### Fields inherited from class ec.BreedingSource

  `NO_PROBABILITY, P_PROB, probability`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `SpatialTournamentSelection()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `Parameter`
  `defaultBase()`
  Returns the default base for this prototype.
  `int`
  `getRandomIndividual(int number, int subpopulation, EvolutionState state, int thread)`
  Produces the index of a (typically uniformly distributed) randomly chosen individual to fill the tournament.
  `void`
  `setup(EvolutionState state, Parameter base)`
  Sets up the BreedingPipeline.

  ### Methods inherited from class ec.select.TournamentSelection

  `betterThan, getTournamentSizeToUse, individualReplaced, produce, sourcesAreProperForm`

  ### Methods inherited from class ec.SelectionMethod

  `finishProducing, prepareToProduce, produce, produces, produceWithoutCloning, typicalIndsProduced`

  ### Methods inherited from class ec.BreedingSource

  `clone, fillStubs, getProbability, pickRandom, preparePipeline, setProbability, setupProbabilities`

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

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

- ## Field Details

  - ### P_N_SIZE

    public static final String P_N_SIZE
    The size of the neighborhood from where parents are selected. Small neighborhood sizes enforce a local selection pressure, while larger values for this parameters allow further-away individuals to compete for breeding as well.
    See Also:
      - Constant Field Values

  - ### P_IND_COMPETES

    public static final String P_IND_COMPETES
    Some models assume an individual is always selected to compete for breeding a child that would take its location in space. Other models don't make this assumption. This parameter allows one to specify whether an individual will be selected to compete with others for breeding a child that will take its location in space. If the parameter value is not specified, it is assumed to be false by default.
    See Also:
      - Constant Field Values

  - ### P_TYPE

    public static final String P_TYPE
    Selection procedure.
    See Also:
      - Constant Field Values

  - ### V_UNIFORM

    public static final String V_UNIFORM
    See Also:
      - Constant Field Values

  - ### V_RANDOM_WALK

    public static final String V_RANDOM_WALK
    See Also:
      - Constant Field Values

  - ### TYPE_UNIFORM

    public static final int TYPE_UNIFORM
    See Also:
      - Constant Field Values

  - ### TYPE_RANDOM_WALK

    public static final int TYPE_RANDOM_WALK
    See Also:
      - Constant Field Values

- ## Constructor Details

  - ### SpatialTournamentSelection

    public SpatialTournamentSelection()

- ## Method Details

  - ### setup

    public void setup(EvolutionState state, Parameter base)
    Description copied from class: `BreedingSource`
    Sets up the BreedingPipeline. You can use state.output.error here because the top-level caller promises to call exitIfErrors() after calling setup. Note that probability might get modified again by an external source if it doesn't normalize right.

    The most common modification is to normalize it with some other set of probabilities, then set all of them up in increasing summation; this allows the use of the fast static BreedingSource-picking utility method, BreedingSource.pickRandom(...). In order to use this method, for example, if four breeding source probabilities are {0.3, 0.2, 0.1, 0.4}, then they should get normalized and summed by the outside owners as: {0.3, 0.5, 0.6, 1.0}.

    Specified by:
      `setup` in interface `Prototype`
    Specified by:
      `setup` in interface `Setup`
    Overrides:
      `setup` in class `TournamentSelection`
    See Also:
      - `Prototype.setup(EvolutionState,Parameter)`

  - ### defaultBase

    public Parameter defaultBase()
    Description copied from interface: `Prototype`
    Returns the default base for this prototype. This should generally be implemented by building off of the static base() method on the DefaultsForm object for the prototype's package. This should be callable during setup(...).
    Specified by:
      `defaultBase` in interface `Prototype`
    Overrides:
      `defaultBase` in class `TournamentSelection`

  - ### getRandomIndividual

    public int getRandomIndividual(int number, int subpopulation, EvolutionState state, int thread)
    Description copied from class: `TournamentSelection`
    Produces the index of a (typically uniformly distributed) randomly chosen individual to fill the tournament. numberinvalid input: '<'/> is the position of the individual in the tournament.
    Overrides:
      `getRandomIndividual` in class `TournamentSelection`