1#include "../ECF_base.h"
2#include "FloatingPoint.h"
11 myGenotype_->registerParameter(state,
"crx.blxalphabeta", (voidP)
new double(0), ECF::DOUBLE);
12 state->getRegistry()->registerEntry(
"alpha", (voidP)
new double(0.75), ECF::DOUBLE);
13 state->getRegistry()->registerEntry(
"beta", (voidP)
new double(0.25), ECF::DOUBLE);
19 voidP sptr =
myGenotype_->getParameterValue(state,
"crx.blxalphabeta");
22 voidP par = state->getRegistry()->getEntry(
"alpha");
23 alpha = *((
double*) par.get());
25 par = state->getRegistry()->getEntry(
"beta");
26 beta = *((
double*) par.get());
38 double min = 0, max = 0, a, I;
40 for (uint i = 1; i < p1->realValue.size(); i++) {
41 a = state_->getRandomizer()->getRandomDouble();
43 I = fabs(p1->realValue[i] - p2->realValue[i]);
45 if (p1->realValue[i] <= p2->realValue[i]){
46 min = p1->realValue[i] - I*alpha;
47 max = p2->realValue[i] + I*beta;
50 min = p2->realValue[i] - I*beta;
51 max = p1->realValue[i] + I*alpha;
53 ch->realValue[i] = 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.
bool mate(GenotypeP gen1, GenotypeP gen2, GenotypeP child)
void registerParameters(StateP)
Register parameters with the system. Called before CrossoverOp::initialize.
FloatingPoint class - implements genotype as a vector of floating point values.