1#include "GEPChromosomeMutOp.h"
6 myGenotype_->registerParameter(state,
"mut.simple", (voidP)
new double(0), ECF::DOUBLE);
12 voidP sptr =
myGenotype_->getParameterValue(state,
"mut.simple");
21 uint iGene = state_->getRandomizer()->getRandomInteger(0, chr->
genes - 1);
24 uint iPoint = state_->getRandomizer()->getRandomInteger(0, (uint)(chr->
headLength+chr->
tailLength) - 1);
25 std::stringstream logstr;
26 logstr <<
"Mutating node (" << iPoint <<
") in gene [" << iGene <<
"]...";
27 ECF_LOG(state_, 5, logstr.str());
30 chr->at(geneOffset + iPoint)->setPrimitive(iPoint < chr->headLength ? chr->primitiveSet_->getRandomPrimitive() : chr->primitiveSet_->getRandomTerminal());
GEPChromosome class - implements genotype as a Gene Expression Programming chromosome.
uint genes
number of genes
uint tailLength
length of the tail. Automatically calculated.
uint geneLength
total length of each gene
uint headLength
length of the head. User-specified
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.
bool mutate(GenotypeP gene)
Performs mutation of a genotype object. The genotype object must be initialized!
double probability_
probability of usage of this mutation operator
GenotypeP myGenotype_
pointer to the Genotype that defines this MutationOp