1#include "../ECF_base.h"
3#include "TreeMutHoist.h"
12 myGenotype_->registerParameter(state,
"mut.hoist", (voidP)
new double(0), ECF::DOUBLE);
18 voidP sptr =
myGenotype_->getParameterValue(state,
"mut.hoist");
29 Tree* copyTree = tree->copy();
33 uint chosenNode = state_->getRandomizer()->getRandomInteger((
int) copyTree->size());
34 uint chosenNodeSubtreeSize = copyTree->at(chosenNode)->size_;
37 for(uint i = 0; i < chosenNodeSubtreeSize; i++) {
38 NodeP
node =
static_cast<NodeP
> (
new Node(copyTree->at(chosenNode + i)->primitive_));
45 std::stringstream log;
46 log <<
"TreeMutHoist successful (hoisted subtree = ";
47 for(uint i = 0; i < tree->size(); i++)
48 log << tree->at(i)->primitive_->getName() <<
" ";
50 ECF_LOG(state_, 5, log.str());
double probability_
probability of usage of this mutation operator
GenotypeP myGenotype_
pointer to the Genotype that defines this MutationOp
Node base class (Tree genotype)
Tree class - implements genotype as a tree.
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.