X-Git-Url: https://git.dlugolecki.net.pl/?a=blobdiff_plain;f=src%2Ffitness%2Ffitness.h;fp=src%2Ffitness%2Ffitness.h;h=0000000000000000000000000000000000000000;hb=2a8fc81203107eb3495a50fb2666803fda3e0517;hp=a9750341f32271db145a514c42b5d8691a3ae931;hpb=169219566d08e4940d25b66ecdb68e80b90c090d;p=genetic.git diff --git a/src/fitness/fitness.h b/src/fitness/fitness.h deleted file mode 100644 index a975034..0000000 --- a/src/fitness/fitness.h +++ /dev/null @@ -1,80 +0,0 @@ -#ifndef __FITNESS_FITNESS_H -#define __FITNESS_FITNESS_H - -#include -#include - -#include "chromosome.h" - -namespace genetic { - /** - * Base Fitness template class. It should be a base class for any custom - * fitness functions. - */ - template < typename _Chromosome, typename _Value = double > - class Fitness { - template friend class Selection; - public: - /** - * Type representing Chromosome Gene - */ - typedef typename _Chromosome::GeneType GeneType; - - /** - * Value type returned by the Fitness function - */ - typedef _Value ValueType; - protected: - /** - * Chromosome on which calculations are made - */ - _Chromosome chromosome; - - /** - * Calculations should be done here... - * - * @return Fitness value of the current Chromosome - */ - virtual _Value do_calculate() = 0; - - public: - /** - * Class constructor - */ - Fitness() {} - - /** - * Copy constructor - */ - Fitness(_Chromosome& _chromosome) - : chromosome(_chromosome) { - } - - /** - * Invokes calculations - * - * @return Fitness value of the current Chromosome - */ - _Value calculate() { - return this->do_calculate(); - } - - /** - * Method used to pass additional arguments needed by the function to - * run correctly. - */ - virtual void parseArguments(std::map) { } - - /** - * Method used to get additional arguments needed by the function to - * run correctly - * - * @return map containing additional arguments, empty if do not use any - */ - virtual std::map getArguments() { - return std::map(); - } - }; -} - -#endif /* __FITNESS_FITNESS_H */