|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.commons.math3.genetics.Chromosome
public abstract class Chromosome
Individual in a population. Chromosomes are compared based on their fitness.
The chromosomes are IMMUTABLE, and so their fitness is also immutable and therefore it can be cached.
Constructor Summary | |
---|---|
Chromosome()
|
Method Summary | |
---|---|
int |
compareTo(Chromosome another)
Compares two chromosomes based on their fitness. |
protected Chromosome |
findSameChromosome(Population population)
Searches the population for another chromosome with the same representation. |
double |
getFitness()
Access the fitness of this chromosome. |
protected boolean |
isSame(Chromosome another)
Returns true iff another has the same representation and therefore the same fitness. |
void |
searchForFitnessUpdate(Population population)
Searches the population for a chromosome representing the same solution, and if it finds one, updates the fitness to its value. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.apache.commons.math3.genetics.Fitness |
---|
fitness |
Constructor Detail |
---|
public Chromosome()
Method Detail |
---|
public double getFitness()
Computation of fitness is usually very time-consuming task, therefore the fitness is cached.
public int compareTo(Chromosome another)
compareTo
in interface Comparable<Chromosome>
another
- another chromosome to compare
another
is better than this
another
is worse than this
protected boolean isSame(Chromosome another)
true
iff another
has the same representation and therefore the same fitness. By
default, it returns false -- override it in your implementation if you need it.
another
- chromosome to compare
another
is equivalent to this chromosomeprotected Chromosome findSameChromosome(Population population)
population
for another chromosome with the same representation. If such chromosome is
found, it is returned, if no such chromosome exists, returns null
.
population
- Population to search
null
if no such chromosome exists.public void searchForFitnessUpdate(Population population)
population
- Population to search
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |