1 #ifndef __FITNESS_FITNESS_H
2 #define __FITNESS_FITNESS_H
7 #include "chromosome.h"
11 * Base Fitness template class. It should be a base class for any custom
14 template < typename _Chromosome, typename _Value = double >
16 template<typename> friend class Selection;
19 * Type representing Chromosome Gene
21 typedef typename _Chromosome::GeneType GeneType;
24 * Value type returned by the Fitness function
26 typedef _Value ValueType;
29 * Chromosome on which calculations are made
31 _Chromosome chromosome;
34 * Calculations should be done here...
36 * @return Fitness value of the current Chromosome
38 virtual _Value do_calculate() = 0;
49 Fitness(_Chromosome& _chromosome)
50 : chromosome(_chromosome) {
54 * Invokes calculations
56 * @return Fitness value of the current Chromosome
59 return this->do_calculate();
63 * Method used to pass additional arguments needed by the function to
66 virtual void parseArguments(std::map<string, string>) { }
69 * Method used to get additional arguments needed by the function to
72 * @return map containing additional arguments, empty if do not use any
74 virtual std::map<string, string> getArguments() {
75 return std::map<string, string>();
80 #endif /* __FITNESS_FITNESS_H */