net.openai.ai.ga.selection.common
Class ArraySelectTournament

java.lang.Object
  |
  +--net.openai.ai.ga.selection.common.ArraySelectTournament
All Implemented Interfaces:
ArraySelectionAlgorithm

public class ArraySelectTournament
extends java.lang.Object
implements ArraySelectionAlgorithm

ArraySelectTournament is a method by which Population members are created and chosen using a tournament on a Population. This algorithm is used for the selection of parents for recombination (reproduction).

Since:
JDK1.3
Version:
%I%, %G%
Author:
Jared Grubb

Constructor Summary
ArraySelectTournament(SelectionAlgorithm[] groupPerParent, int goal)
          Creates a new ArraySelectTournament that creates the specified number of parent sets by choosing a random parent for each parent slot according to each specified selection algorithm.
ArraySelectTournament(SelectionAlgorithm[] groupPerParent, int goal, Population basePopulation)
          Creates a new ArraySelectTournament that creates the specified number of parent sets by choosing a random parent for each parent slot according to each specified selection algorithm and adds these into the specified base population.
ArraySelectTournament(SelectionAlgorithm[] groupPerParent, int goal, Population basePopulation, PopulationArray basePopulationArray)
          Creates a new ArraySelectTournament that creates the specified number of parent sets by choosing a random parent for each parent slot according to each specified selection algorithm and adds these into the specified base population, which are in turn added into a clone of the base population array.
 
Method Summary
 PopulationArray selectFromPopulation(Population pop)
          Creates a PopulationArray according to a tournament.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ArraySelectTournament

public ArraySelectTournament(SelectionAlgorithm[] groupPerParent,
                             int goal)
Creates a new ArraySelectTournament that creates the specified number of parent sets by choosing a random parent for each parent slot according to each specified selection algorithm. Equilivant to ArraySelectTournament(groupPerParent,goal,new Population()). This creates populations based on the default Population type and collection.

Parameters:
groupPerParent - the SelectionAlgorithm[] that represents a selection algorithm for each parental slot
goal - the number of parent sets to create

ArraySelectTournament

public ArraySelectTournament(SelectionAlgorithm[] groupPerParent,
                             int goal,
                             Population basePopulation)
Creates a new ArraySelectTournament that creates the specified number of parent sets by choosing a random parent for each parent slot according to each specified selection algorithm and adds these into the specified base population. Normally, the base population will be an empty population using a certain collection type. Equilivant to ArraySelectTournament(groupPerParent, goal, basePopulation, new PopulationArray()).

Parameters:
groupPerParent - the SelectionAlgorithm[] that represents a selection algorithm for each parental slot
goal - the number of parent sets to create
basePopulation - the Population that each parent set will be added into

ArraySelectTournament

public ArraySelectTournament(SelectionAlgorithm[] groupPerParent,
                             int goal,
                             Population basePopulation,
                             PopulationArray basePopulationArray)
Creates a new ArraySelectTournament that creates the specified number of parent sets by choosing a random parent for each parent slot according to each specified selection algorithm and adds these into the specified base population, which are in turn added into a clone of the base population array. Normally, the base population and base population array will be empty and implement certain collection types.

Parameters:
groupPerParent - the SelectionAlgorithm[] that represents a selection algorithm for each parental slot
goal - the number of parent sets to create
basePopulation - the Population that each parent set will be added into
basePopulationArray - the PopulationArray that will will be used to hold the parent sets
Method Detail

selectFromPopulation

public PopulationArray selectFromPopulation(Population pop)
Creates a PopulationArray according to a tournament. The base population array is cloned. A parent set (a Population) is created first by cloning the base population specified in the constructor. Then, a member is chosen at random from each of the selection algorithms specified in the constructor. Each selection algorithm is queried only once and the results are used for every parent set.

For example, suppose the selection algorithms returned the following populations: {1,2,3},{3,5,7}, and {5,6,7,8,9,10}. The base population is the default, an empty new Population(). Then the following is a possible output for a goal of 5 parent sets:

Specified by:
selectFromPopulation in interface ArraySelectionAlgorithm
Parameters:
pop - the Population to choose from
Returns:
a PopulationArray derived from the passed Population


Copyright - 2001 OpenAI Labs. All Rights Reserved.