public class RealChromosome extends Chromosome
| Modifier and Type | Field and Description |
|---|---|
static int |
EACH
Object parameters are mutated with a strategy parameter (sigma) for each object parameter.
|
protected double |
high
The largest real number for initialization.
|
protected double |
low
The lowest real number for initialization.
|
static int |
NONE
Object parameters are mutated with a constant mutation rate.
|
protected java.util.List<java.lang.Double> |
objectBases
The genetic information carrier for the object parameters.
|
static int |
SINGLE
Object parameters are mutated with a single strategy parameter (sigma).
|
protected int |
strategy
The type of self-adaptation strategy.
|
protected java.util.List<java.lang.Double> |
strategyBases
The genetic information carrier for the strategy parameters.
|
protected double |
tau
The second parameter for mutation of strategy parameters.
|
protected double |
tauPrime
The first parameter for mutation of strategy parameters.
|
BIASED, crossoverPoints, crossoverRate, LAPLACE, length, mutationRate, soupType| Constructor and Description |
|---|
RealChromosome()
Creates a default chromosome.
|
RealChromosome(Element c)
Creates a RealChromosome via XML.
|
RealChromosome(int length)
Constructs a chromosome of given length and default values
for 'low' (0.0) and 'high' (1.0), and 'mutationRate' (0.05).
|
| 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)
Discrete recombination of two random parents.
|
void |
doMutation()
Mutate by adding normal noise with constant, single, or specific standard deviation (strategy parameters).
|
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 code for object parameters.
|
double |
getHigh()
Gives upper bound of initial real values.
|
double |
getLow()
Gives lower bound of initial real values.
|
int |
getStrategy()
Gives strategy type.
|
java.lang.Object |
getStrategyBases()
Return the genetic code for strategy parameters.
|
int |
hashCode()
An efficient hash code.
|
void |
mixSoup()
Initial creation of the alleles.
|
void |
setHigh(double high)
Changes upper bound of initial real values.
|
void |
setLow(double low)
Changes lower bound of initial real values.
|
void |
setStrategy(int strategy)
Changes number of strategy parameters.
|
java.lang.String |
toString()
Convert chromosome (object parameters) to string.
|
Element |
toXml(Element parent)
Saves the current state to XML.
|
create, getCrossoverPoints, getCrossoverRate, getLength, getMutationRate, getSoupType, setCrossoverPoints, setCrossoverRate, setLength, setMutationRate, setSoupTypepublic static final int NONE
public static final int SINGLE
public static final int EACH
protected java.util.List<java.lang.Double> objectBases
protected int strategy
protected java.util.List<java.lang.Double> strategyBases
protected double low
protected double high
protected double tauPrime
protected double tau
public RealChromosome()
public RealChromosome(int length)
length - the number of basespublic RealChromosome(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 double getLow()
public void setLow(double low)
low - lower boundpublic double getHigh()
public void setHigh(double high)
high - upper boundpublic void setStrategy(int strategy)
strategy - NONE, SINGLE, or EACH object parameter is controlled by a strategy basepublic int getStrategy()
public java.lang.Object getBases()
getBases in class Chromosomepublic java.lang.Object getStrategyBases()
public java.lang.String toString()
toString in class Chromosomepublic void fromString(java.lang.String b)
fromString in class Chromosomeb - a String describing the object basespublic Element toXml(Element parent)
toXml in class Chromosomeparent - the JDOM parent element