ECF 1.5
IntGenotypeMutOp.cpp
1#include <ecf/ECF.h>
2#include <ecf/ECF_base.h>
3#include <cmath>
4#include <sstream>
5#include "IntGenotype.h"
6
7namespace IntGenotype
8{
9
10 bool IntGenotypeMutOp::mutate(GenotypeP gene)
11 {
12 IntGenotype* gen = (IntGenotype*) (gene.get());
13
14
15 int a = state_->getRandomizer()->getRandomInteger(gen->intValues.size());
16 gen->intValues[a] = state_->getRandomizer()->getRandomInteger(gen->getUBound(), gen->getUBound());
17
18
19 return true;
20 }
21
22}
bool mutate(GenotypeP gene)
Performs mutation of a genotype object. The genotype object must be initialized!