|
bitsim
Model, simulate, estimate and control robots in C++
|
A2C solver assuming separate networks for the actor and the critic. Similar to the Reinforce algorithm implementation, the PolicyType should expose an act method with the following signature. More...
#include <actor_critic_solver_base.h>


Public Types | |
| typedef EnvType | env_type |
| The environment type. | |
| typedef PolicyType | policy_type |
| The policy or action type. | |
| typedef CriticType | critic_type |
| The critic type. | |
| typedef env_type::state_type | state_type |
| typedef env_type::action_type | action_type |
| typedef MonitorType | monitor_type |
| The monitor type to use. | |
| typedef monitor_type::experience_buffer_type | experience_buffer_type |
| typedef monitor_type::experience_tuple_type | experience_tuple_type |
| typedef ConfigType | config_type |
| The solver configuration type. | |
| Public Types inherited from bitrl::rl::algos::RLSolverBase< EnvType > | |
| typedef EnvType | env_type |
Public Member Functions | |
| virtual | ~ACSolverBase ()=default |
| Destructor. | |
| virtual void | actions_after_training_ends (env_type &) |
| actions_after_training_ends. Actions to execute after the training iterations have finisehd | |
| virtual void | actions_before_episode_begins (env_type &, uint_t) |
| actions_before_training_episode | |
| virtual void | actions_after_episode_ends (env_type &, uint_t, const EpisodeInfo &) |
| actions_after_training_episode | |
| virtual void | actions_before_training_begins (env_type &) |
| actions_before_training_begins. Execute any actions the algorithm needs before starting the iterations | |
| void | set_train_mode () noexcept |
| set_train_mode for both the Actor and the Critic | |
| void | set_evaluation_mode () noexcept |
| set_evaluation_mode for both the Actor and the Critic | |
| monitor_type & | get_monitor () |
| Read-write access to the monitor object. | |
| Public Member Functions inherited from bitrl::rl::algos::RLSolverBase< EnvType > | |
| virtual | ~RLSolverBase ()=default |
| Destructor. | |
| virtual EpisodeInfo | on_training_episode (env_type &, uint_t)=0 |
| on_episode Do one on_episode of the algorithm | |
Protected Member Functions | |
| ACSolverBase (const config_type &config, policy_type &policy, critic_type &critic, std::unique_ptr< torch::optim::Optimizer > &policy_optimizer, std::unique_ptr< torch::optim::Optimizer > &critic_optimizer) | |
| A2C. | |
| uint_t | create_episode_batch_ (env_type &env, uint_t, experience_buffer_type &buffer) |
| Protected Member Functions inherited from bitrl::rl::algos::RLSolverBase< EnvType > | |
| RLSolverBase ()=default | |
| Constructor. | |
Protected Attributes | |
| config_type | config_ |
| config_ | |
| policy_type & | policy_ |
| policy_ | |
| critic_type & | critic_ |
| The action network. | |
| monitor_type | monitor_ |
| Helper class to monitor the algorithm. | |
| std::unique_ptr< torch::optim::Optimizer > | policy_optimizer_ |
| The policy_ optimzer. | |
| std::unique_ptr< torch::optim::Optimizer > | critic_optimizer_ |
| The optimizer for the critic network. | |
A2C solver assuming separate networks for the actor and the critic. Similar to the Reinforce algorithm implementation, the PolicyType should expose an act method with the following signature.
std::tuple[ActioType, torch::Tensor> act(StateType)
In addition the CriticType should expose an evaluate method with the following signature
torch::Tensor evaluate(StateType)
| typedef env_type::action_type bitrl::rl::algos::pg::ACSolverBase< EnvType, PolicyType, CriticType, MonitorType, ConfigType >::action_type |
| typedef ConfigType bitrl::rl::algos::pg::ACSolverBase< EnvType, PolicyType, CriticType, MonitorType, ConfigType >::config_type |
The solver configuration type.
| typedef CriticType bitrl::rl::algos::pg::ACSolverBase< EnvType, PolicyType, CriticType, MonitorType, ConfigType >::critic_type |
The critic type.
| typedef EnvType bitrl::rl::algos::pg::ACSolverBase< EnvType, PolicyType, CriticType, MonitorType, ConfigType >::env_type |
The environment type.
| typedef monitor_type::experience_buffer_type bitrl::rl::algos::pg::ACSolverBase< EnvType, PolicyType, CriticType, MonitorType, ConfigType >::experience_buffer_type |
| typedef monitor_type::experience_tuple_type bitrl::rl::algos::pg::ACSolverBase< EnvType, PolicyType, CriticType, MonitorType, ConfigType >::experience_tuple_type |
| typedef MonitorType bitrl::rl::algos::pg::ACSolverBase< EnvType, PolicyType, CriticType, MonitorType, ConfigType >::monitor_type |
The monitor type to use.
| typedef PolicyType bitrl::rl::algos::pg::ACSolverBase< EnvType, PolicyType, CriticType, MonitorType, ConfigType >::policy_type |
The policy or action type.
| typedef env_type::state_type bitrl::rl::algos::pg::ACSolverBase< EnvType, PolicyType, CriticType, MonitorType, ConfigType >::state_type |
|
virtualdefault |
Destructor.
|
protected |
A2C.
| config | |
| policy |
|
inlinevirtual |
actions_after_training_episode
Reimplemented from bitrl::rl::algos::RLSolverBase< EnvType >.
|
inlinevirtual |
actions_after_training_ends. Actions to execute after the training iterations have finisehd
Implements bitrl::rl::algos::RLSolverBase< EnvType >.
|
inlinevirtual |
actions_before_training_episode
Reimplemented from bitrl::rl::algos::RLSolverBase< EnvType >.
|
virtual |
actions_before_training_begins. Execute any actions the algorithm needs before starting the iterations
Implements bitrl::rl::algos::RLSolverBase< EnvType >.
|
protected |
| ExperienceBufferType |
| env |
we want to push into the monitor experience tuples
|
inline |
Read-write access to the monitor object.
|
noexcept |
set_evaluation_mode for both the Actor and the Critic
|
noexcept |
set_train_mode for both the Actor and the Critic
|
protected |
config_
|
protected |
The action network.
|
protected |
The optimizer for the critic network.
|
protected |
Helper class to monitor the algorithm.
|
protected |
policy_
|
protected |
The policy_ optimzer.