1#include "CartesianCrxUniform.h" 
    2#include "Cartesian_genotype.h" 
    7        myGenotype_->registerParameter(state, 
"crx.uniform", (voidP) 
new double(0), ECF::DOUBLE);
 
   12        voidP sptr = 
myGenotype_->getParameterValue(state, 
"crx.uniform");
 
   23        uint parent1Size = p1->size() - p1->
nOutputs;
 
   24        uint parent2Size = p2->size() - p2->
nOutputs;
 
   25        uint minimumSize = parent1Size > parent2Size ? parent1Size : parent2Size;
 
   26        bool parent1IsLonger = parent1Size > parent2Size;
 
   29        for(uint i = 0; i < minimumSize; i++) {
 
   30            double randomResult = p1->get_random_double(0,1);
 
   31            if(randomResult < 0.5) {
 
   32                ch->push_back(p1->operator[](i));
 
   35                ch->push_back(p2->operator[](i));
 
   39            for(uint i = parent2Size; i < parent1Size; i++) {
 
   40                ch->push_back(p1->operator[](i));
 
   44            for(uint i = parent1Size; i < parent2Size; i++) {
 
   45                ch->push_back(p1->operator[](i));
 
   49        for(uint i = 0; i < p1->
nOutputs; i++) {
 
   50            double randomResult = p1->get_random_double(0,1);
 
   51            if(randomResult < 0.5) {
 
   52                ch->push_back(p1->operator[](parent1Size + i));
 
   55                ch->push_back(p1->operator[](parent2Size + i));
 
double probability_
probability of usage of this crossover operator
 
GenotypeP myGenotype_
pointer to the Genotype that defines this CrossoverOp
 
uint nOutputs
number of final outputs