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 Genome
s.
-
currGen
- The number of the current generation
-
data
- My population
-
fac
- My GeneticFactory.
-
fitness
- My FitnessList
-
kill
-
-
newIndex
-
-
newIndiv
-
-
numParents
- The number of individuals needed to produce a child.
-
parents
-
-
sorter
- My SortingAlgorithm
-
state
- My state.
-
STATE_BREEDING
-
-
STATE_COMPUTING
-
-
STATE_IDLE
-
-
STATE_SORTING
-
-
theListener
- Some object that wants to be informed about progress of evolution.
-
PoolImpl(int, GeneticFactory, EvolutionListener)
- Create a new population of the given size, with evolution determined by
the given
GeneticFactory
, and install the given
EvolutionListener
.
-
changeState(int)
- Change the state and inform
theListener
that my state has changed.
-
chooseParent(int)
- Choose a parent and put it into
parents
.
-
evolve(EvolutionParm)
- Create a new generation.
-
evolve(int, EvolutionParm)
- Breed a given number of new generations.
-
getBestIndividual()
-
-
getBestValue()
-
-
getCurrentGeneration()
-
-
getIndividual(int)
-
-
getPopulation()
- Return the whole population.
-
getState()
-
-
incrementCurrGen()
- Increment the generation counter and inform
theListener
that I have a new generation.
STATE_IDLE
public static final int STATE_IDLE
STATE_SORTING
public static final int STATE_SORTING
STATE_BREEDING
public static final int STATE_BREEDING
STATE_COMPUTING
public static final int STATE_COMPUTING
data
protected Array data
- My population
sorter
protected SortingAlgorithm sorter
- My SortingAlgorithm
fitness
protected FitnessList fitness
- My FitnessList
fac
protected GeneticFactory fac
- My GeneticFactory.
numParents
protected int numParents
- The number of individuals needed to produce a child.
theListener
protected EvolutionListener theListener
- Some object that wants to be informed about progress of evolution.
currGen
protected volatile int currGen
- The number of the current generation
state
protected volatile int state
- My state. Is one of
STATE_IDLE
, STATE_COMPUTING
,
STATE_BREEDING
, STATE_SORTING
.
parents
protected Individual parents[]
kill
protected boolean kill[]
newIndiv
protected Individual newIndiv[]
newIndex
protected int newIndex[]
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
changeState
protected void changeState(int s)
- Change the state and inform
theListener
that my state has changed.
- Parameters:
- s - my new state
incrementCurrGen
protected void incrementCurrGen()
- Increment the generation counter and inform
theListener
that I have a new generation.
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
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
getCurrentGeneration
public int getCurrentGeneration()
- Returns:
- the number of the current generation
getBestValue
public float getBestValue()
- Returns:
- the maximum of my individual's values.
getBestIndividual
public Individual getBestIndividual()
- Returns:
- the fittest individual
getState
public int getState()
- Returns:
- my current state
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
getPopulation
public Vector getPopulation()
- Return the whole population.
- Returns:
- a
java.util.Vector
of all my Individual
s
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