public abstract class Chromosome
extends java.lang.Object
implements java.lang.Cloneable, java.io.Serializable
| Modifier and Type | Field and Description |
|---|---|
static int |
BIASED |
protected int |
crossoverPoints
The number of crossover sites (default = 2).
|
protected double |
crossoverRate
The crossover rate (default = 0.6).
|
static int |
LAPLACE
Initial mode of creation of Chromosome.
|
protected int |
length
The default length of the Chromosome.
|
protected double |
mutationRate
The mutation rate (default = 0.1).
|
protected int |
soupType
Method of generation of start population (default = LAPLACE).
|
| Modifier | Constructor and Description |
|---|---|
protected |
Chromosome(Element c)
Creates a Chromosome via XML.
|
protected |
Chromosome(int length)
Constructs a chromosome of given length.
|
| Modifier and Type | Method and Description |
|---|---|
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.
|
static Chromosome |
create(Element element)
Creates the chromosome designated by an XML element by calling the XML constructor.
|
abstract void |
doCrossover(Chromosome mate)
Crossover.
|
abstract void |
doMutation()
Mutation of Chromosome.
|
abstract boolean |
equals(java.lang.Object o)
This is very important for usage of the fitness repository.
|
abstract void |
fromString(java.lang.String representation)
Constructs the Chromosome from its string representation.
|
abstract java.lang.Object |
getBases()
Returns the genetic information carrier of the Chromosome.
|
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.
|
abstract void |
mixSoup()
Generate initial chromosomes.
|
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()
Returns bases of the Chromosome as String.
|
Element |
toXml(Element parent)
Saves the current state to XML.
|
protected int length
protected double mutationRate
protected double crossoverRate
protected int crossoverPoints
public static final int LAPLACE
public static final int BIASED
protected int soupType
protected Chromosome(int length)
length - the number of basesprotected Chromosome(Element c)
c - an XML Chromosome elementpublic java.lang.Object clone()
clone in class java.lang.Objectpublic abstract boolean equals(java.lang.Object o)
equals in class java.lang.Objectpublic abstract int hashCode()
hashCode in class java.lang.Objectpublic abstract void doMutation()
public abstract void doCrossover(Chromosome mate)
public abstract void mixSoup()
public abstract java.lang.Object getBases()
public abstract java.lang.String toString()
toString in class java.lang.Objectpublic abstract void fromString(java.lang.String representation)
public int getLength()
public void setLength(int length)
throws JEvolutionException
length - The number of bases.JEvolutionException - The chromosome has no length.public double getMutationRate()
public void setMutationRate(double mutationRate)
throws JEvolutionException
mutationRate - The mutation probability.JEvolutionException - No probability value.public double getCrossoverRate()
public void setCrossoverRate(double crossoverRate)
throws JEvolutionException
crossoverRate - The crossover probability.JEvolutionException - No probability value.public int getCrossoverPoints()
public void setCrossoverPoints(int crossoverPoints)
throws JEvolutionException
crossoverPoints - The number of crossover sites.JEvolutionException - Invalid number.public int getSoupType()
public void setSoupType(int soupType)
soupType - How to generate initial Genotype.public Element toXml(Element parent)
parent - the JDOM parent elementpublic static Chromosome create(Element element)
element - an XML element