|
JGAP | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.jgap.Population
public class Population
List of chromosomes held in the Genotype (or possibly later in the Configuration object).
| Constructor Summary | |
|---|---|
Population()
|
|
Population(Configuration a_config)
|
|
Population(Configuration a_config,
IChromosome[] a_chromosomes)
|
|
Population(Configuration a_config,
int a_size)
|
|
| Method Summary | |
|---|---|
void |
addChromosome(IChromosome a_toAdd)
Adds a Chromosome to this Population. |
void |
addChromosomes(Population a_population)
Adds all the Chromosomes in the given Population. |
int |
compareTo(java.lang.Object a_pop)
This method is not producing symmetric results as -1 is more often returned than 1 (see description of return value). |
boolean |
contains(IChromosome a_chromosome)
Determines whether the given chromosome is contained within the population. |
IChromosome |
determineFittestChromosome()
Determines the fittest Chromosome in the population (the one with the highest fitness value) and memorizes it. |
IChromosome |
determineFittestChromosome(int a_startIndex,
int a_endIndex)
Determines the fittest Chromosome in the population (the one with the highest fitness value) within the given indices and memorizes it. |
java.util.List |
determineFittestChromosomes(int a_numberOfChromosomes)
Sorts the Chromosome list and returns the fittest n Chromosomes in the population. |
boolean |
equals(java.lang.Object a_pop)
The equals-method. |
IChromosome |
getChromosome(int a_index)
Returns a Chromosome at given index in the Population. |
java.util.List |
getChromosomes()
|
Configuration |
getConfiguration()
|
java.util.List |
getGenome(boolean a_resolveCompositeGenes)
Returns the genotype of the population, i.e. the list of genes in the population. |
boolean |
isChanged()
|
boolean |
isSorted()
|
java.util.Iterator |
iterator()
|
protected void |
setChanged(boolean a_changed)
Mark that for the population the fittest chromosome may have changed. |
void |
setChromosome(int a_index,
IChromosome a_chromosome)
Sets in the given Chromosome on the given index in the list of chromosomes. |
void |
setChromosomes(java.util.List a_chromosomes)
Replaces all chromosomes in the population with the give list of chromosomes. |
protected void |
setSorted(boolean a_sorted)
Mark the population as sorted. |
int |
size()
|
protected void |
sort(java.util.Comparator a_comparator)
Sorts the chromosomes within the population utilzing the given comparator. |
void |
sortByFitness()
Sorts the chromosomes within the population according to their fitness value using ChromosomFitnessComparator. |
IChromosome[] |
toChromosomes()
|
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Population(Configuration a_config)
throws InvalidConfigurationException
InvalidConfigurationException
public Population(Configuration a_config,
IChromosome[] a_chromosomes)
throws InvalidConfigurationException
InvalidConfigurationException
public Population(Configuration a_config,
int a_size)
throws InvalidConfigurationException
InvalidConfigurationException
public Population()
throws InvalidConfigurationException
InvalidConfigurationException| Method Detail |
|---|
public Configuration getConfiguration()
public void addChromosome(IChromosome a_toAdd)
a_toAdd - the Chromosome to addpublic void addChromosomes(Population a_population)
a_population - the Population to addpublic void setChromosomes(java.util.List a_chromosomes)
a_chromosomes - the chromosomes to make the population up from
public void setChromosome(int a_index,
IChromosome a_chromosome)
a_index - the index to set the Chromosome ina_chromosome - the Chromosome to be setpublic java.util.List getChromosomes()
public IChromosome getChromosome(int a_index)
a_index - the index of the Chromosome to be returned
public int size()
public java.util.Iterator iterator()
public IChromosome[] toChromosomes()
public IChromosome determineFittestChromosome()
public IChromosome determineFittestChromosome(int a_startIndex,
int a_endIndex)
a_startIndex - index to begin the evaluation witha_endIndex - index to end the evaluation with
protected void setChanged(boolean a_changed)
a_changed - true: population's fittest chromosome may have changed,
false: fittest chromosome evaluated earlier is still validpublic boolean isChanged()
protected void setSorted(boolean a_sorted)
a_sorted - true: mark population as sortedpublic boolean contains(IChromosome a_chromosome)
a_chromosome - the chromosome to check
public java.util.List determineFittestChromosomes(int a_numberOfChromosomes)
a_numberOfChromosomes - number of top performer chromosomes to be
returned
public void sortByFitness()
protected void sort(java.util.Comparator a_comparator)
a_comparator - the comparator to utilize for sortingpublic java.util.List getGenome(boolean a_resolveCompositeGenes)
a_resolveCompositeGenes - true: split encountered CompositeGenes
into their single (atomic) genes
public boolean isSorted()
public boolean equals(java.lang.Object a_pop)
equals in class java.lang.Objecta_pop - the population instance to compare with
public int compareTo(java.lang.Object a_pop)
a_pop - the other population to compare
|
JGAP | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||