ECF
1.5
D:
Projekt
ECF_trunk
examples
quantum
IntGenotypeCrxAverage.cpp
1
#include <ecf/ECF.h>
2
#include <ecf/ECF_base.h>
3
#include <cmath>
4
#include <sstream>
5
#include "IntGenotype.h"
6
7
namespace
IntGenotype
8
{
9
10
bool
IntGenotypeCrxAverage::mate
(GenotypeP gen1, GenotypeP gen2, GenotypeP child) {
11
12
IntGenotype
* p1 = (
IntGenotype
*)(gen1.get());
13
IntGenotype
* p2 = (
IntGenotype
*)(gen2.get());
14
IntGenotype
* ch = (
IntGenotype
*)(child.get());
15
16
//uint prva = (int) p1->getUBound();
17
//uint druga = (int) p2->getUBound();
18
//
19
//for (uint i = 0; i < p1->intValues.size(); i++) {
20
// if (p1->intValues[i] < prva)
21
// prva = p1->intValues[i];
22
// if (p2->intValues[i] < druga)
23
// druga = p2->intValues[i];
24
//}
25
26
//for (uint i = 0; i < p1->intValues.size(); i++) {
27
// p1->intValues[i] = p1->intValues[i] - prva;
28
// p2->intValues[i] = p2->intValues[i] - druga;
29
//}
30
31
for
(uint i = 0; i < p1->intValues.size(); i++) {
32
ch->intValues[i] = (int) (0.5 * (p1->intValues[i]) + 0.5 * (p2->intValues[i]));
33
}
34
35
36
return
true
;
37
}
38
39
}
IntGenotype::IntGenotypeCrxAverage::mate
bool mate(GenotypeP gen1, GenotypeP gen2, GenotypeP child)
Definition:
IntGenotypeCrxAverage.cpp:10
IntGenotype::IntGenotype
Definition:
IntGenotype.h:14
Generated on Wed Aug 3 2022 17:50:42 for ECF by
1.9.4