1#include "../ECF_base.h"
2#include "Permutation.h"
11 myGenotype_->registerParameter(state,
"crx.PBX", (voidP)
new double(0), ECF::DOUBLE);
17 voidP sptr =
myGenotype_->getParameterValue(state,
"crx.PBX");
30 std::vector<bool> taged;
31 taged.resize(p1->getSize());
34 for(uint i = 0; i < ch->getSize(); i++) {
35 if(state_->getRandomizer()->getRandomInteger(2) == 0) {
36 ch->variables[i] = p1->variables[i];
37 taged[p1->variables[i]] = 1;
41 ch->variables[i] = -1;
46 count = (int) ch->getSize() - count;
47 for(uint i = 0; i < ch->getSize() && count > 0; i++) {
49 while(ch->variables[indCh] != -1)
52 if(taged[p2->variables[i]] != 1) {
53 ch->variables[indCh] = p2->variables[i];
double probability_
probability of usage of this crossover operator
GenotypeP myGenotype_
pointer to the Genotype that defines this CrossoverOp
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.
Permutation class - implements genotype as a vector of indices 0..(n-1) (permutation of indices)