public class IntChromosome extends Chromosome
| Modifier and Type | Field and Description |
|---|---|
protected java.util.List<java.lang.Integer> |
bases
The genetic information carrier.
|
protected int |
high
The largest integer encoded.
|
protected int |
low
The lowest integer encoded.
|
BIASED, crossoverPoints, crossoverRate, LAPLACE, length, mutationRate, soupType| Constructor and Description |
|---|
IntChromosome()
Creates a chromosome with default length.
|
IntChromosome(Element c)
Creates an IntChromosome via XML.
|
IntChromosome(int length)
Constructs a chromosome of given length.
|
| Modifier and Type | Method and Description |
|---|---|
java.lang.Object |
clone()
A proper clone, cloning the bases deeply by creating new objects.
|
void |
doCrossover(Chromosome father)
Standard 1-, or 2-Point Crossover.
|
void |
doMutation()
Mutate by randomly setting a base to a new integer value
within 'low' and 'high' (both included).
|
boolean |
equals(java.lang.Object o)
An efficient check for equality.
|
void |
fromString(java.lang.String b)
Create bases from String.
|
java.lang.Object |
getBases()
Return the genetic information.
|
int |
getHigh()
Gives higher bound of integer encoding.
|
int |
getLow()
Gives lower bound of integer encoding.
|
int |
hashCode()
An efficient hash code.
|
void |
mixSoup()
Initial creation of alleles.
|
void |
setHigh(int high)
Changes higher bound of integer encoding.
|
void |
setLow(int low)
Changes lower bound of integer encoding.
|
java.lang.String |
toString()
Convert chromosome to string.
|
Element |
toXml(Element parent)
Saves the current state to XML.
|
create, getCrossoverPoints, getCrossoverRate, getLength, getMutationRate, getSoupType, setCrossoverPoints, setCrossoverRate, setLength, setMutationRate, setSoupTypeprotected java.util.List<java.lang.Integer> bases
protected int low
protected int high
public IntChromosome()
public IntChromosome(int length)
length - the number of basespublic IntChromosome(Element c)
c - an XML Chromosome elementpublic java.lang.Object clone()
clone in class Chromosomepublic boolean equals(java.lang.Object o)
equals in class Chromosomepublic int hashCode()
hashCode in class Chromosomepublic void doMutation()
doMutation in class Chromosomepublic void doCrossover(Chromosome father)
doCrossover in class Chromosomefather - A parent Chromosome.public void mixSoup()
mixSoup in class Chromosomepublic int getLow()
public void setLow(int low)
low - the smallest integer encodedpublic int getHigh()
public void setHigh(int high)
high - the largest integer encodedpublic java.lang.Object getBases()
getBases in class Chromosomepublic java.lang.String toString()
toString in class Chromosomepublic void fromString(java.lang.String b)
fromString in class Chromosomeb - a String describing the basespublic Element toXml(Element parent)
toXml in class Chromosomeparent - the JDOM parent element