net.openai.ai.ga.world
Class World

java.lang.Object
  |
  +--net.openai.ai.ga.world.World
All Implemented Interfaces:
java.io.Serializable

public class World
extends java.lang.Object
implements java.io.Serializable

World contains all the information necessary to simulate a complete genetic algorithm implementation. This includes:

One iteration performs the following operations:

Since:
JDK1.3
Version:
%I%, %G%
Author:
Jared Grubb
See Also:
Serialized Form

Constructor Summary
World(java.lang.String name)
          Reset generation count and create an empty Population and no selection algorithms.
World(java.lang.String name, ArraySelectionAlgorithm parentSelection, SelectionAlgorithm mutationSelection, SelectionAlgorithm survivalSelection)
          Reset generation count and create an empty population and specified selection algorithms.
World(java.lang.String name, Population initialPopulation)
          Reset generation count, use the specified Population, and initialize no selection algorithms.
World(java.lang.String name, Population initialPopulation, ArraySelectionAlgorithm parentSelection, SelectionAlgorithm mutationSelection, SelectionAlgorithm survivalSelection)
          Reset generation count and create an empty population and specified selection algorithms.
 
Method Summary
 Environment getEnvironment()
          Returns the Environment assigned to this World.
 SelectionAlgorithm getMutationSelectionAlgorithm()
          Returns the current mutation selection algorithm.
 java.lang.String getName()
          Returns the name of this World.
 ArraySelectionAlgorithm getParentSelectionAlgorithm()
          Returns the current parent selection algorithm.
 Population getPopulation()
          Returns the Population assigned to this World.
 SelectionAlgorithm getSurvivalSelectionAlgorithm()
          Returns the current survival selection algorithm.
 void iterate()
          Iterates this World through one generation.
 void setEnvironment(Environment newEnvironment)
          Sets the Environment used in this World.
 void setMutationSelectionAlgorithm(SelectionAlgorithm mutationSelection)
          Sets the mutation selection algorithm to the given algorithm.
 void setParentSelectionAlgorithm(ArraySelectionAlgorithm parentSelection)
          Sets the parent selection algorithm to the given algorithm.
 void setPopulation(Population newPopulation)
          Sets the Population used in this World.
 void setSurvivalSelectionAlgorithm(SelectionAlgorithm survivalSelection)
          Sets the survival selection algorithm to the given algorithm.
 java.lang.String toString()
          Returns a string showing the current status of this World.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

World

public World(java.lang.String name)
Reset generation count and create an empty Population and no selection algorithms. Gives the world a name.

Parameters:
name - a String for the name of this World

World

public World(java.lang.String name,
             Population initialPopulation)
Reset generation count, use the specified Population, and initialize no selection algorithms.

Parameters:
name - a String for the name of this World
initialPopulation - the inital Population for this World

World

public World(java.lang.String name,
             ArraySelectionAlgorithm parentSelection,
             SelectionAlgorithm mutationSelection,
             SelectionAlgorithm survivalSelection)
Reset generation count and create an empty population and specified selection algorithms. Gives the world a name. Assign

Parameters:
name - a String for the name of this World
parentSelection - an ArraySelectionAlgorithm to be used for parent selection.
mutationSelection - a SelectionAlgorithm to be used for mutation selection.
survivalSelection - a SelectionAlgorithm to be used for survival selection.

World

public World(java.lang.String name,
             Population initialPopulation,
             ArraySelectionAlgorithm parentSelection,
             SelectionAlgorithm mutationSelection,
             SelectionAlgorithm survivalSelection)
Reset generation count and create an empty population and specified selection algorithms. Gives the world a name. Assign

Parameters:
name - a String for the name of this World
initialPopulation - the inital Population for this World
parentSelection - an ArraySelectionAlgorithm to be used for parent selection.
mutationSelection - a SelectionAlgorithm to be used for mutation selection.
survivalSelection - a SelectionAlgorithm to be used for survival selection.
Method Detail

getName

public java.lang.String getName()
Returns the name of this World.

Returns:
a String containing the name of this World

toString

public java.lang.String toString()
Returns a string showing the current status of this World. Returns the name of the World followed by the String returned by the Population's toString().

Overrides:
toString in class java.lang.Object
Returns:
a String showing the status of this World

getEnvironment

public Environment getEnvironment()
Returns the Environment assigned to this World.

Returns:
the Environment assigned to this World

setEnvironment

public void setEnvironment(Environment newEnvironment)
Sets the Environment used in this World.

Parameters:
newEnvironment - the Environment to use in this World

getPopulation

public Population getPopulation()
Returns the Population assigned to this World.

Returns:
the Population assigned to this World

setPopulation

public void setPopulation(Population newPopulation)
Sets the Population used in this World.

Parameters:
newPopulation - the Population to use in this World

iterate

public void iterate()
Iterates this World through one generation. Does the following items:


setParentSelectionAlgorithm

public void setParentSelectionAlgorithm(ArraySelectionAlgorithm parentSelection)
Sets the parent selection algorithm to the given algorithm. This algorithm is used to determine the groups of cells that will be used to create offspring.

Parameters:
parentSelection - a ArraySelectionAlgorithm to set to

getParentSelectionAlgorithm

public ArraySelectionAlgorithm getParentSelectionAlgorithm()
Returns the current parent selection algorithm.

Returns:
the parent-selection ArraySelectionAlgorithm

setMutationSelectionAlgorithm

public void setMutationSelectionAlgorithm(SelectionAlgorithm mutationSelection)
Sets the mutation selection algorithm to the given algorithm. This algorithm is used to determine the cells that will subjected to mutation.

Parameters:
mutationSelection - a SelectionAlgorithm to set to

getMutationSelectionAlgorithm

public SelectionAlgorithm getMutationSelectionAlgorithm()
Returns the current mutation selection algorithm. This algorithm is used to determine the cells that will subjected to mutation.

Returns:
the mutation-selection SelectionAlgorithm

setSurvivalSelectionAlgorithm

public void setSurvivalSelectionAlgorithm(SelectionAlgorithm survivalSelection)
Sets the survival selection algorithm to the given algorithm. This algorithm is used to determine the cells that will survive into the next generation.

Parameters:
survivalSelection - a SelectionAlgorithm to set to

getSurvivalSelectionAlgorithm

public SelectionAlgorithm getSurvivalSelectionAlgorithm()
Returns the current survival selection algorithm. This algorithm is used to determine the cells that will survive into the next generation.

Returns:
the mutation-selection SelectionAlgorithm


Copyright - 2001 OpenAI Labs. All Rights Reserved.