evSOLve.JEvolution
Class RealChromosome

java.lang.Object
  |
  +--evSOLve.JEvolution.Chromosome
        |
        +--evSOLve.JEvolution.RealChromosome
All Implemented Interfaces:
java.lang.Cloneable, java.io.Serializable

public class RealChromosome
extends Chromosome

Real number encoding with Evolution Strategy flavor. The bases (object parameters) are implemented as a Vector of Doubles with initial values ranging from 'lowReal' to 'highReal'. Mutation is implemented adding a random number drawn from a normal distribution N(0, sigma). There are two options for `sigma' (strategy parameter). Either there is a single standard deviation for all real bases, or a specific 'sigma' for each real base. The value(s) of `sigma' are mutated as well (self-adaptation). Recombination is a simple discrete scheme, selecting a base from either parent with probability 0.5 (uniform crossover).

Version:
0.4
Author:
Helmut A. Mayer
See Also:
Serialized Form

Field Summary
protected  double highReal
          The largest real number for initialization.
protected  double lowReal
          The lowest real number for initialization.
protected  java.util.Vector objectBases
          The genetic information carrier for the object parameters.
protected  boolean singleSigma
          The first parameter for mutation of strategy parameters.
protected  java.util.Vector 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.
 
Fields inherited from class evSOLve.JEvolution.Chromosome
BIASED, crossoverPoints, crossoverRate, JA, LAPLACE, length, mutationRate, soupType, utils
 
Constructor Summary
RealChromosome()
          Creates a chromosome with 'lenght' bases, and default values for 'lowReal' (0.0) and 'highReal' (1.0), and 'mutationRate' (0.05).
 
Method Summary
 java.lang.Object clone()
          A proper clone, cloning the bases deeply by creating new objects.
protected  void doCrossover(Chromosome father)
          Discrete recombination of two random parents.
protected  void doMutation()
          Mutate by adding normal noise with single or specific standard deviation (strategy parameters).
 boolean equals(java.lang.Object o)
          An efficient check for equality.
 java.lang.Object getBases()
          Return the genetic code for object parameters.
 double getHighReal()
          Gives upper bound of initial real values.
 double getLowReal()
          Gives lower bound of initial real values.
 boolean getStrategy()
          Gives strategy type.
 java.lang.Object getStrategyBases()
          Return the genetic code for strategy parameters.
 int hashCode()
          An efficient hash code.
 void setHighReal(double highReal)
          Changes upper bound of initial real values.
 void setLowReal(double lowReal)
          Changes lower bound of initial real values.
 void setStrategy(boolean singleSigma)
          Changes number of strategy parameters.
 java.lang.String toString()
          Convert chromosome (object parameters) to string.
 
Methods inherited from class evSOLve.JEvolution.Chromosome
getCrossoverPoints, getCrossoverRate, getLength, getMutationRate, getSoupType, setCrossoverPoints, setCrossoverRate, setLength, setMutationRate, setSoupType
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

objectBases

protected java.util.Vector objectBases
The genetic information carrier for the object parameters.

strategyBases

protected java.util.Vector strategyBases
The genetic information carrier for the strategy parameters.

lowReal

protected double lowReal
The lowest real number for initialization.

highReal

protected double highReal
The largest real number for initialization.

singleSigma

protected boolean singleSigma
The first parameter for mutation of strategy parameters.

tauPrime

protected double tauPrime
The first parameter for mutation of strategy parameters.

tau

protected double tau
The second parameter for mutation of strategy parameters.
Constructor Detail

RealChromosome

public RealChromosome()
Creates a chromosome with 'lenght' bases, and default values for 'lowReal' (0.0) and 'highReal' (1.0), and 'mutationRate' (0.05). Here the mutation rate is the initial range of (the) sigma value(s). This percentage value is applied to the object parameter range to generate the initial values for sigma (i.e., if the range 'highReal - lowReal' is 10.0, and 'mutationRate' is set to 0.1, then the initial sigma values are uniformly drawn from [0.0, 1.0].
Method Detail

clone

public java.lang.Object clone()
A proper clone, cloning the bases deeply by creating new objects.
Overrides:
clone in class Chromosome

equals

public boolean equals(java.lang.Object o)
An efficient check for equality. It only checks the bases, first, if the number of bases is equal, and then if the base values (object and strategy parameters) are the same.
Overrides:
equals in class Chromosome

hashCode

public int hashCode()
An efficient hash code. Uses Vector.hashCode(). It just uses the object bases for hashing, however, use of the fitness repository does not seem to make any sense, as no single real chromosome will be the same as any other.
Overrides:
hashCode in class Chromosome

doMutation

protected void doMutation()
Mutate by adding normal noise with single or specific standard deviation (strategy parameters). First, the strategy parameter(s) are mutated as [sigma_i,new = sigma_i,old * exp(tau'N(0, 1) + tau N_i(0, 1))] (where N(0, 1) is the same for all i). Then the object parameters are mutated as [o_i,new = o_i,old + N(0, sigma_i,new)]. [tau = 1/sqrt(2 * sqrt(n))], [tau' = 1/sqrt(2n)]
Overrides:
doMutation in class Chromosome

doCrossover

protected void doCrossover(Chromosome father)
Discrete recombination of two random parents. Obeying the crossover rate object parameters are exchanged with p = 0.5. In GA terms this is Uniform Crossover.
Overrides:
doCrossover in class Chromosome
Parameters:
father - A parent Chromosome.

getLowReal

public double getLowReal()
Gives lower bound of initial real values.

setLowReal

public void setLowReal(double lowReal)
Changes lower bound of initial real values.
Parameters:
lowReal - lower bound

getHighReal

public double getHighReal()
Gives upper bound of initial real values.

setHighReal

public void setHighReal(double highReal)
Changes upper bound of initial real values.
Parameters:
highReal - upper bound

setStrategy

public void setStrategy(boolean singleSigma)
Changes number of strategy parameters.
Parameters:
singleSigma - single (true) sigma or for each object parameter (false)

getStrategy

public boolean getStrategy()
Gives strategy type.

getBases

public java.lang.Object getBases()
Return the genetic code for object parameters.

getStrategyBases

public java.lang.Object getStrategyBases()
Return the genetic code for strategy parameters.

toString

public java.lang.String toString()
Convert chromosome (object parameters) to string. The first base (the leftmost) has index 0.
Overrides:
toString in class Chromosome