Ultra 0.9.4
Loading...
Searching...
No Matches
ultra::src::interpreter Class Reference

#include <interpreter.h>

Inheritance diagram for ultra::src::interpreter:
ultra::interpreter ultra::function::params

Public Member Functions

 interpreter (const gp::individual &)
value_t run (const std::vector< value_t > &)
value_t fetch_var (std::size_t) const
Public Member Functions inherited from ultra::interpreter
 interpreter (const gp::individual &)
value_t run (const locus &)
value_t run ()
value_t fetch_arg (std::size_t) const final
value_t fetch_opaque_arg (std::size_t) const final
void rebind (const gp::individual &) noexcept
bool is_valid () const
const gp::individual & program () const noexcept
Public Member Functions inherited from ultra::function::params
value_t operator[] (std::size_t i) const

Detailed Description

This class extends ultra::interpreter to manage input variables.

For further details see ultra::src::variable class.

Constructor & Destructor Documentation

◆ interpreter()

ultra::src::interpreter::interpreter ( const gp::individual & prg)
explicit
Parameters
[in]prgindividual whose value we are interested in
Warning
The lifetime of prg must extend beyond that of the interpreter.

Member Function Documentation

◆ fetch_var()

value_t ultra::src::interpreter::fetch_var ( std::size_t i) const
nodiscard

Used by the ultra::variable class to retrieve the value of a variable.

Parameters
[in]ithe index of a variable
Returns
the value of the i-th variable

◆ run()

value_t ultra::src::interpreter::run ( const std::vector< value_t > & ex)

Calculates the output of a program (individual) given a specific input.

Parameters
[in]exa vector of values for the problem's variables
Returns
the output value of the interpreter

The documentation for this class was generated from the following files: