Vita
evaluator_proxy.h
Go to the documentation of this file.
1
13#if !defined(VITA_EVALUATOR_PROXY_H)
14#define VITA_EVALUATOR_PROXY_H
15
16#include "kernel/cache.h"
17#include "kernel/evaluator.h"
18
19namespace vita
20{
29template<class T, class E>
30class evaluator_proxy : public evaluator<T>
31{
32public:
33 evaluator_proxy(E, unsigned);
34
35 // Serialization.
36 bool load(std::istream &) override;
37 bool save(std::ostream &) const override;
38
39 void clear() override;
40
41 fitness_t operator()(const T &) override;
42 fitness_t fast(const T &) override;
43
44 std::unique_ptr<basic_lambda_f> lambdify(const T &) const override;
45
46private:
47 // Access to the real evaluator.
48 E eva_;
49
50 // Hash table cache.
51 cache cache_;
52};
53
54#include "kernel/evaluator_proxy.tcc"
55} // namespace vita
56
57#endif // include guard
Implements a hash table that links individuals' signature to fitness (mainly used by the evaluator_pr...
Definition: cache.h:32
Provides a surrogate for an evaluator to control access to it.
fitness_t operator()(const T &) override
void clear() override
Clear possible cached values.
Calculates the fitness of an individual.
Definition: evaluator.h:54
The main namespace for the project.