evSOLve.JEvolution
Class Chromosome

java.lang.Object
  |
  +--evSOLve.JEvolution.Chromosome
All Implemented Interfaces:
java.lang.Cloneable, java.io.Serializable
Direct Known Subclasses:
BitChromosome, IntChromosome, PermChromosome, RealChromosome

public abstract class Chromosome
extends java.lang.Object
implements java.lang.Cloneable, java.io.Serializable

The Chromosome as part of a Genotype.

Since:
May 03, 2000
Version:
0.4
Author:
Helmut A. Mayer
See Also:
Serialized Form

Field Summary
static int BIASED
           
protected  int crossoverPoints
          The default number of crossover sites.
protected  double crossoverRate
          The default crossover rate.
protected static JEvolution JA
          The link to JEvolution parameters.
static int LAPLACE
          Initial mode of creation of Chromosome.
protected  int length
          The default length of the Chromosome.
protected  double mutationRate
          The default mutation rate.
protected  int soupType
          Method of generation of start population.
protected static evSOLve.JEvolution.Utilities utils
          Useful stuff.
 
Constructor Summary
Chromosome()
           
 
Method Summary
 java.lang.Object clone()
          The Chromosome's clone, which has to be done properly, i.e., all objects representing the chromosome should be replicated exactly.
protected abstract  void doCrossover(Chromosome mate)
          Crossover.
protected abstract  void doMutation()
          Mutation of Chromosome.
abstract  boolean equals(java.lang.Object o)
          This is very important for usage of the fitness repository.
 int getCrossoverPoints()
          Access crossover points.
 double getCrossoverRate()
          Access crossover rate.
 int getLength()
          Return length of the Chromosome.
 double getMutationRate()
          Access mutation rate.
 int getSoupType()
          Access soup type.
abstract  int hashCode()
          The Chromosome's hash code.
 void setCrossoverPoints(int crossoverPoints)
          Change crossover points.
 void setCrossoverRate(double crossoverRate)
          Change crossover rate.
 void setLength(int length)
          Change Chromosome length.
 void setMutationRate(double mutationRate)
          Change mutation rate.
 void setSoupType(int soupType)
          Change soup type.
abstract  java.lang.String toString()
          Convert Chromosome to String.
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

JA

protected static JEvolution JA
The link to JEvolution parameters.

length

protected int length
The default length of the Chromosome.

mutationRate

protected double mutationRate
The default mutation rate.

crossoverRate

protected double crossoverRate
The default crossover rate.

crossoverPoints

protected int crossoverPoints
The default number of crossover sites.

LAPLACE

public static final int LAPLACE
Initial mode of creation of Chromosome.

BIASED

public static final int BIASED

soupType

protected int soupType
Method of generation of start population.

utils

protected static evSOLve.JEvolution.Utilities utils
Useful stuff.
Constructor Detail

Chromosome

public Chromosome()
Method Detail

clone

public java.lang.Object clone()
The Chromosome's clone, which has to be done properly, i.e., all objects representing the chromosome should be replicated exactly. Specifically, the bases of the Chromosome must be cloned.
Overrides:
clone in class java.lang.Object

equals

public abstract boolean equals(java.lang.Object o)
This is very important for usage of the fitness repository. This method of a specific Chromosome should be as efficient as possible, e.g., if the bases of the Chromosome are implemented as BitSet, then the corresponding equals() method of BitSet should be called. For other Chromosomes it might be beneficial, if a specific, efficient equals() is implemented. Of course, you could also use the inherited equals(), but it will affect performance of the fitness repository, maybe even to the point that it is not used at all.
Overrides:
equals in class java.lang.Object

hashCode

public abstract int hashCode()
The Chromosome's hash code. This is explicitely listed here, as the hashCode() method of a specific Chromosome should be as efficient as possible, e.g., if the bases of the Chromosome are implemented as BitSet, then the corresponding hashCode() method of BitSet should be called. For other Chromosomes it might be beneficial, if a specific, efficient hashCode() is implemented. Of course, you could also use the inherited hashCode(), but it will affect performance of the fitness repository, maybe even to the point that it is not used at all.
Overrides:
hashCode in class java.lang.Object

doMutation

protected abstract void doMutation()
Mutation of Chromosome. Candidate for customizable plug-in.

doCrossover

protected abstract void doCrossover(Chromosome mate)
Crossover. Candidate for customizable plug-in.

toString

public abstract java.lang.String toString()
Convert Chromosome to String.
Overrides:
toString in class java.lang.Object

getLength

public int getLength()
Return length of the Chromosome.

setLength

public void setLength(int length)
               throws JEvolutionException
Change Chromosome length.
Parameters:
length - The number of bases.
Throws:
JEvolutionException - The chromosome has no length.

getMutationRate

public double getMutationRate()
Access mutation rate.

setMutationRate

public void setMutationRate(double mutationRate)
                     throws JEvolutionException
Change mutation rate.
Parameters:
mutationRate - The mutation probability.
Throws:
JEvolutionException - No probability value.

getCrossoverRate

public double getCrossoverRate()
Access crossover rate.

setCrossoverRate

public void setCrossoverRate(double crossoverRate)
                      throws JEvolutionException
Change crossover rate.
Parameters:
crossoverRate - The crossover probability.
Throws:
JEvolutionException - No probability value.

getCrossoverPoints

public int getCrossoverPoints()
Access crossover points.

setCrossoverPoints

public void setCrossoverPoints(int crossoverPoints)
                        throws JEvolutionException
Change crossover points.
Parameters:
crossoverPoints - The number of crossover sites.
Throws:
JEvolutionException - Invalid number.

getSoupType

public int getSoupType()
Access soup type.

setSoupType

public void setSoupType(int soupType)
                 throws JEvolutionException
Change soup type.
Parameters:
soupType - How to generate initial Genotype.
Throws:
JEvolutionException - Bad soup.