This class allows to import generative models from Python.
More...
#include </home/svalorzen/Libraries/Self/AIToolbox/src/Python/MDP/GenerativeModelPython.hpp>
|
| GenerativeModelPython (boost::python::object instance) |
| Basic constructor. More...
|
|
size_t | getS () const |
| This function returns the number of states of the environment. More...
|
|
size_t | getA () const |
| This function returns the number of actions of the environment. More...
|
|
double | getDiscount () const |
| This function returns the discount of the environment. More...
|
|
bool | isTerminal (const size_t s) const |
| This function returns whether a given state is a terminal state. More...
|
|
std::tuple< size_t, double > | sampleSR (const size_t s, const size_t a) const |
| This function returns a tuple containing a new state and reward, from the input state and action. More...
|
|
This class allows to import generative models from Python.
This class wraps an instance of a Python class that provides generator methods to sample states and rewards from, so that one does not need to always specify transition and reward functions from Python.
◆ GenerativeModelPython()
AIToolbox::MDP::GenerativeModelPython::GenerativeModelPython |
( |
boost::python::object |
instance | ) |
|
|
inline |
Basic constructor.
This constructor takes a Python object, which will be used to call the generative methods from C++.
This class expects the instance to have at least the following methods:
- getS(): returns the number of states of the environment.
- getA(): returns the number of actions of the environment, in ALL states.
- getDiscount(): returns the discount of the environment, [0, 1].
- isTerminal(s): returns whether a given state is a terminal state.
- sampleSR(s, a): returns a tuple containing new state and reward, from the input state and action.
- Parameters
-
instance | The Python object instance to call methods on. |
◆ getA()
size_t AIToolbox::MDP::GenerativeModelPython::getA |
( |
| ) |
const |
|
inline |
This function returns the number of actions of the environment.
◆ getDiscount()
double AIToolbox::MDP::GenerativeModelPython::getDiscount |
( |
| ) |
const |
|
inline |
This function returns the discount of the environment.
◆ getS()
size_t AIToolbox::MDP::GenerativeModelPython::getS |
( |
| ) |
const |
|
inline |
This function returns the number of states of the environment.
◆ isTerminal()
bool AIToolbox::MDP::GenerativeModelPython::isTerminal |
( |
const size_t |
s | ) |
const |
|
inline |
This function returns whether a given state is a terminal state.
◆ sampleSR()
std::tuple<size_t, double> AIToolbox::MDP::GenerativeModelPython::sampleSR |
( |
const size_t |
s, |
|
|
const size_t |
a |
|
) |
| const |
|
inline |
This function returns a tuple containing a new state and reward, from the input state and action.
The documentation for this class was generated from the following file: