Package ec.spatial

Class 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:
  • 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:
    • 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:
    • P_TYPE

      public static final String P_TYPE
      Selection procedure.
      See Also:
    • V_UNIFORM

      public static final String V_UNIFORM
      See Also:
    • V_RANDOM_WALK

      public static final String V_RANDOM_WALK
      See Also:
    • TYPE_UNIFORM

      public static final int TYPE_UNIFORM
      See Also:
    • TYPE_RANDOM_WALK

      public static final int TYPE_RANDOM_WALK
      See Also:
  • 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:
    • 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