1#include "../ECF_base.h"
2#include "Permutation.h"
11 myGenotype_->registerParameter(state,
"crx.OPX", (voidP)
new double(0), ECF::DOUBLE);
17 voidP sptr =
myGenotype_->getParameterValue(state,
"crx.OPX");
29 int position = state_->getRandomizer()->getRandomInteger(p1->getSize()-1);
32 std::map<int, int> subSet;
35 for(
int i = 0; i <= position; i++) {
36 ch->variables[i] = p1->variables[i];
38 subSet[p1->variables[i]] = 0;
42 int left = (int) p1->getSize() - position - 1;
44 int indexChild = position + 1;
48 for(
int ind2 = 0; ind2 < (int) p1->getSize() && left>0; ind2++) {
49 if(subSet.find(p2->variables[ind2]) == subSet.end()) {
50 ch->variables[indexChild] = p2->variables[ind2];
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)
void registerParameters(StateP)
Register parameters with the system. Called before CrossoverOp::initialize.
bool initialize(StateP)
Initialize crossover operator. Called before first crossover operation.
Permutation class - implements genotype as a vector of indices 0..(n-1) (permutation of indices)