Vita
variable.h
Go to the documentation of this file.
1
13#if !defined(VITA_SRC_VARIABLE_H)
14#define VITA_SRC_VARIABLE_H
15
17#include "kernel/gp/mep/i_mep.h" // DO NOT REMOVE: VISUAL STUDIO COMPILE ERROR
18#include "kernel/gp/terminal.h"
19
20namespace vita
21{
26class variable : public terminal
27{
28public:
29 variable(const std::string &name, unsigned var_id, category_t t = 0)
30 : terminal(name, t), var_(var_id)
31 {}
32
33 bool input() const override { return true; }
34
36 std::string display(terminal_param_t, format) const final { return name(); }
37
41 value_t eval(symbol_params &p) const override { return p.fetch_var(var_); }
42
43private:
44 unsigned var_;
45};
46
47} // namespace vita
48
49#endif // include guard
An interface for parameter passing to functions / terminals.
std::string name() const
Definition: symbol.cc:44
format
Symbol rendering format.
Definition: symbol.h:39
bool terminal() const
Definition: symbol.h:153
A symbol with zero-arity.
Definition: terminal.h:27
Represents an input argument (feature) for a symbolic regression or classification problem.
Definition: variable.h:27
value_t eval(symbol_params &p) const override
Definition: variable.h:41
bool input() const override
An input variable is a feature from the learning domain.
Definition: variable.h:33
std::string display(terminal_param_t, format) const final
Definition: variable.h:36
The main namespace for the project.
std::size_t category_t
A category provide operations which supplement or supersede those of the domain but which are restric...
Definition: common.h:44
std::variant< D_VOID, D_INT, D_DOUBLE, D_STRING > value_t
A variant containing the data types used by the interpreter for internal calculations / output value ...
Definition: value.h:45