|
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 <a2c.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 A2CMonitor< action_type, state_type >::experience_buffer_type | experience_buffer_type |
| Public Types inherited from bitrl::rl::algos::RLSolverBase< EnvType > | |
| typedef EnvType | env_type |
Public Member Functions | |
| A2CSolver (const A2CConfig &config, policy_type &policy, critic_type &critic, std::unique_ptr< torch::optim::Optimizer > &policy_optimizer, std::unique_ptr< torch::optim::Optimizer > &critic_optimizer) | |
| A2C. | |
| virtual void | actions_before_training_begins (env_type &) |
| actions_before_training_begins. Execute any actions the algorithm needs before starting the iterations | |
| virtual void | actions_after_training_ends (env_type &) override final |
| actions_after_training_ends. Actions to execute after the training iterations have finisehd | |
| virtual void | actions_before_episode_begins (env_type &, uint_t) override final |
| actions_before_training_episode | |
| virtual void | actions_after_episode_ends (env_type &, uint_t, const EpisodeInfo &) override final |
| actions_after_training_episode | |
| virtual EpisodeInfo | on_training_episode (env_type &, uint_t) |
| on_episode Do one on_episode of the algorithm | |
| 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 | |
| A2CMonitor< action_type, state_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 void | actions_after_episode_ends (env_type &, uint_t, const EpisodeInfo &) |
| actions_after_training_episode | |
Additional Inherited Members | |
| Protected Member Functions inherited from bitrl::rl::algos::RLSolverBase< EnvType > | |
| RLSolverBase ()=default | |
| Constructor. | |
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::A2CSolver< EnvType, PolicyType, CriticType >::action_type |
| typedef CriticType bitrl::rl::algos::pg::A2CSolver< EnvType, PolicyType, CriticType >::critic_type |
The critic type.
| typedef EnvType bitrl::rl::algos::pg::A2CSolver< EnvType, PolicyType, CriticType >::env_type |
The environment type.
| typedef A2CMonitor<action_type,state_type>::experience_buffer_type bitrl::rl::algos::pg::A2CSolver< EnvType, PolicyType, CriticType >::experience_buffer_type |
| typedef PolicyType bitrl::rl::algos::pg::A2CSolver< EnvType, PolicyType, CriticType >::policy_type |
The policy or action type.
| typedef env_type::state_type bitrl::rl::algos::pg::A2CSolver< EnvType, PolicyType, CriticType >::state_type |
| bitrl::rl::algos::pg::A2CSolver< EnvType, PolicyType, CriticType >::A2CSolver | ( | const A2CConfig & | config, |
| policy_type & | policy, | ||
| critic_type & | critic, | ||
| std::unique_ptr< torch::optim::Optimizer > & | policy_optimizer, | ||
| std::unique_ptr< torch::optim::Optimizer > & | critic_optimizer ) |
A2C.
| config | |
| policy |
|
inlinefinaloverridevirtual |
actions_after_training_episode
|
inlinefinaloverridevirtual |
actions_after_training_ends. Actions to execute after the training iterations have finisehd
Implements bitrl::rl::algos::RLSolverBase< EnvType >.
|
inlinefinaloverridevirtual |
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 >.
|
inline |
Read-write access to the monitor object.
|
virtual |
on_episode Do one on_episode of the algorithm
Implements bitrl::rl::algos::RLSolverBase< EnvType >.
|
noexcept |
set_evaluation_mode for both the Actor and the Critic
|
noexcept |
set_train_mode for both the Actor and the Critic