bitsim
Model, simulate, estimate and control robots in C++
Loading...
Searching...
No Matches
example_26::RLSerialAgentTrainer< EnvType, AgentType > Class Template Reference

#include <rl_serial_agent_trainer.h>

Inheritance diagram for example_26::RLSerialAgentTrainer< EnvType, AgentType >:
Collaboration diagram for example_26::RLSerialAgentTrainer< EnvType, AgentType >:

Public Types

typedef EnvType env_type
typedef AgentType agent_type

Public Member Functions

 RLSerialAgentTrainer (const RLSerialTrainerConfig &config, agent_type &agent)
 RLSerialAgentTrainer.
virtual bitrl::utils::IterativeAlgorithmResult train (env_type &env)
 train Iterate to train the agent on the given environment
virtual void actions_before_training_begins (env_type &)
 actions_before_training_begins. Execute any actions the algorithm needs before starting the episode
virtual void actions_before_episode_begins (env_type &, uint_t)
 actions_before_episode_begins. Execute any actions the algorithm needs before starting the episode
virtual void actions_after_episode_ends (env_type &, uint_t, const EpisodeInfo &einfo)
 actions_after_episode_ends. Execute any actions the algorithm needs after ending the episode
virtual void actions_after_training_ends (env_type &)
 actions_after_training_ends. Execute any actions the algorithm needs after the iterations are finished
const std::vector< real_t > & episodes_total_rewards () const noexcept
 episodes_total_rewards
const std::vector< uint_t > & n_itrs_per_episode () const noexcept
 n_itrs_per_episode

Protected Attributes

uint_t output_msg_frequency_
bitrl::utils::IterativeAlgorithmController itr_ctrl_
 itr_ctrl_ Handles the iteration over the episodes
agent_type & agent_
 agent_
std::vector< real_t > total_reward_per_episode_
 total_reward_per_episode_
std::vector< uint_t > n_itrs_per_episode_
 n_itrs_per_episode_ Holds the number of iterations performed per training episode

Detailed Description

template<typename EnvType, typename AgentType>
class example_26::RLSerialAgentTrainer< EnvType, AgentType >

\detailed The RLSerialAgentTrainer class handles the training for serial reinforcement learning agents

Member Typedef Documentation

◆ agent_type

template<typename EnvType, typename AgentType>
typedef AgentType bitrl::rl::RLSerialAgentTrainer< EnvType, AgentType >::agent_type

◆ env_type

template<typename EnvType, typename AgentType>
typedef EnvType bitrl::rl::RLSerialAgentTrainer< EnvType, AgentType >::env_type

Constructor & Destructor Documentation

◆ RLSerialAgentTrainer()

template<typename EnvType, typename AgentType>
bitrl::rl::RLSerialAgentTrainer< EnvType, AgentType >::RLSerialAgentTrainer ( const RLSerialTrainerConfig & config,
agent_type & agent )

RLSerialAgentTrainer.

Parameters
config
agent

Member Function Documentation

◆ actions_after_episode_ends()

template<typename EnvType, typename AgentType>
void bitrl::rl::RLSerialAgentTrainer< EnvType, AgentType >::actions_after_episode_ends ( env_type & env,
uint_t episode_idx,
const EpisodeInfo & einfo )
virtual

actions_after_episode_ends. Execute any actions the algorithm needs after ending the episode

◆ actions_after_training_ends()

template<typename EnvType, typename AgentType>
void bitrl::rl::RLSerialAgentTrainer< EnvType, AgentType >::actions_after_training_ends ( env_type & env)
virtual

actions_after_training_ends. Execute any actions the algorithm needs after the iterations are finished

◆ actions_before_episode_begins()

template<typename EnvType, typename AgentType>
void bitrl::rl::RLSerialAgentTrainer< EnvType, AgentType >::actions_before_episode_begins ( env_type & env,
uint_t episode_idx )
virtual

actions_before_episode_begins. Execute any actions the algorithm needs before starting the episode

◆ actions_before_training_begins()

template<typename EnvType, typename AgentType>
void bitrl::rl::RLSerialAgentTrainer< EnvType, AgentType >::actions_before_training_begins ( env_type & env)
virtual

actions_before_training_begins. Execute any actions the algorithm needs before starting the episode

◆ episodes_total_rewards()

template<typename EnvType, typename AgentType>
const std::vector< real_t > & bitrl::rl::RLSerialAgentTrainer< EnvType, AgentType >::episodes_total_rewards ( ) const
inlinenoexcept

episodes_total_rewards

Returns

◆ n_itrs_per_episode()

template<typename EnvType, typename AgentType>
const std::vector< uint_t > & bitrl::rl::RLSerialAgentTrainer< EnvType, AgentType >::n_itrs_per_episode ( ) const
inlinenoexcept

n_itrs_per_episode

Returns

◆ train()

template<typename EnvType, typename AgentType>
bitrl::utils::IterativeAlgorithmResult bitrl::rl::RLSerialAgentTrainer< EnvType, AgentType >::train ( env_type & env)
virtual

train Iterate to train the agent on the given environment

Member Data Documentation

◆ agent_

template<typename EnvType, typename AgentType>
agent_type& bitrl::rl::RLSerialAgentTrainer< EnvType, AgentType >::agent_
protected

agent_

◆ itr_ctrl_

template<typename EnvType, typename AgentType>
bitrl::utils::IterativeAlgorithmController bitrl::rl::RLSerialAgentTrainer< EnvType, AgentType >::itr_ctrl_
protected

itr_ctrl_ Handles the iteration over the episodes

◆ n_itrs_per_episode_

template<typename EnvType, typename AgentType>
std::vector<uint_t> bitrl::rl::RLSerialAgentTrainer< EnvType, AgentType >::n_itrs_per_episode_
protected

n_itrs_per_episode_ Holds the number of iterations performed per training episode

◆ output_msg_frequency_

template<typename EnvType, typename AgentType>
uint_t bitrl::rl::RLSerialAgentTrainer< EnvType, AgentType >::output_msg_frequency_
protected

◆ total_reward_per_episode_

template<typename EnvType, typename AgentType>
std::vector<real_t> bitrl::rl::RLSerialAgentTrainer< EnvType, AgentType >::total_reward_per_episode_
protected

total_reward_per_episode_


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