Improve comments and documentation.
[genetic.git] / src / fitness / wsti.h
index eaa0538b77d58f46cab63a68efd648d448fd4750..d99dd18b8e6d58673a5f750d6e7ca8634fe7d55b 100644 (file)
@@ -16,9 +16,19 @@ namespace genetic {
     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;
@@ -30,19 +40,39 @@ namespace genetic {
             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) {
         }