1#include "../ECF_base.h"
2#include "FloatingPoint.h"
10 myGenotype_->registerParameter(state,
"crx.onepoint", (voidP)
new double(0), ECF::DOUBLE);
16 voidP sptr =
myGenotype_->getParameterValue(state,
"crx.onepoint");
28 uint dimensionCrs = state_->getRandomizer()->getRandomInteger((
int) p1->realValue.size());
29 switch (state_->getRandomizer()->getRandomInteger(0, 1)) {
30 case 0:
for (uint i = 0; i < dimensionCrs; i++) {
31 ch->realValue[i] = p1->realValue[i];
33 for (uint i = dimensionCrs; i < p2->realValue.size(); i++) {
34 ch->realValue[i] = p2->realValue[i];
37 case 1:
for (uint i = 0; i < dimensionCrs; i++) {
38 ch->realValue[i] = p2->realValue[i];
40 for (uint i = dimensionCrs; i < p1->realValue.size(); i++) {
41 ch->realValue[i] = p1->realValue[i];
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.
FloatingPoint class - implements genotype as a vector of floating point values.