1#include "../ECF_base.h" 
    3#include "TreeMutNodeComplement.h" 
   12    myGenotype_->registerParameter(state, 
"mut.nodecomplement", (voidP) 
new double(0), ECF::DOUBLE);
 
   18    voidP sptr = 
myGenotype_->getParameterValue(state, 
"mut.nodecomplement");
 
   31    std::string name, complementName;
 
   32    PrimitiveP complement;
 
   34        index = state_->getRandomizer()->getRandomInteger((
int) tree->size());
 
   35        name = tree->at(index)->primitive_->getName();
 
   36        complementName = tree->at(index)->primitive_->getComplementName();
 
   38        complement = tree->primitiveSet_->getPrimitiveByName(complementName);
 
   40    } 
while(complement == PrimitiveP() && tries < 4);
 
   42    if(complement == PrimitiveP()) {
 
   43        ECF_LOG(state_, 5, 
"TreeMutNodeComplement not successful.");
 
   47    tree->at(index)->setPrimitive(complement);
 
   49    std::stringstream log;
 
   50    log << 
"TreeMutNodeComplement successful (oldNode = " << name << 
", ";
 
   51    log << 
"newNode = " << complementName << 
")";
 
   52    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.
 
void registerParameters(StateP)
Register parameters with the system. Called before MutationOp::initialize.
 
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.