1 #ifndef __FITNESS_WSTI_H
2 #define __FITNESS_WSTI_H
12 * Just an example Fitness function based on WSTI version.
14 template < typename _Chromosome >
17 _Chromosome chromosome;
25 for (unsigned int i = 0; i < chromosome.get().size(); i++) {
26 fen = fen + chromosome.get()[i].get() * rat;
32 double calculateFenotype() {
33 const unsigned int power2N = 1 << this->chromosome.get().size();
34 return span_start + (span_end - span_start) * this->fenotype() / power2N;
37 WSTI(_Chromosome& chromosome, float start, float end) {
38 this->chromosome = chromosome;
39 this->span_start = start;
44 double fenotype = this->calculateFenotype();
45 return (exp(fenotype) * sin(3.1415 * fenotype) + 1) / fenotype;
50 #endif /* __FITNESS_WSTI_H */