|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object
|
+--org.artoflife.gp.Population
|
+--org.artoflife.gp.population.GenerationalPopulation
A Population that breeds
new Individuals
into the main population to replace dead ones.
A breeding cycle looks like:
The culling strategy is implemented in concrete subclasses,
but this base class implements a breeding strategy based on
selection using a Selector defined
by makeSelector() which can be overridden.
| Field Summary | |
protected static java.util.Comparator |
FITNESS_COMPARATOR
Shared instance. |
protected java.lang.Class |
individualClass
|
protected int |
populationSize
|
protected java.lang.Class |
selectorClass
|
| Fields inherited from class org.artoflife.gp.Population |
individuals |
| Constructor Summary | |
GenerationalPopulation(int populationSize,
java.lang.Class individualClass,
java.util.SortedMap reproducers)
|
|
| Method Summary | |
protected void |
breed()
Override to implement breeding policy, returning the population size to the getIdealPopulationSize(). |
int |
getIdealPopulationSize()
Can be overriden. |
protected Selector |
makeSelector()
Create a new Selector. |
Individual |
newIndividual()
Create a new Individual. |
void |
setIdealPopulationSize(int idealSize)
|
void |
setSelectorClass(java.lang.Class selectorClass)
|
| Methods inherited from class org.artoflife.gp.Population |
addIndividual, addNewIndividuals, addPopulationListener, breedNewIndividual, cullOneWeakest, cullWeakest, firePopulationEvent, getIndividuals, getReproducers, newGeneration, removeIndividual, removePopulationListener |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected static final java.util.Comparator FITNESS_COMPARATOR
protected java.lang.Class selectorClass
protected int populationSize
protected java.lang.Class individualClass
| Constructor Detail |
public GenerationalPopulation(int populationSize,
java.lang.Class individualClass,
java.util.SortedMap reproducers)
populationSize - how many Individuals in this fixed size population?
Must be > 2individualClass - Class of individuals to create as initial population.
Must be non-nullreproducers - to use when breeding new generation. See
Configuration.getInstancesProbabilities(String)| Method Detail |
public void setSelectorClass(java.lang.Class selectorClass)
protected void breed()
PopulationPopulation.getIdealPopulationSize(). For example you could fill a
nursery by mating strongest Individuals in Population then move strongest
from nursery into main population. This is called after Population.cullWeakest() on each new generation.
breed in class PopulationPopulation.breed()protected Selector makeSelector()
setSelectorClass(Class)public int getIdealPopulationSize()
getIdealPopulationSize in class PopulationPopulation.newGeneration().public void setIdealPopulationSize(int idealSize)
setIdealPopulationSize in class PopulationidealSize - the number of Individuals that the population aims to
maintain in Population.newGeneration().public Individual newIndividual()
newIndividual in class Population
|
artoflife pre0.1.0-dev | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||