1#include "../ECF_base.h"
9 myGenotype_->registerParameter(state,
"crx.onepoint", (voidP)
new double(0), ECF::DOUBLE);
15 voidP sptr =
myGenotype_->getParameterValue(state,
"crx.onepoint");
27 uint bitCrs = state_->getRandomizer()->getRandomInteger(0, (
int) p1->bits.size() - 1);
29 switch (state_->getRandomizer()->getRandomInteger(0, 1)) {
30 case 0:
for (uint i=0; i < bitCrs; i++) {
31 ch->bits[i] = p1->bits.at(i);
33 for (uint i=bitCrs; i < p2->bits.size(); i++) {
34 ch->bits[i] = p2->bits.at(i);
37 case 1:
for (uint i=0; i < bitCrs; i++) {
38 ch->bits[i] = p2->bits.at(i);
40 for (uint i=bitCrs; i < p1->bits.size(); i++) {
41 ch->bits[i] = p1->bits.at(i);
bool mate(GenotypeP gen1, GenotypeP gen2, GenotypeP child)
void registerParameters(StateP)
Register parameters with the system. Called before CrossoverOp::initialize.
bool initialize(StateP)
Initialize crossover operator. Called before first crossover operation.
BitString class - implements genotype as a series of bits.
double probability_
probability of usage of this crossover operator
GenotypeP myGenotype_
pointer to the Genotype that defines this CrossoverOp