1#include "../ECF_base.h"
10 myGenotype_->registerParameter(state,
"mut.simple", (voidP)
new double(0), ECF::DOUBLE);
11 myGenotype_->registerParameter(state,
"mut.simple.bitprob", (voidP)
new double(0.001), ECF::DOUBLE);
17 voidP sptr =
myGenotype_->getParameterValue(state,
"mut.simple");
20 sptr =
myGenotype_->getParameterValue(state,
"mut.simple.bitprob");
21 bitProb_ = *((
double*)sptr.get());
24 if(
myGenotype_->isParameterDefined(state,
"mut.simple.bitprob"))
37 for(uint i = 0; i < bin->variables.size(); i++)
38 for(uint j = 0; j < bin->getNumBits(); j++)
39 if(state_->getRandomizer()->getRandomDouble() < bitProb_)
40 bin->variables[i][j] = !(bin->variables[i][j]);
44 uint iBit = state_->getRandomizer()->getRandomInteger((uint) bin->getNumBits());
45 uint dimension = state_->getRandomizer()->getRandomInteger((uint) bin->variables.size());
46 bin->variables[dimension][iBit] = !(bin->variables[dimension][iBit]);
Binary class - implements genotype as a vector of binary coded real values with variable interval and...
bool initialize(StateP)
Initialize mutation operator. Called before first mutation operation.
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!
double probability_
probability of usage of this mutation operator
GenotypeP myGenotype_
pointer to the Genotype that defines this MutationOp