1 #ifndef __FITNESS_WSTI_H
2 #define __FITNESS_WSTI_H
14 * Just an example Fitness function based on WSTI version.
16 template <typename _Chromosome, typename _Value = double>
17 class WSTI : public Fitness<_Chromosome, _Value> {
25 for (unsigned int i = 0; i < this->chromosome.get().size(); i++) {
26 _fenotype = _fenotype + this->chromosome.get()[i].get() * ratio;
29 // cout << "Fenotyp: " << _fenotype << "\n";
33 _Value calculateFenotype() {
34 const unsigned int power2N = 1 << this->chromosome.get().size();
35 return span_start + (span_end - span_start) * this->fenotype() / power2N;
38 _Value do_calculate() {
39 _Value fenotype = this->calculateFenotype();
40 return (exp(fenotype) * sin(3.1415 * fenotype) + 1) / fenotype;
43 WSTI(float start, float end)
44 : span_start(start), span_end(end) {
46 WSTI(_Chromosome& _chromosome, float start, float end)
47 : Fitness<_Chromosome>(_chromosome), span_start(start), span_end(end) {
52 #endif /* __FITNESS_WSTI_H */