1#include "GEPChromosomeMutOp.h" 
    2namespace GEPChromosome{
 
    5        myGenotype_->registerParameter(state, 
"mut.simple", (voidP) 
new double(0), ECF::DOUBLE);
 
   11        voidP sptr = 
myGenotype_->getParameterValue(state, 
"mut.simple");
 
   20        uint iGene = state_->getRandomizer()->getRandomInteger(0, chr->genes - 1);
 
   21        uint geneOffset = iGene * chr->geneLength;
 
   23        uint iPoint = state_->getRandomizer()->getRandomInteger(0, (uint)(chr->headLength+chr->tailLength) - 1);
 
   24        std::stringstream logstr;
 
   25        logstr << 
"Mutating node (" << iPoint << 
") in gene [" << iGene << 
"]...";
 
   26        ECF_LOG(state_, 5, logstr.str());
 
   29        chr->at(geneOffset + iPoint)->setPrimitive(iPoint < chr->headLength ? chr->primitiveSet_->getRandomPrimitive() : chr->primitiveSet_->getRandomTerminal());
 
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!
 
void registerParameters(StateP state)
Register parameters with the system. Called before MutationOp::initialize.
 
bool initialize(StateP state)
Initialize mutation operator. Called before first mutation operation.
 
double probability_
probability of usage of this mutation operator
 
GenotypeP myGenotype_
pointer to the Genotype that defines this MutationOp