Class Chromosome

    • Constructor Detail

      • Chromosome

        public Chromosome()
    • Method Detail

      • getFitness

        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.
        the fitness.
      • compareTo

        public int compareTo​(Chromosome another)
        Compares two chromosomes based on their fitness. The bigger the fitness, the better the chromosome.
        Specified by:
        compareTo in interface Comparable<Chromosome>
        another - another chromosome to compare
        • -1 if another is better than this
        • 1 if another is worse than this
        • 0 if the two chromosomes have the same fitness
      • searchForFitnessUpdate

        public 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.
        population - Population to search