public class Population
extends java.lang.Object
copyChromosome() is used to create copies of chromosomes,
though it is also possible to create a new instance of population
directly from a seed chromosome using the right constructor.
getRandomChromosome(), which is guaranteed to use the
experiment's specified seed. If an entirely random population
is needed, reinitialise() should be used to randomise
all chromosomes without creating a new instance of Population.| Constructor and Description |
|---|
Population(Chromosome parent,
Resources resources)
Initialise a population of copies of the given chromosome.
|
Population(Resources resources)
Initialise a random population according to the parameters specified
in the resources.
|
| Modifier and Type | Method and Description |
|---|---|
void |
copyChromosome(int source,
int target)
Copy a chromosome into a different position.
|
Chromosome |
get(int index)
Returns the indexed chromosome.
|
Chromosome |
getRandomChromosome() |
void |
reinitialise()
Loop through all chromosomes and randomise all connections
and functions.
|
void |
sort()
Sorts the population in ascending order of fitness quality.
|
public Population(Resources resources)
resources - the experiment's resources.public Population(Chromosome parent, Resources resources)
parent - the chromosome to use as a model.resources - a reference to the experiment's resources.public Chromosome get(int index)
index - the chromosome to return.public Chromosome getRandomChromosome()
public void copyChromosome(int source,
int target)
source - the chromosome to copy from.target - the chromosome to copy to.public void reinitialise()
public void sort()