Class RealChromosome

java.lang.Object
org.episteme.natural.computing.ai.evolutionary.RealChromosome
All Implemented Interfaces:
Comparable<Chromosome<Real>>, Chromosome<Real>

public class RealChromosome extends Object implements Chromosome<Real>
A chromosome representing a candidate solution as an array of Real numbers.
  • Constructor Details

  • Method Details

    • getGenes

      public List<Real> getGenes()
      Description copied from interface: Chromosome
      Gets the sequence of genes.
      Specified by:
      getGenes in interface Chromosome<Real>
      Returns:
      an unmodifiable list of genes
    • getFitness

      public double getFitness()
      Description copied from interface: Chromosome
      Calculates the fitness of this chromosome. Higher fitness is better.
      Specified by:
      getFitness in interface Chromosome<Real>
      Returns:
      the fitness score
    • crossover

      public List<Chromosome<Real>> crossover(Chromosome<Real> other)
      Description copied from interface: Chromosome
      Creates a new chromosome by crossing over with another.
      Specified by:
      crossover in interface Chromosome<Real>
      Parameters:
      other - the partner chromosome
      Returns:
      a pair of new chromosomes (offspring)
    • mutate

      public Chromosome<Real> mutate(double probability)
      Description copied from interface: Chromosome
      Mutates this chromosome.
      Specified by:
      mutate in interface Chromosome<Real>
      Parameters:
      probability - chance of mutation per gene
      Returns:
      a new mutated chromosome