Vita
ga/problem.h
Go to the documentation of this file.
1
13#if !defined(VITA_GA_PROBLEM_H)
14#define VITA_GA_PROBLEM_H
15
16#include "kernel/problem.h"
17#include "kernel/range.h"
18#include "kernel/ga/primitive.h"
19
20namespace vita
21{
22
29class ga_problem : public problem
30{
31public:
32 ga_problem() = default;
33 ga_problem(std::size_t, const range_t<int> &);
34 explicit ga_problem(const std::vector<range_t<int>> &);
35
36 template<class... Args> terminal *insert(Args &&...);
37};
38
39template<class... Args> terminal *ga_problem::insert(Args &&... args)
40{
41 return static_cast<terminal *>(
42 sset.insert<ga::integer>(std::forward<Args>(args)...));
43}
44
45
52class de_problem : public problem
53{
54public:
55 de_problem() = default;
56 de_problem(std::size_t, const range_t<double> &);
57 explicit de_problem(const std::vector<range_t<double>> &);
58
59 template<class... Args> terminal *insert(Args &&...);
60};
61
62template<class... Args> terminal *de_problem::insert(Args &&... args)
63{
64 return static_cast<terminal *>(
65 sset.insert<ga::real>(std::forward<Args>(args)...));
66}
67
68} // namespace vita
69
70#endif // include guard
Provides a DE-specific interface to the generic problem class.
Definition: ga/problem.h:53
Mainly used for differential evolution.
Definition: primitive.h:94
Provides a GA-specific interface to the generic problem class.
Definition: ga/problem.h:30
Aggregates the problem-related data needed by an evolutionary program.
Definition: problem.h:24
symbol * insert(std::unique_ptr< symbol >, double=1.0)
Adds a new symbol to the set.
Definition: symbol_set.cc:55
A symbol with zero-arity.
Definition: terminal.h:27
The main namespace for the project.
std::pair< T, T > range_t
Right-open interval.
Definition: range.h:25