1 #ifndef __FITNESS_FITNESS_H
2 #define __FITNESS_FITNESS_H
4 #include "chromosome.h"
8 * Base Fitness template class. It should be a base class for any custom
11 template < typename _Chromosome, typename _Value = double >
13 template<typename> friend class Selection;
16 * Type representing Chromosome Gene
18 typedef typename _Chromosome::GeneType GeneType;
21 * Value type returned by the Fitness function
23 typedef _Value ValueType;
26 * Chromosome on which calculations are made
28 _Chromosome chromosome;
31 * Calculations should be done here...
33 * @return Fitness value of the current Chromosome
35 virtual _Value do_calculate() = 0;
46 Fitness(_Chromosome& _chromosome)
47 : chromosome(_chromosome.get()) {
51 * Invokes calculations
53 * @return Fitness value of the current Chromosome
56 return this->do_calculate();
61 #endif /* __FITNESS_FITNESS_H */