Vita
src
kernel
gp
mep
mep/interpreter.h
Go to the documentation of this file.
1
13
#if !defined(VITA_MEP_INTERPRETER_H)
14
#define VITA_MEP_INTERPRETER_H
15
16
#include "
kernel/core_interpreter.h
"
17
#include "
kernel/gp/function.h
"
18
#include "
kernel/gp/gene.h
"
19
#include "
kernel/vitafwd.h
"
20
#include "utility/matrix.h"
21
22
namespace
vita
23
{
41
template
<>
42
class
interpreter
<
i_mep
> :
public
core_interpreter
43
{
44
public
:
45
explicit
interpreter
(
const
i_mep
*);
46
47
[[nodiscard]]
index_t
fetch_index(
unsigned
)
const
;
48
49
[[nodiscard]]
const
i_mep
&program()
const
{
return
*prg_; }
50
51
[[nodiscard]] terminal_param_t fetch_param()
const
final
;
52
[[nodiscard]]
value_t
fetch_arg(
unsigned
)
final
;
53
value_t
fetch_opaque_arg(
unsigned
)
final
;
54
55
private
:
56
// *** Private support methods ***
57
value_t
run_locus(
const
locus
&);
58
[[nodiscard]]
double
penalty_locus(
const
locus
&);
59
60
// Nonvirtual interface.
61
value_t
run_nvi()
override
;
62
[[nodiscard]]
double
penalty_nvi()
override
;
63
[[nodiscard]]
bool
is_valid_nvi()
const override
;
64
65
// *** Private data members ***
66
const
i_mep
*prg_;
67
68
struct
elem_ {
bool
valid;
value_t
value;};
69
mutable
matrix<elem_> cache_;
70
71
// Instruction pointer.
72
locus
ip_;
73
};
74
75
}
// namespace vita
76
77
#endif
// include guard
vita::core_interpreter
Minimum interface of an interpreter.
Definition:
core_interpreter.h:69
vita::i_mep
A MEP (Multi Expression Programming) single member of a population.
Definition:
i_mep.h:34
vita::interpreter
Definition:
vitafwd.h:24
core_interpreter.h
function.h
gene.h
vita
The main namespace for the project.
vita::index_t
std::size_t index_t
Index in the genome.
Definition:
locus.h:25
vita::value_t
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
vita::locus
Definition:
locus.h:33
vitafwd.h
Generated on Sat Apr 6 2024 15:58:41 for Vita by
1.9.3