24 uint bitCrs = state_->getRandomizer()->getRandomInteger(0, (
int)p1->size() - 1);
25 uint bitCrsSecond, tmp;
28 bitCrsSecond = state_->getRandomizer()->getRandomInteger((uint) p1->size());
29 }
while (bitCrs == bitCrsSecond);
31 if (bitCrs>bitCrsSecond)
34 bitCrs = bitCrsSecond;
37 ECF_LOG(state_, 5,
"Performing Two-Pt crossover at nodes (" + uint2str(bitCrs) +
") and (" + uint2str(bitCrsSecond) +
")...");
39 switch (state_->getRandomizer()->getRandomInteger(0, 1)) {
41 for (uint i = 0; i < bitCrs; i++) {
42 ch->push_back(
static_cast<Tree::NodeP
> (
new Tree::Node((p1->at(i)))));
44 for (uint i = bitCrs; i < bitCrsSecond; i++) {
45 ch->push_back(
static_cast<Tree::NodeP
> (
new Tree::Node((p2->at(i)))));
47 for (uint i = bitCrsSecond; i < p2->size(); i++) {
48 ch->push_back(
static_cast<Tree::NodeP
> (
new Tree::Node((p1->at(i)))));
52 for (uint i = 0; i < bitCrs; i++) {
53 ch->push_back(
static_cast<Tree::NodeP
> (
new Tree::Node((p2->at(i)))));
55 for (uint i = bitCrs; i < bitCrsSecond; i++) {
56 ch->push_back(
static_cast<Tree::NodeP
> (
new Tree::Node((p1->at(i)))));
58 for (uint i = bitCrsSecond; i < p1->size(); i++) {
59 ch->push_back(
static_cast<Tree::NodeP
> (
new Tree::Node((p2->at(i)))));