1#include "../ECF_base.h"
3#include "TreeCrxUniform.h"
11 myGenotype_->registerParameter(state,
"crx.uniform", (voidP)
new double(0), ECF::DOUBLE);
17 voidP sptr =
myGenotype_->getParameterValue(state,
"crx.uniform");
31 mRange = (uint) male->size();
32 fRange = (uint) female->size();
36 child->maxDepth_ = male->maxDepth_;
37 child->minDepth_ = male->minDepth_;
38 child->startDepth_ = male->startDepth_;
40 for( uint iMale = 0, iFemale = 0, iChild=0; iMale < mRange && iFemale < fRange; ) {
43 uint pickMale = state_->getRandomizer()->getRandomInteger(0 , 1);
45 if( male->at( iMale )->primitive_->getNumberOfArguments() == female->at( iFemale )->primitive_->getNumberOfArguments() ) {
48 NodeP
node =
static_cast<NodeP
> (
new Node( male->at( iMale )->primitive_));
49 child->push_back(
node );
50 child->at( iChild )->depth_ = male->at( iMale )->depth_;
53 NodeP
node =
static_cast<NodeP
> (
new Node( female->at( iFemale )->primitive_));
54 child->push_back(
node );
55 child->at( iChild )->depth_ = female->at( iFemale )->depth_;
57 iMale++; iFemale++; iChild++;
62 for( uint i = 0; i < male->at( iMale )->size_; i++, iChild++ ) {
63 NodeP
node =
static_cast<NodeP
> (
new Node( male->at( iMale + i )->primitive_));
64 child->push_back(
node );
65 child->at( iChild )->depth_ = male->at( iMale + i )->depth_;
69 for( uint i = 0; i < female->at( iFemale )->size_; i++, iChild++ ) {
70 NodeP
node =
static_cast<NodeP
> (
new Node( female->at( iFemale + i )->primitive_));
71 child->push_back(
node );
72 child->at( iChild )->depth_ = female->at( iFemale + i )->depth_;
76 iMale += male->at( iMale )->size_;
77 iFemale += female->at( iFemale )->size_;
double probability_
probability of usage of this crossover operator
GenotypeP myGenotype_
pointer to the Genotype that defines this CrossoverOp
Node base class (Tree genotype)
Tree class - implements genotype as a tree.