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(p1->getNumBits());
29 for (uint dimension = 0; dimension < p1->variables.size(); dimension++) {
30 switch (state_->getRandomizer()->getRandomInteger(0, 1)) {
31 case 0:
for (uint i = 0; i < bitCrs; i++) {
32 ch->variables[dimension][i] = p1->variables[dimension][i];
34 for (uint i = bitCrs; i < p2->getNumBits(); i++) {
35 ch->variables[dimension][i] = p2->variables[dimension][i];
38 case 1:
for (uint i = 0; i < bitCrs; i++) {
39 ch->variables[dimension][i] = p2->variables[dimension][i];
41 for (uint i = bitCrs; i < p1->getNumBits(); i++) {
42 ch->variables[dimension][i] = p1->variables[dimension][i];
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.
Binary class - implements genotype as a vector of binary coded real values with variable interval and...
double probability_
probability of usage of this crossover operator
GenotypeP myGenotype_
pointer to the Genotype that defines this CrossoverOp