All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class evolution.PoolImpl

java.lang.Object
   |
   +----evolution.PoolImpl

public class PoolImpl
extends Object
implements Pool
The only core evolution classes PoolImpl knows about are GeneticFactory and Individual. In particular, PoolImpl is unaware of the existence of Genomes.


Variable Index

 o currGen
The number of the current generation
 o data
My population
 o fac
My GeneticFactory.
 o fitness
My FitnessList
 o kill
 o newIndex
 o newIndiv
 o numParents
The number of individuals needed to produce a child.
 o parents
 o sorter
My SortingAlgorithm
 o state
My state.
 o STATE_BREEDING
 o STATE_COMPUTING
 o STATE_IDLE
 o STATE_SORTING
 o theListener
Some object that wants to be informed about progress of evolution.

Constructor Index

 o PoolImpl(int, GeneticFactory, EvolutionListener)
Create a new population of the given size, with evolution determined by the given GeneticFactory, and install the given EvolutionListener.

Method Index

 o changeState(int)
Change the state and inform theListener that my state has changed.
 o chooseParent(int)
Choose a parent and put it into parents.
 o evolve(EvolutionParm)
Create a new generation.
 o evolve(int, EvolutionParm)
Breed a given number of new generations.
 o getBestIndividual()
 o getBestValue()
 o getCurrentGeneration()
 o getIndividual(int)
 o getPopulation()
Return the whole population.
 o getState()
 o incrementCurrGen()
Increment the generation counter and inform theListener that I have a new generation.

Variables

 o STATE_IDLE
 public static final int STATE_IDLE
 o STATE_SORTING
 public static final int STATE_SORTING
 o STATE_BREEDING
 public static final int STATE_BREEDING
 o STATE_COMPUTING
 public static final int STATE_COMPUTING
 o data
 protected Array data
My population

 o sorter
 protected SortingAlgorithm sorter
My SortingAlgorithm

 o fitness
 protected FitnessList fitness
My FitnessList

 o fac
 protected GeneticFactory fac
My GeneticFactory.

 o numParents
 protected int numParents
The number of individuals needed to produce a child.

 o theListener
 protected EvolutionListener theListener
Some object that wants to be informed about progress of evolution.

 o currGen
 protected volatile int currGen
The number of the current generation

 o state
 protected volatile int state
My state. Is one of STATE_IDLE, STATE_COMPUTING, STATE_BREEDING, STATE_SORTING.

 o parents
 protected Individual parents[]
 o kill
 protected boolean kill[]
 o newIndiv
 protected Individual newIndiv[]
 o newIndex
 protected int newIndex[]

Constructors

 o PoolImpl
 public PoolImpl(int size,
                 GeneticFactory f,
                 EvolutionListener master) throws EvolutionException
Create a new population of the given size, with evolution determined by the given GeneticFactory, and install the given EvolutionListener.

Parameters:
master - may be nil

Methods

 o changeState
 protected void changeState(int s)
Change the state and inform theListener that my state has changed.

Parameters:
s - my new state
 o incrementCurrGen
 protected void incrementCurrGen()
Increment the generation counter and inform theListener that I have a new generation.

 o evolve
 protected void evolve(EvolutionParm parm) throws EvolutionException
Create a new generation.

Parameters:
parm - the evolution parameters to be used
Throws: EvolutionException
if something goes wrong
 o evolve
 public void evolve(int n,
                    EvolutionParm parm) throws EvolutionException
Breed a given number of new generations.

Parameters:
n - the number of generations to breed
parm - the evolution parameters to be used
Throws: EvolutionException
if something goes wrong
 o getCurrentGeneration
 public int getCurrentGeneration()
Returns:
the number of the current generation
 o getBestValue
 public float getBestValue()
Returns:
the maximum of my individual's values.
 o getBestIndividual
 public Individual getBestIndividual()
Returns:
the fittest individual
 o getState
 public int getState()
Returns:
my current state
 o chooseParent
 protected void chooseParent(int j)
Choose a parent and put it into parents.

Parameters:
j - the number of parents already chosen, this is needed to avoid duplicate parents
 o getPopulation
 public Vector getPopulation()
Return the whole population.

Returns:
a java.util.Vector of all my Individuals
 o getIndividual
 public Individual getIndividual(int n)
Returns:
the n-th Individual of my population.
Throws: IndexOutOfBoundsException
or something like that if n is bad.

All Packages  Class Hierarchy  This Package  Previous  Next  Index