ec.spatial
Class SpatialTournamentSelection

java.lang.Object
  extended by ec.BreedingSource
      extended by ec.SelectionMethod
          extended by ec.select.TournamentSelection
              extended by ec.spatial.SpatialTournamentSelection
All Implemented Interfaces:
Prototype, Setup, SteadyStateBSourceForm, RandomChoiceChooser, java.io.Serializable, java.lang.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 method selects one from the neighbors of a specific individual (as indicated by its index in the subpopulation).

Parameters

base.size
int >= 1 or 1.0 < float < 2.0
(the tournament size)
base.pick-worst
bool = true or false (default)
(should we pick the worst individual in the tournament instead of the best?)
Further parameters may be found in ec.select.TournamentSelection.

Default Base
spatial.tournament

Version:
1.0
Author:
Liviu Panait
See Also:
Serialized Form

Field Summary
static java.lang.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 java.lang.String P_N_SIZE
          The size of the neighborhood from where parents are selected.
 
Fields inherited from class ec.select.TournamentSelection
DEFAULT_SIZE, P_PICKWORST, P_SIZE, P_TOURNAMENT, pickWorst, probabilityOfSelection, size
 
Fields inherited from class ec.SelectionMethod
INDS_PRODUCED
 
Fields inherited from class ec.BreedingSource
CHECKBOUNDARY, DEFAULT_PRODUCED, NO_PROBABILITY, P_PROB, probability, UNUSED
 
Constructor Summary
SpatialTournamentSelection()
           
 
Method Summary
 Parameter defaultBase()
          Returns the default base for this prototype.
 int produce(int subpopulation, EvolutionState state, int thread)
          An alternative form of "produce" special to Selection Methods; selects an individual from the given subpopulation and returns its position in that subpopulation.
 int produce(int min, int max, int start, int subpopulation, Individual[] inds, EvolutionState state, int thread)
          Produces n individuals from the given subpopulation and puts them into inds[start...start+n-1], where n = Min(Max(q,min),max), where q is the "typical" number of individuals the BreedingSource produces in one shot, and returns n.
 void setup(EvolutionState state, Parameter base)
          Sets up the BreedingPipeline.
 
Methods inherited from class ec.select.TournamentSelection
individualReplaced, sourcesAreProperForm
 
Methods inherited from class ec.SelectionMethod
finishProducing, preparePipeline, prepareToProduce, produces, typicalIndsProduced
 
Methods inherited from class ec.BreedingSource
clone, getProbability, pickRandom, setProbability, setupProbabilities
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

P_N_SIZE

public static final java.lang.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 java.lang.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
Constructor Detail

SpatialTournamentSelection

public SpatialTournamentSelection()
Method Detail

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

produce

public int produce(int subpopulation,
                   EvolutionState state,
                   int thread)
Description copied from class: SelectionMethod
An alternative form of "produce" special to Selection Methods; selects an individual from the given subpopulation and returns its position in that subpopulation.

Overrides:
produce in class TournamentSelection

produce

public int produce(int min,
                   int max,
                   int start,
                   int subpopulation,
                   Individual[] inds,
                   EvolutionState state,
                   int thread)
Description copied from class: BreedingSource
Produces n individuals from the given subpopulation and puts them into inds[start...start+n-1], where n = Min(Max(q,min),max), where q is the "typical" number of individuals the BreedingSource produces in one shot, and returns n. max must be >= min, and min must be >= 1. For example, crossover might typically produce two individuals, tournament selection might typically produce a single individual, etc.

Overrides:
produce in class TournamentSelection