1#include "GEPChromosomeCrsGene.h"
6 myGenotype_->registerParameter(state,
"crx.gene", (voidP)
new double(0), ECF::DOUBLE);
12 voidP sptr =
myGenotype_->getParameterValue(state,
"crx.gene");
24 ECF_LOG(state_, 5,
"Gene crossover failed: chromosome consists of fewer than 2 genes");
29 uint geneCrs = state_->getRandomizer()->getRandomInteger(0, (
int)p1->
genes);
31 ECF_LOG(state_, 5,
"Performing Gene crossover in gene ("+ uint2str(geneCrs) +
")...");
34 switch (state_->getRandomizer()->getRandomInteger(0, 1)) {
36 for (uint i = 0; i <= ch->
genes; i++) {
38 for (uint j = 0; j < jStop; j++){
39 ch->push_back(
static_cast<Tree::NodeP
> (
new Tree::Node(i == geneCrs ? p2->at(i*geneLen + j) : p1->at(i*geneLen + j))));
44 for (uint i = 0; i <= ch->
genes; i++) {
46 for (uint j = 0; j < jStop; j++){
47 ch->push_back(
static_cast<Tree::NodeP
> (
new Tree::Node(i == geneCrs ? p1->at(i*geneLen + j) : p2->at(i*geneLen + j))));
double probability_
probability of usage of this crossover operator
GenotypeP myGenotype_
pointer to the Genotype that defines this CrossoverOp
void registerParameters(StateP)
Register parameters with the system. Called before CrossoverOp::initialize.
bool mate(GenotypeP gen1, GenotypeP gen2, GenotypeP child)
bool initialize(StateP)
Initialize crossover operator. Called before first crossover operation.
GEPChromosome class - implements genotype as a Gene Expression Programming chromosome.
uint genes
number of genes
uint linkTailLength
length of the linking function gene's tail
uint geneLength
total length of each gene
uint linkHeadLength
length of the linking function gene's head
Node base class (Tree genotype).