OneStepSarsaWorker< EnvironmentType, NetworkType, UpdaterType, PolicyType > Class Template Reference

Forward declaration of OneStepSarsaWorker. More...

Public Types

using ActionType = typename EnvironmentType::Action
 
using StateType = typename EnvironmentType::State
 
using TransitionType = std::tuple< StateType, ActionType, double, StateType, ActionType >
 

Public Member Functions

 OneStepSarsaWorker (const UpdaterType &updater, const EnvironmentType &environment, const TrainingConfig &config, bool deterministic)
 Construct one step sarsa worker with the given parameters and environment. More...

 
 OneStepSarsaWorker (const OneStepSarsaWorker &other)
 Copy another OneStepSarsaWorker. More...

 
 OneStepSarsaWorker (OneStepSarsaWorker &&other)
 Take ownership of another OneStepSarsaWorker. More...

 
 ~OneStepSarsaWorker ()
 Clean memory. More...

 
void Initialize (NetworkType &learningNetwork)
 Initialize the worker. More...

 
OneStepSarsaWorkeroperator= (const OneStepSarsaWorker &other)
 Copy another OneStepSarsaWorker. More...

 
OneStepSarsaWorkeroperator= (OneStepSarsaWorker &&other)
 Take ownership of another OneStepSarsaWorker. More...

 
bool Step (NetworkType &learningNetwork, NetworkType &targetNetwork, size_t &totalSteps, PolicyType &policy, double &totalReward)
 The agent will execute one step. More...

 

Detailed Description


template
<
typename
EnvironmentType
,
typename
NetworkType
,
typename
UpdaterType
,
typename
PolicyType
>

class mlpack::rl::OneStepSarsaWorker< EnvironmentType, NetworkType, UpdaterType, PolicyType >

Forward declaration of OneStepSarsaWorker.

One step Sarsa worker.

Template Parameters
EnvironmentTypeThe type of the reinforcement learning task.
NetworkTypeThe type of the network model.
UpdaterTypeThe type of the optimizer.
PolicyTypeThe type of the behavior policy.

Definition at line 163 of file async_learning.hpp.

Member Typedef Documentation

◆ ActionType

using ActionType = typename EnvironmentType::Action

Definition at line 39 of file one_step_sarsa_worker.hpp.

◆ StateType

using StateType = typename EnvironmentType::State

Definition at line 38 of file one_step_sarsa_worker.hpp.

◆ TransitionType

using TransitionType = std::tuple<StateType, ActionType, double, StateType, ActionType>

Definition at line 41 of file one_step_sarsa_worker.hpp.

Constructor & Destructor Documentation

◆ OneStepSarsaWorker() [1/3]

OneStepSarsaWorker ( const UpdaterType &  updater,
const EnvironmentType &  environment,
const TrainingConfig config,
bool  deterministic 
)
inline

Construct one step sarsa worker with the given parameters and environment.

Parameters
updaterThe optimizer.
environmentThe reinforcement learning task.
configHyper-parameters.
deterministicWhether it should be deterministic.

Definition at line 52 of file one_step_sarsa_worker.hpp.

◆ OneStepSarsaWorker() [2/3]

OneStepSarsaWorker ( const OneStepSarsaWorker< EnvironmentType, NetworkType, UpdaterType, PolicyType > &  other)
inline

Copy another OneStepSarsaWorker.

Parameters
otherOneStepSarsaWorker to copy.

Definition at line 72 of file one_step_sarsa_worker.hpp.

◆ OneStepSarsaWorker() [3/3]

OneStepSarsaWorker ( OneStepSarsaWorker< EnvironmentType, NetworkType, UpdaterType, PolicyType > &&  other)
inline

Take ownership of another OneStepSarsaWorker.

Parameters
otherOneStepSarsaWorker to take ownership of.

Definition at line 103 of file one_step_sarsa_worker.hpp.

◆ ~OneStepSarsaWorker()

~OneStepSarsaWorker ( )
inline

Clean memory.

Definition at line 208 of file one_step_sarsa_worker.hpp.

Member Function Documentation

◆ Initialize()

void Initialize ( NetworkType &  learningNetwork)
inline

Initialize the worker.

Parameters
learningNetworkThe shared network.

Definition at line 219 of file one_step_sarsa_worker.hpp.

◆ operator=() [1/2]

OneStepSarsaWorker& operator= ( const OneStepSarsaWorker< EnvironmentType, NetworkType, UpdaterType, PolicyType > &  other)
inline

Copy another OneStepSarsaWorker.

Parameters
otherOneStepSarsaWorker to copy.

Definition at line 134 of file one_step_sarsa_worker.hpp.

◆ operator=() [2/2]

OneStepSarsaWorker& operator= ( OneStepSarsaWorker< EnvironmentType, NetworkType, UpdaterType, PolicyType > &&  other)
inline

Take ownership of another OneStepSarsaWorker.

Parameters
otherOneStepSarsaWorker to take ownership of.

Definition at line 172 of file one_step_sarsa_worker.hpp.

◆ Step()

bool Step ( NetworkType &  learningNetwork,
NetworkType &  targetNetwork,
size_t &  totalSteps,
PolicyType &  policy,
double &  totalReward 
)
inline

The agent will execute one step.

Parameters
learningNetworkThe shared learning network.
targetNetworkThe shared target network.
totalStepsThe shared counter for total steps.
policyThe shared behavior policy.
totalRewardThis will be the episode return if the episode ends after this step. Otherwise this is invalid.
Returns
Indicate whether current episode ends after this step.

Definition at line 248 of file one_step_sarsa_worker.hpp.

References TrainingConfig::Discount(), TrainingConfig::GradientLimit(), TrainingConfig::StepLimit(), TrainingConfig::StepSize(), TrainingConfig::TargetNetworkSyncInterval(), and TrainingConfig::UpdateInterval().


The documentation for this class was generated from the following files:
  • /home/jenkins-mlpack/mlpack.org/_src/mlpack-3.2.1/src/mlpack/methods/reinforcement_learning/async_learning.hpp
  • /home/jenkins-mlpack/mlpack.org/_src/mlpack-3.2.1/src/mlpack/methods/reinforcement_learning/worker/one_step_sarsa_worker.hpp