1#include "../ECF_base.h"
9 myGenotype_->registerParameter(state,
"mut.simple", (voidP)
new double(0), ECF::DOUBLE);
10 myGenotype_->registerParameter(state,
"mut.simple.bitprob", (voidP)
new double(0.001), ECF::DOUBLE);
16 voidP sptr =
myGenotype_->getParameterValue(state,
"mut.simple");
19 sptr =
myGenotype_->getParameterValue(state,
"mut.simple.bitprob");
23 if(
myGenotype_->isParameterDefined(state,
"mut.simple.bitprob"))
36 for(uint i = 0; i < bitstr->bits.size(); i++)
37 if(state_->getRandomizer()->getRandomDouble() <
bitProb_)
38 bitstr->bits[i] = !bitstr->bits[i];
42 uint iBit = state_->getRandomizer()->getRandomInteger(0, (
int) bitstr->bits.size() - 1);
43 bitstr->bits[iBit] = !(bitstr->bits[iBit]);
BitString class - implements genotype as a series of bits.
bool bUseBitProb_
are we using bit mutation probabiltiy (instead of individual probability)
double bitProb_
probability of single bit mutation
bool mutate(GenotypeP gene)
Performs mutation of a genotype object. The genotype object must be initialized!
void registerParameters(StateP)
Register parameters with the system. Called before MutationOp::initialize.
bool initialize(StateP)
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