1#include "GEPChromosomeCrsOnePoint.h"
2namespace GEPChromosome{
5 myGenotype_->registerParameter(state,
"crx.onepoint", (voidP)
new double(0), ECF::DOUBLE);
11 voidP sptr =
myGenotype_->getParameterValue(state,
"crx.onepoint");
23 uint bitCrs = state_->getRandomizer()->getRandomInteger(0, (
int)p1->size() - 1);
24 ECF_LOG(state_, 5,
"Performing One-Pt crossover at node (" + uint2str(bitCrs) +
")...");
26 switch (state_->getRandomizer()->getRandomInteger(0, 1)) {
27 case 0:
for (uint i = 0; i < bitCrs; i++) {
28 ch->push_back(
static_cast<Tree::NodeP
> (
new Tree::Node((p1->at(i)))));
30 for (uint i = bitCrs; i < p2->size(); i++) {
31 ch->push_back(
static_cast<Tree::NodeP
> (
new Tree::Node((p2->at(i)))));
34 case 1:
for (uint i = 0; i < bitCrs; i++) {
35 ch->push_back(
static_cast<Tree::NodeP
> (
new Tree::Node((p2->at(i)))));
37 for (uint i = bitCrs; i < p1->size(); i++) {
38 ch->push_back(
static_cast<Tree::NodeP
> (
new Tree::Node((p1->at(i)))));
double probability_
probability of usage of this crossover operator
GenotypeP myGenotype_
pointer to the Genotype that defines this CrossoverOp
bool mate(GenotypeP gen1, GenotypeP gen2, GenotypeP child)
bool initialize(StateP)
Initialize crossover operator. Called before first crossover operation.
void registerParameters(StateP)
Register parameters with the system. Called before CrossoverOp::initialize.
GEPChromosome class - implements genotype as a Gene Expression Programming chromosome.
Node base class (Tree genotype)