1#include "GEPChromosomeMutGauss.h" 
    3namespace GEPChromosome{
 
    6        myGenotype_->registerParameter(state, 
"mut.gauss", (voidP) 
new double(0), ECF::DOUBLE);
 
   11        voidP sptr = 
myGenotype_->getParameterValue(state, 
"mut.gauss");
 
   13        engine_.seed((uint)time(NULL));
 
   19        if (chr->dcLength > 0){
 
   22            uint iGene = state_->getRandomizer()->getRandomInteger(0, chr->genes - 1);
 
   23            uint geneOffset = iGene * chr->geneLength;
 
   24            uint constOffset = geneOffset + chr->headLength + chr->tailLength; 
 
   26            uint iPoint = constOffset + state_->getRandomizer()->getRandomInteger(0, (uint)(chr->dcLength) - 1);
 
   29            Tree::PrimitiveP oldPrim = chr->at(iPoint)->primitive_;
 
   30            chr->at(iPoint)->primitive_->getValue(&oldValue);
 
   31            std::string oldName = chr->at(iPoint)->primitive_->getName();
 
   34            boost::normal_distribution<double> N(0, 1);
 
   35            double offset = N.operator () < boost::lagged_fibonacci607 > (engine_);
 
   36            double newValue = oldValue + offset;
 
   43            newName = DBL_PREFIX + newName;
 
   45            oldPrim->setName(newName);
 
   46            oldPrim->setValue(&newValue);
 
   48            std::stringstream log;
 
   49            log << 
"GEPMutGauss successful (oldNode = " << oldName << 
", newNode = " << newName << 
")";
 
   50            ECF_LOG(state_, 5, log.str());
 
GEPChromosome class - implements genotype as a Gene Expression Programming chromosome.
 
bool mutate(GenotypeP gene)
Performs mutation of a genotype object. The genotype object must be initialized!
 
bool initialize(StateP state)
Initialize mutation operator. Called before first mutation operation.
 
void registerParameters(StateP state)
Register parameters with the system. Called before MutationOp::initialize.
 
double probability_
probability of usage of this mutation operator
 
GenotypeP myGenotype_
pointer to the Genotype that defines this MutationOp