class MaxTabularPolicy
More...
#include <max_tabular_policy.h>
|
| | MaxTabularPolicy ()=default |
| | Constructor.
|
| void | on_episode (uint_t) noexcept |
| | any actions the policy should perform on the given episode index
|
| void | reset () noexcept |
| | Reset the policy.
|
| action_type | on_state (state_type s) const |
| | Get the action from the given state.
|
| void | save (const std::string &filename) const |
| | Save the state -> action map in a CSV file;.
|
| void | load (const std::string &filename) |
| | Load the state -> action map from a CSV file that save() wrote: a state and its action per row, and lines that start with # ignored. The states must be 0, 1, 2, ... in order.
|
| uint_t | n_states () const noexcept |
| | The number of states the policy has an action for.
|
| template<typename VecTp> |
| MaxTabularPolicy::action_type | get_action (const VecTp &vec) |
|
| template<typename MatType> |
| static output_type | get_action (const MatType &q_map, uint_t state_idx) |
| | get_action. Given a
|
| template<typename VecTp> |
| static output_type | get_action (const VecTp &q_map) |
| | get_action. Given a vector always returns the position of the maximum occuring element. If the given vector is empty returns CubeAIConsts::invalid_size_type
|
| static output_type | get_action (const torch_tensor_t &vec) |
| | get_action. Given a vector always returns the position of the maximum occuring element. If the given vector is empty returns CubeAIConsts::invalid_size_type
|
◆ action_type
◆ output_type
The output type of operator().
◆ state_type
◆ MaxTabularPolicy()
| bitrl::rl::policies::MaxTabularPolicy::MaxTabularPolicy |
( |
| ) |
|
|
default |
◆ get_action() [1/4]
template<typename MatType>
| output_type bitrl::rl::policies::MaxTabularPolicy::get_action |
( |
const MatType & | q_map, |
|
|
uint_t | state_idx ) |
|
static |
◆ get_action() [2/4]
get_action. Given a vector always returns the position of the maximum occuring element. If the given vector is empty returns CubeAIConsts::invalid_size_type
◆ get_action() [3/4]
template<typename VecTp>
| output_type bitrl::rl::policies::MaxTabularPolicy::get_action |
( |
const VecTp & | q_map | ) |
|
|
static |
get_action. Given a vector always returns the position of the maximum occuring element. If the given vector is empty returns CubeAIConsts::invalid_size_type
◆ get_action() [4/4]
◆ load()
| void bitrl::rl::policies::MaxTabularPolicy::load |
( |
const std::string & | filename | ) |
|
Load the state -> action map from a CSV file that save() wrote: a state and its action per row, and lines that start with # ignored. The states must be 0, 1, 2, ... in order.
- Exceptions
-
| std::runtime_error | if the file cannot be read or is not like that |
◆ n_states()
| uint_t bitrl::rl::policies::MaxTabularPolicy::n_states |
( |
| ) |
const |
|
inlinenoexcept |
The number of states the policy has an action for.
◆ on_episode()
| void bitrl::rl::policies::MaxTabularPolicy::on_episode |
( |
uint_t | | ) |
|
|
inlinenoexcept |
any actions the policy should perform on the given episode index
◆ on_state()
Get the action from the given state.
◆ reset()
| void bitrl::rl::policies::MaxTabularPolicy::reset |
( |
| ) |
|
|
inlinenoexcept |
◆ save()
| void bitrl::rl::policies::MaxTabularPolicy::save |
( |
const std::string & | filename | ) |
const |
Save the state -> action map in a CSV file;.
◆ MaxTabularPolicyBuilder
| friend struct MaxTabularPolicyBuilder |
|
friend |
Make friends so the builder access private members.
The documentation for this class was generated from the following file: