1#include "../ECF_base.h"
2#include "Permutation.h"
10 myGenotype_->registerParameter(state,
"mut.inv", (voidP)
new double(0), ECF::DOUBLE);
16 voidP sptr =
myGenotype_->getParameterValue(state,
"mut.inv");
27 int ind1 = state_->getRandomizer()->getRandomInteger(perm->getSize() - 1);
28 int ind2 = state_->getRandomizer()->getRandomInteger(ind1, (
int) perm->getSize() - 1);
29 int temp = perm->variables[ind2];
30 int distance = ind2 -ind1 + 1;
32 for(
int i = 0; i < distance / 2; i++) {
33 temp = perm->variables[ind1 + i];
34 perm->variables[ind1 + i] = perm->variables[ind2 - i];
35 perm->variables[ind2 - i] = temp;
double probability_
probability of usage of this mutation operator
GenotypeP myGenotype_
pointer to the Genotype that defines this MutationOp
Permutation class - implements genotype as a vector of indices 0..(n-1) (permutation of indices)
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!