16 lines
487 B
C++
16 lines
487 B
C++
#include "KolchShindyalPhenToFitnessStrategy.h"
|
|
#define _USE_MATH_DEFINES
|
|
#include <cmath>
|
|
#include <math.h>
|
|
|
|
|
|
double KolchShindyalPhenToFitnessStrategy::calculateFitness(Phenotype *phen){
|
|
|
|
double X = phen->getTraitByName("X").getTraitValueCont();
|
|
double Xopt = phen->getTraitByName("Xopt").getTraitValueCont();
|
|
double sigmaX = phen->getTraitByName("sigmaX").getTraitValueCont();
|
|
|
|
double ans = 1/(sqrt(2*M_PI)) * exp(-0.5*pow((X-Xopt)/sigmaX,2.));
|
|
|
|
return ans;
|
|
} |