1#include "../ECF_base.h"
9 myGenotype_->registerParameter(state,
"crx.randomrespectful", (voidP)
new double(0), ECF::DOUBLE);
15 voidP sptr =
myGenotype_->getParameterValue(state,
"crx.randomrespectful");
28 typedef std::vector<uint> v_uint;
32 for (uint dimension = 0; dimension < p1->variables.size(); dimension++) {
33 for(uint i = 0; i < p1->getNumBits(); i++) {
34 if (p1->variables[dimension][i] == p2->variables[dimension][i])
35 similarity.push_back(p2->variables[dimension][i]);
37 similarity.push_back(2);
41 for (uint dimension = 0; dimension < p1->variables.size(); dimension++) {
42 for(uint i = 0; i < p1->getNumBits(); i++) {
43 if (similarity[dimension*p1->getNumBits()+i]==1)
45 else if (similarity[dimension*p1->getNumBits()+i]==0)
46 ch->variables[dimension][i]= 0;
48 rand = state_->getRandomizer()->getRandomDouble();
50 ch->variables[dimension][i]= 1;
52 ch->variables[dimension][i]= 0;
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)
Binary class - implements genotype as a vector of binary coded real values with variable interval and...
std::vector< v_bool > variables
vector of bit vectors
double probability_
probability of usage of this crossover operator
GenotypeP myGenotype_
pointer to the Genotype that defines this CrossoverOp