1#include "../ECF_base.h"
2#include "FloatingPoint.h"
10 myGenotype_->registerParameter(state,
"crx.blx", (voidP)
new double(0), ECF::DOUBLE);
11 myGenotype_->registerParameter(state,
"crx.blx.alpha", (voidP)
new double(0.5), ECF::DOUBLE);
17 voidP sptr =
myGenotype_->getParameterValue(state,
"crx.blx");
21 if(
myGenotype_->isParameterDefined(state,
"crx.blx.alpha"))
24 sptr =
myGenotype_->getParameterValue(state,
"crx.blx.alpha");
25 alpha = *((
double*)sptr.get());
37 double min1, max1, min2, max2, min, max, a, b, I;
39 min1 = p1->realValue[0];
40 max1 = p1->realValue[0];
41 min2 = p2->realValue[0];
42 max2 = p2->realValue[0];
43 for (uint i = 1; i < p1->realValue.size(); i++) {
44 if (p1->realValue[i] < min1)
45 min1 = p1->realValue[i];
46 if (p1->realValue[i] > max1)
47 max1 = p1->realValue[i];
49 if (p2->realValue[i] < min2)
50 min2 = p2->realValue[i];
51 if (p2->realValue[i] > max2)
52 max2 = p2->realValue[i];
54 min = (min1 < min2)?min1:min2;
55 max = (max1 > max2)?max1:max2;
59 b = state_->getRandomizer()->getRandomDouble();
63 for (uint i = 0; i < p1->realValue.size(); i++) {
64 a = state_->getRandomizer()->getRandomDouble();
65 a = min + a*(max-min);
double probability_
probability of usage of this crossover operator
GenotypeP myGenotype_
pointer to the Genotype that defines this CrossoverOp
bool initialize(StateP)
Initialize crossover operator. Called before first crossover operation.
void registerParameters(StateP)
Register parameters with the system. Called before CrossoverOp::initialize.
bool mate(GenotypeP gen1, GenotypeP gen2, GenotypeP child)
FloatingPoint class - implements genotype as a vector of floating point values.