template <typename _Chromosome, typename _Value = double>
class WSTI : public Fitness<_Chromosome, _Value> {
protected:
+ /**
+ * Value of the begining of the Fitness function domain
+ */
float span_start;
+
+ /**
+ * Value of the end of the Fitness function domain
+ */
float span_end;
+ /**
+ * Calculates fenotype of the current Chromosome
+ */
_Value fenotype() {
int _fenotype = 0;
int ratio = 1;
return _fenotype;
}
+ /**
+ * Calculates fenotype of the current Chromosome
+ */
_Value calculateFenotype() {
const unsigned int power2N = 1 << this->chromosome.get().size();
return span_start + (span_end - span_start) * this->fenotype() / power2N;
}
+ /**
+ * Calculates fitness value of the current Chromosome
+ */
_Value do_calculate() {
_Value fenotype = this->calculateFenotype();
return (exp(fenotype) * sin(3.1415 * fenotype) + 1) / fenotype;
}
public:
+ /**
+ * Class constructor. Initializes class with requied values.
+ *
+ * @param start begining of the Fitness function domain
+ * @param end end of the Fitness function domain
+ */
WSTI(float start, float end)
: span_start(start), span_end(end) {
}
+
+ /**
+ * Class constructor. Initializes class with requied values.
+ *
+ * @param _chromosome Chromosome, for which value will be calculated
+ * @param start begining of the Fitness function domain
+ * @param end end of the Fitness function domain
+ */
WSTI(_Chromosome& _chromosome, float start, float end)
: Fitness<_Chromosome>(_chromosome), span_start(start), span_end(end) {
}