ECF 1.7
IntGenotypeCrxAverage.cpp
1#include "../ECF_base.h"
2#include <cmath>
3#include "IntGenotype.h"
4
5namespace IntGenotype
6{
7
8 bool IntGenotypeCrxAverage::mate(GenotypeP gen1, GenotypeP gen2, GenotypeP child) {
9
10 IntGenotype* p1 = (IntGenotype*)(gen1.get());
11 IntGenotype* p2 = (IntGenotype*)(gen2.get());
12 IntGenotype* ch = (IntGenotype*)(child.get());
13
14 for (uint i = 0; i < p1->intValues.size(); i++) {
15 ch->intValues[i] = (int) (0.5 * (p1->intValues[i]) + 0.5 * (p2->intValues[i]));
16 }
17
18
19 return true;
20 }
21
22}
bool mate(GenotypeP gen1, GenotypeP gen2, GenotypeP child)
IntGenotype class - implements genotype as a vector of int values.
Definition IntGenotype.h:28