Package smile.gap

Interface Chromosome<T extends Chromosome<T>>

All Superinterfaces:
Comparable<Chromosome<T>>
All Known Subinterfaces:
LamarckianChromosome<T>
All Known Implementing Classes:
BitString

public interface Chromosome<T extends Chromosome<T>> extends Comparable<Chromosome<T>>
Artificial chromosomes in genetic algorithm/programming encoding candidate solutions to an optimization problem. Note that chromosomes have to implement Comparable interface to support comparison of their fitness.
  • Method Summary

    Modifier and Type
    Method
    Description
    T[]
    crossover(T other)
    Returns a pair of offsprings by crossovering this one with another one according to the crossover rate, which determines how often will be crossover performed.
    double
    Returns the fitness of chromosome.
    void
    For genetic algorithms, this method mutates the chromosome randomly.
    Returns a new random instance.

    Methods inherited from interface java.lang.Comparable

    compareTo
  • Method Details

    • fitness

      double fitness()
      Returns the fitness of chromosome.
      Returns:
      the fitness of chromosome.
    • newInstance

      T newInstance()
      Returns a new random instance.
      Returns:
      a new random instance.
    • crossover

      T[] crossover(T other)
      Returns a pair of offsprings by crossovering this one with another one according to the crossover rate, which determines how often will be crossover performed. If there is no crossover, offspring is exact copy of parents. Various crossover strategies can be employed.
      Parameters:
      other - the other parent.
      Returns:
      a pair of offsprings.
    • mutate

      void mutate()
      For genetic algorithms, this method mutates the chromosome randomly. The offspring may have no changes since the mutation rate is usually very low. For Lamarckian algorithms, this method actually does the local search such as hill-climbing.