Interface Chromosome<T>

All Superinterfaces:
Comparable<Chromosome<T>>
All Known Implementing Classes:
RealChromosome

public interface Chromosome<T> extends Comparable<Chromosome<T>>
Represents a single candidate solution in the genetic algorithm.
Since:
1.0
Author:
Silvere Martin-Michiellot, Gemini AI (Google DeepMind)
  • Method Details

    • getGenes

      List<T> getGenes()
      Gets the sequence of genes.
      Returns:
      an unmodifiable list of genes
    • getFitness

      double getFitness()
      Calculates the fitness of this chromosome. Higher fitness is better.
      Returns:
      the fitness score
    • crossover

      List<Chromosome<T>> crossover(Chromosome<T> other)
      Creates a new chromosome by crossing over with another.
      Parameters:
      other - the partner chromosome
      Returns:
      a pair of new chromosomes (offspring)
    • mutate

      Chromosome<T> mutate(double probability)
      Mutates this chromosome.
      Parameters:
      probability - chance of mutation per gene
      Returns:
      a new mutated chromosome
    • compareTo

      default int compareTo(Chromosome<T> other)
      Specified by:
      compareTo in interface Comparable<T>