The chromosomes are IMMUTABLE, and so their fitness is also immutable and therefore it can be cached.
| Modifier and Type | Field and Description |
|---|---|
| private double | fitness
Cached value of the fitness of this chromosome. |
| private static final double | NO_FITNESS
Value assigned when no fitness has been computed yet. |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public int | Returns:
another chromosome to compare another)Implements java. Compares two chromosomes based on their fitness. |
| protected Chromosome | Returns: Chromosome with the same representation, ornull if no such chromosome exists.Population to search population)Searches the |
| public double | |
| protected boolean | Returns: true ifanother is equivalent to this chromosomechromosome to compare another)Returns |
| public void | searchForFitnessUpdate(final Population
Population to search population)Searches the population for a chromosome representing the same solution, and if it finds one, updates the fitness to its value. |
| fitness | back to summary |
|---|---|
| private double fitness Cached value of the fitness of this chromosome. | |
| NO_FITNESS | back to summary |
|---|---|
| private static final double NO_FITNESS Value assigned when no fitness has been computed yet. | |
| Chromosome | back to summary |
|---|---|
| public Chromosome() | |
| compareTo | back to summary |
|---|---|
| public int compareTo(final Chromosome another) Implements java. Compares two chromosomes based on their fitness. The bigger the fitness, the better the chromosome.
| |
| findSameChromosome | back to summary |
|---|---|
| protected Chromosome findSameChromosome(final Population population) Searches the
| |
| getFitness | back to summary |
|---|---|
| public double getFitness() Access the fitness of this chromosome. The bigger the fitness, the better the chromosome. Computation of fitness is usually very time-consuming task, therefore the fitness is cached.
| |
| isSame | back to summary |
|---|---|
| protected boolean isSame(final Chromosome another) Returns
| |
| searchForFitnessUpdate | back to summary |
|---|---|
| public void searchForFitnessUpdate(final Population population) Searches the population for a chromosome representing the same solution, and if it finds one, updates the fitness to its value.
| |