Vita
constrained_evaluator.h
Go to the documentation of this file.
1
13#if !defined(VITA_CONSTRAINED_EVALUATOR_H)
14#define VITA_CONSTRAINED_EVALUATOR_H
15
16#include "kernel/evaluator.h"
17
18namespace vita
19{
20template<class T> using penalty_func_t = std::function<double (const T &)>;
21
34template<class T, class E, class P>
36{
37public:
39
40 fitness_t operator()(const T &) override;
41 fitness_t fast(const T &) override;
42
43 std::unique_ptr<basic_lambda_f> lambdify(const T &) const override;
44
45private:
46 // Base evaluator.
47 E eva_;
48
49 // Penalty function.
50 P penalty_;
51};
52
53#include "kernel/constrained_evaluator.tcc"
54} // namespace vita
55
56#endif // include guard
The class merges a basic evaluator and a penalty function into a new combined evaluator.
fitness_t operator()(const T &) override
Calculates the fitness of an individual.
Definition: evaluator.h:54
The main namespace for the project.