1#include "../ECF_base.h" 
    3#include "TreeMutGauss.h" 
    7#include "boost/random/normal_distribution.hpp" 
   15    myGenotype_->registerParameter(state, 
"mut.gauss", (voidP) 
new double(0), ECF::DOUBLE);
 
   21    voidP sptr = 
myGenotype_->getParameterValue(state, 
"mut.gauss");
 
   24    engine_.seed((uint32_t) time(NULL));
 
   38        iNode = state_->getRandomizer()->getRandomInteger((
int) tree->size());
 
   40    } 
while((name = tree->at(iNode)->primitive_->getName()).substr(0, 2) != DBL_PREFIX && tries < 4);
 
   42    if(name.substr(0, 2) != DBL_PREFIX) {
 
   43        ECF_LOG(state_, 5, 
"TreeMutGauss not successful.");
 
   48    PrimitiveP oldPrim = tree->at(iNode)->primitive_;
 
   49    tree->at(iNode)->primitive_->getValue(&oldValue);
 
   50    std::string oldName = tree->at(iNode)->primitive_->getName();
 
   54    boost::normal_distribution<double> N(0, 1);
 
   60    double offset = N.operator () <boost::lagged_fibonacci607>(engine_);
 
   61    double newValue = oldValue + offset;
 
   68    newName = DBL_PREFIX + newName;
 
   70    oldPrim->setName(newName);
 
   71    oldPrim->setValue(&newValue);
 
   75    std::stringstream log;
 
   76    log << 
"TreeMutGauss successful (oldNode = " << oldName << 
", newNode = " << newName << 
")";
 
   77    ECF_LOG(state_, 5, log.str());
 
double probability_
probability of usage of this mutation operator
 
GenotypeP myGenotype_
pointer to the Genotype that defines this MutationOp
 
Tree class - implements genotype as a tree.
 
bool mutate(GenotypeP gene)
Performs mutation of a genotype object. The genotype object must be initialized!
 
bool initialize(StateP)
Initialize mutation operator. Called before first mutation operation.
 
void registerParameters(StateP)
Register parameters with the system. Called before MutationOp::initialize.