|
bitrl & cuberl Documentation
Simulation engine for reinforcement learning agents
|
SysState utility class describing the state of a system. More...
#include <system_state.h>
Public Types | |
| typedef std::array< std::pair< std::string, real_t >, dim > | value_type |
| The type of the stored values. | |
Public Member Functions | |
| SysState () | |
| Constructor. Initialize the state with no names. | |
| SysState (std::array< std::pair< std::string, real_t >, dim > &&values) | |
| Constructor. Initialize the state with the given names and values. | |
| SysState (std::array< std::string, dim > &&names, real_t val) | |
| Constructor. Initialize the state with the given names all variables will be initialized with val. | |
| SysState (const SysState< dim > &other) | |
| Copy constructor. | |
| template<int other_dim> | |
| SysState (const SysState< other_dim > &other) | |
| Copy constructor. | |
| SysState & | operator= (const SysState< dim > &other) |
| Copy assignement constructor. | |
| SysState (SysState &&other) | |
| Move copy constructor. | |
| SysState & | operator= (SysState &&other) |
| Move copy constructor. | |
| SysState & | operator+= (const DynVec< real_t > &vec) |
| Add to this state the entries of the give vector. | |
| SysState & | operator-= (const DynVec< real_t > &vec) |
| Subtract from this state the entries of the give vector. | |
| SysState & | operator*= (real_t val) |
| Scale this state by the given factor. | |
| real_t | get (const std::string &name) const |
| Returns the value for the variable name. | |
| void | set (const std::string &name, real_t val) |
| Set the value for the variable name. | |
| void | set (uint_t i, const std::pair< std::string, real_t > &value) |
| Set the name and value of the i-th variable. | |
| void | add (const DynVec< real_t > &container) |
| Set the values of state variables container must be of size dim. | |
| void | add (const std::vector< real_t > &container) |
| Set the values of state variables container must be of size dim. | |
| uint_t | size () const |
| Returns the size of the system. | |
| const std::array< real_t, dim > | get_values () const |
| Returns a copy of the state values. | |
| const std::vector< std::string_view > | get_names () const |
| Returns a copy of the state names. | |
| real_t & | operator[] (uint_t) |
| Access operator. | |
| const real_t & | operator[] (uint_t) const |
| Access operator. | |
| real_t & | operator[] (const std::string &name) |
| Access operator. | |
| const real_t & | operator[] (const std::string &name) const |
| Access operator. | |
| real_t & | operator() (const std::string &name) |
| Access operator. | |
| const real_t & | operator() (const std::string &name) const |
| Access operator. | |
| real_t & | operator() (const std::string_view name) |
| Access operator. | |
| const real_t & | operator() (const std::string_view name) const |
| Access operator. | |
| void | clear () |
| clear the state | |
| std::ostream & | print (std::ostream &out) const |
| Print the state at the given stream. | |
| DynVec< real_t > | as_vector () const |
| Returns the entries of this state as a DynVec. | |
| const std::string | as_string () const |
| Return the state as string. | |
| nlohmann::json | as_json () const |
| void | scale (real_t val) |
| Scale the values of the state. | |
| template<typename Container > | |
| void | set (const Container &container) |
| Set the values. | |
Static Public Member Functions | |
| template<int dim1, int dim2> | |
| static void | extract (const SysState< dim1 > &state, SysState< dim2 > &other) |
| Extract a state of different dimension. | |
Static Public Attributes | |
| static const int | dimension = dim |
| The dimension of the state. | |
SysState utility class describing the state of a system.
| typedef std::array<std::pair<std::string, real_t>, dim> bitrl::dynamics::SysState< dim >::value_type |
The type of the stored values.
| bitrl::dynamics::SysState< dim >::SysState | ( | ) |
Constructor. Initialize the state with no names.
| bitrl::dynamics::SysState< dim >::SysState | ( | std::array< std::pair< std::string, real_t >, dim > && | values | ) |
Constructor. Initialize the state with the given names and values.
| bitrl::dynamics::SysState< dim >::SysState | ( | std::array< std::string, dim > && | names, |
| real_t | val | ||
| ) |
Constructor. Initialize the state with the given names all variables will be initialized with val.
| bitrl::dynamics::SysState< dim >::SysState | ( | const SysState< dim > & | other | ) |
Copy constructor.
| bitrl::dynamics::SysState< dim >::SysState | ( | const SysState< other_dim > & | other | ) |
Copy constructor.
| bitrl::dynamics::SysState< dim >::SysState | ( | SysState< dim > && | other | ) |
Move copy constructor.
| void bitrl::dynamics::SysState< dim >::add | ( | const DynVec< real_t > & | container | ) |
Set the values of state variables container must be of size dim.
| void bitrl::dynamics::SysState< dim >::add | ( | const std::vector< real_t > & | container | ) |
Set the values of state variables container must be of size dim.
| nlohmann::json bitrl::dynamics::SysState< dim >::as_json | ( | ) | const |
Convert to json format
| const std::string bitrl::dynamics::SysState< dim >::as_string | ( | ) | const |
Return the state as string.
| DynVec< real_t > bitrl::dynamics::SysState< dim >::as_vector | ( | ) | const |
Returns the entries of this state as a DynVec.
| void bitrl::dynamics::SysState< dim >::clear | ( | ) |
clear the state
|
static |
Extract a state of different dimension.
| real_t bitrl::dynamics::SysState< dim >::get | ( | const std::string & | name | ) | const |
Returns the value for the variable name.
| const std::vector< std::string_view > bitrl::dynamics::SysState< dim >::get_names | ( | ) | const |
Returns a copy of the state names.
| const std::array< real_t, dim > bitrl::dynamics::SysState< dim >::get_values | ( | ) | const |
Returns a copy of the state values.
| real_t & bitrl::dynamics::SysState< dim >::operator() | ( | const std::string & | name | ) |
Access operator.
| const real_t & bitrl::dynamics::SysState< dim >::operator() | ( | const std::string & | name | ) | const |
Access operator.
|
inline |
Access operator.
|
inline |
Access operator.
| SysState< dim > & bitrl::dynamics::SysState< dim >::operator*= | ( | real_t | val | ) |
Scale this state by the given factor.
| SysState< dim > & bitrl::dynamics::SysState< dim >::operator+= | ( | const DynVec< real_t > & | vec | ) |
Add to this state the entries of the give vector.
| SysState< dim > & bitrl::dynamics::SysState< dim >::operator-= | ( | const DynVec< real_t > & | vec | ) |
Subtract from this state the entries of the give vector.
| SysState< dim > & bitrl::dynamics::SysState< dim >::operator= | ( | const SysState< dim > & | other | ) |
Copy assignement constructor.
| SysState< dim > & bitrl::dynamics::SysState< dim >::operator= | ( | SysState< dim > && | other | ) |
Move copy constructor.
|
inline |
Access operator.
|
inline |
Access operator.
| real_t & bitrl::dynamics::SysState< dim >::operator[] | ( | uint_t | i | ) |
Access operator.
| const real_t & bitrl::dynamics::SysState< dim >::operator[] | ( | uint_t | i | ) | const |
Access operator.
| std::ostream & bitrl::dynamics::SysState< dim >::print | ( | std::ostream & | out | ) | const |
Print the state at the given stream.
| void bitrl::dynamics::SysState< dim >::scale | ( | real_t | val | ) |
Scale the values of the state.
| void bitrl::dynamics::SysState< dim >::set | ( | const Container & | container | ) |
Set the values.
| void bitrl::dynamics::SysState< dim >::set | ( | const std::string & | name, |
| real_t | val | ||
| ) |
Set the value for the variable name.
| void bitrl::dynamics::SysState< dim >::set | ( | uint_t | i, |
| const std::pair< std::string, real_t > & | value | ||
| ) |
Set the name and value of the i-th variable.
|
inline |
Returns the size of the system.
|
static |
The dimension of the state.