Package org.jppf.ga

Interface Chromosome

All Superinterfaces:
Comparable<Chromosome>, Serializable
All Known Implementing Classes:
AbstractChromosome

public interface Chromosome extends Comparable<Chromosome>, Serializable
Interface for a chromosome.
Author:
Laurent Cohen
  • Method Summary

    Modifier and Type
    Method
    Description
    double
    Compute the fitness of this chromosome.
    crossover(Chromosome mate, int position)
    Perform the crossover of this chromosome with one of its mates.
    double
    Get the fitness of this chromosome.
    Get the genes of this chromosome.
    int
    Get the number of genes.
    boolean
     
    Perform the mutation of this chromosome.
    void
    setFitness(double fitness)
    Set the fitness of this chromosome.

    Methods inherited from interface java.lang.Comparable

    compareTo
  • Method Details

    • getSize

      int getSize()
      Get the number of genes.
      Returns:
      the number of genes as an int.
    • getGenes

      Gene[] getGenes()
      Get the genes of this chromosome.
      Returns:
      an array of Gene instances.
    • getFitness

      double getFitness()
      Get the fitness of this chromosome.
      Returns:
      the fitness as a double value.
    • setFitness

      void setFitness(double fitness)
      Set the fitness of this chromosome.
      Parameters:
      fitness - the fitness as a double value.
    • computeFitness

      double computeFitness()
      Compute the fitness of this chromosome.
      Returns:
      the fitness as a double value.
    • mutate

      Chromosome mutate()
      Perform the mutation of this chromosome.
      Returns:
      the mutated chromosome.
    • crossover

      Chromosome crossover(Chromosome mate, int position)
      Perform the crossover of this chromosome with one of its mates.
      Parameters:
      mate - the chromosome to crossover with.
      position - determines where the crossover should occur in the gene sequence.
      Returns:
      an array of 2 descendants.
    • isValid

      boolean isValid()
      Returns:
      whether this chromosome is valid.