1#include "CartesianCrsOnePoint.h"
2#include "Cartesian_c.h"
29 int crsPoint = state_->getRandomizer()->getRandomInteger(p1->size());
33 if ((state_->getRandomizer()->getRandomInteger(0, 1)) == 0)
35 for (
int i = 0; i < crsPoint; i++)
37 ch->push_back(p1->at(i));
39 for (
int i = crsPoint; i < (int)p2->size(); i++)
41 ch->push_back(p2->at(i));
46 for (
int i = 0; i < crsPoint; i++)
48 ch->push_back(p2->at(i));
50 for (
int i = crsPoint; i < (int)p1->size(); i++)
52 ch->push_back(p1->at(i));
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.