bitsim
Model, simulate, estimate and control robots in C++
Loading...
Searching...
No Matches
bitrl::rl::algos::pg::PPOSolver< EnvType, PolicyType, CriticType > Class Template Referencefinal

#include <ppo.h>

Inheritance diagram for bitrl::rl::algos::pg::PPOSolver< EnvType, PolicyType, CriticType >:
Collaboration diagram for bitrl::rl::algos::pg::PPOSolver< EnvType, PolicyType, CriticType >:

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
 The state_type.
typedef env_type::action_type action_type
 the action type
typedef A2CMonitor< action_type, state_type >::experience_buffer_type experience_buffer_type
Public Types inherited from bitrl::rl::algos::pg::ACSolverBase< EnvType, PolicyType, CriticType, A2CMonitor< EnvType::action_type, EnvType::state_type >, PPOConfig >
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< EnvType::action_type, EnvType::state_type > 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 PPOConfig config_type
 The solver configuration type.
Public Types inherited from bitrl::rl::algos::RLSolverBase< EnvType >
typedef EnvType env_type

Public Member Functions

 PPOSolver (const PPOConfig &config, policy_type &policy, critic_type &critic, std::unique_ptr< torch::optim::Optimizer > &policy_optimizer, std::unique_ptr< torch::optim::Optimizer > &critic_optimizer)
 PPOSolver Constructor.
virtual EpisodeInfo on_training_episode (env_type &, uint_t) override final
 on_episode Do one on_episode of the algorithm
Public Member Functions inherited from bitrl::rl::algos::pg::ACSolverBase< EnvType, PolicyType, CriticType, A2CMonitor< EnvType::action_type, EnvType::state_type >, PPOConfig >
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.

Additional Inherited Members

Protected Member Functions inherited from bitrl::rl::algos::pg::ACSolverBase< EnvType, PolicyType, CriticType, A2CMonitor< EnvType::action_type, EnvType::state_type >, PPOConfig >
 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 inherited from bitrl::rl::algos::pg::ACSolverBase< EnvType, PolicyType, CriticType, A2CMonitor< EnvType::action_type, EnvType::state_type >, PPOConfig >
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.

Member Typedef Documentation

◆ action_type

template<typename EnvType, typename PolicyType, typename CriticType>
typedef env_type::action_type bitrl::rl::algos::pg::PPOSolver< EnvType, PolicyType, CriticType >::action_type

the action type

◆ critic_type

template<typename EnvType, typename PolicyType, typename CriticType>
typedef CriticType bitrl::rl::algos::pg::PPOSolver< EnvType, PolicyType, CriticType >::critic_type

The critic type.

◆ env_type

template<typename EnvType, typename PolicyType, typename CriticType>
typedef EnvType bitrl::rl::algos::pg::PPOSolver< EnvType, PolicyType, CriticType >::env_type

The environment type.

◆ experience_buffer_type

template<typename EnvType, typename PolicyType, typename CriticType>
typedef A2CMonitor<action_type,state_type>::experience_buffer_type bitrl::rl::algos::pg::PPOSolver< EnvType, PolicyType, CriticType >::experience_buffer_type

◆ policy_type

template<typename EnvType, typename PolicyType, typename CriticType>
typedef PolicyType bitrl::rl::algos::pg::PPOSolver< EnvType, PolicyType, CriticType >::policy_type

The policy or action type.

◆ state_type

template<typename EnvType, typename PolicyType, typename CriticType>
typedef env_type::state_type bitrl::rl::algos::pg::PPOSolver< EnvType, PolicyType, CriticType >::state_type

The state_type.

Constructor & Destructor Documentation

◆ PPOSolver()

template<typename EnvType, typename PolicyType, typename CriticType>
bitrl::rl::algos::pg::PPOSolver< EnvType, PolicyType, CriticType >::PPOSolver ( const PPOConfig & config,
policy_type & policy,
critic_type & critic,
std::unique_ptr< torch::optim::Optimizer > & policy_optimizer,
std::unique_ptr< torch::optim::Optimizer > & critic_optimizer )

PPOSolver Constructor.

Member Function Documentation

◆ on_training_episode()

template<typename EnvType, typename PolicyType, typename CriticType>
EpisodeInfo bitrl::rl::algos::pg::PPOSolver< EnvType, PolicyType, CriticType >::on_training_episode ( env_type & env,
uint_t episode_idx )
finaloverridevirtual

on_episode Do one on_episode of the algorithm

Implements bitrl::rl::algos::RLSolverBase< EnvType >.


The documentation for this class was generated from the following file: