Implementation of various Q-Learning algorithms, such as DQN, double DQN. More...
Public Types | |
using | ActionType = typename EnvironmentType::Action |
Convenient typedef for action. More... | |
using | StateType = typename EnvironmentType::State |
Convenient typedef for state. More... | |
Public Member Functions | |
QLearning (TrainingConfig &config, NetworkType &network, PolicyType &policy, ReplayType &replayMethod, UpdaterType updater=UpdaterType(), EnvironmentType environment=EnvironmentType()) | |
Create the QLearning object with given settings. More... | |
~QLearning () | |
Clean memory. More... | |
const ActionType & | Action () const |
Get the action of the agent. More... | |
bool & | Deterministic () |
Modify the training mode / test mode indicator. More... | |
const bool & | Deterministic () const |
Get the indicator of training mode / test mode. More... | |
EnvironmentType & | Environment () |
Modify the environment in which the agent is. More... | |
const EnvironmentType & | Environment () const |
Get the environment in which the agent is. More... | |
double | Episode () |
Execute an episode. More... | |
const NetworkType & | Network () const |
Return the learning network. More... | |
NetworkType & | Network () |
Modify the learning network. More... | |
void | SelectAction () |
Select an action, given an agent. More... | |
StateType & | State () |
Modify the state of the agent. More... | |
const StateType & | State () const |
Get the state of the agent. More... | |
size_t & | TotalSteps () |
Modify total steps from beginning. More... | |
const size_t & | TotalSteps () const |
Get total steps from beginning. More... | |
void | TrainAgent () |
Trains the DQN agent(non-categorical). More... | |
void | TrainCategoricalAgent () |
Trains the DQN agent of categorical type. More... | |
Implementation of various Q-Learning algorithms, such as DQN, double DQN.
For more details, see the following:
EnvironmentType | The environment of the reinforcement learning task. |
NetworkType | The network to compute action value. |
UpdaterType | How to apply gradients when training. |
PolicyType | Behavior policy of the agent. |
ReplayType | Experience replay method. |
Definition at line 59 of file q_learning.hpp.
using ActionType = typename EnvironmentType::Action |
Convenient typedef for action.
Definition at line 66 of file q_learning.hpp.
using StateType = typename EnvironmentType::State |
Convenient typedef for state.
Definition at line 63 of file q_learning.hpp.
QLearning | ( | TrainingConfig & | config, |
NetworkType & | network, | ||
PolicyType & | policy, | ||
ReplayType & | replayMethod, | ||
UpdaterType | updater = UpdaterType() , |
||
EnvironmentType | environment = EnvironmentType() |
||
) |
Create the QLearning object with given settings.
If you want to pass in a parameter and discard the original parameter object, be sure to use std::move to avoid unnecessary copy.
config | Hyper-parameters for training. |
network | The network to compute action value. |
policy | Behavior policy of the agent. |
replayMethod | Experience replay method. |
updater | How to apply gradients when training. |
environment | Reinforcement learning task. |
~QLearning | ( | ) |
Clean memory.
|
inline |
Get the action of the agent.
Definition at line 125 of file q_learning.hpp.
|
inline |
Modify the training mode / test mode indicator.
Definition at line 133 of file q_learning.hpp.
|
inline |
Get the indicator of training mode / test mode.
Definition at line 135 of file q_learning.hpp.
|
inline |
Modify the environment in which the agent is.
Definition at line 128 of file q_learning.hpp.
|
inline |
Get the environment in which the agent is.
Definition at line 130 of file q_learning.hpp.
double Episode | ( | ) |
Execute an episode.
|
inline |
Return the learning network.
Definition at line 138 of file q_learning.hpp.
|
inline |
Modify the learning network.
Definition at line 140 of file q_learning.hpp.
void SelectAction | ( | ) |
Select an action, given an agent.
|
inline |
Modify the state of the agent.
Definition at line 120 of file q_learning.hpp.
|
inline |
Get the state of the agent.
Definition at line 122 of file q_learning.hpp.
|
inline |
Modify total steps from beginning.
Definition at line 115 of file q_learning.hpp.
|
inline |
Get total steps from beginning.
Definition at line 117 of file q_learning.hpp.
void TrainAgent | ( | ) |
Trains the DQN agent(non-categorical).
void TrainCategoricalAgent | ( | ) |
Trains the DQN agent of categorical type.