13#ifndef MLPACK_METHODS_RL_Q_LEARNING_HPP
14#define MLPACK_METHODS_RL_Q_LEARNING_HPP
52 typename EnvironmentType,
56 typename ReplayType = RandomReplay<EnvironmentType>
83 ReplayType& replayMethod,
84 UpdaterType updater = UpdaterType(),
85 EnvironmentType environment = EnvironmentType());
129 const EnvironmentType&
Environment()
const {
return environment; }
137 const NetworkType&
Network()
const {
return learningNetwork; }
139 NetworkType&
Network() {
return learningNetwork; }
147 arma::Col<size_t> BestAction(
const arma::mat& actionValues);
153 NetworkType& learningNetwork;
156 NetworkType targetNetwork;
162 ReplayType& replayMethod;
166 #if ENS_VERSION_MAJOR >= 2
167 typename UpdaterType::template Policy<arma::mat, arma::mat>* updatePolicy;
171 EnvironmentType environment;
190#include "q_learning_impl.hpp"
Implementation of various Q-Learning algorithms, such as DQN, double DQN.
StateType & State()
Modify the state of the agent.
double Episode()
Execute an episode.
QLearning(TrainingConfig &config, NetworkType &network, PolicyType &policy, ReplayType &replayMethod, UpdaterType updater=UpdaterType(), EnvironmentType environment=EnvironmentType())
Create the QLearning object with given settings.
~QLearning()
Clean memory.
void TrainCategoricalAgent()
Trains the DQN agent of categorical type.
NetworkType & Network()
Modify the learning network.
size_t & TotalSteps()
Modify total steps from beginning.
const bool & Deterministic() const
Get the indicator of training mode / test mode.
const size_t & TotalSteps() const
Get total steps from beginning.
bool & Deterministic()
Modify the training mode / test mode indicator.
typename EnvironmentType::Action ActionType
Convenient typedef for action.
const StateType & State() const
Get the state of the agent.
const ActionType & Action() const
Get the action of the agent.
void SelectAction()
Select an action, given an agent.
typename EnvironmentType::State StateType
Convenient typedef for state.
void TrainAgent()
Trains the DQN agent(non-categorical).
EnvironmentType & Environment()
Modify the environment in which the agent is.
const EnvironmentType & Environment() const
Get the environment in which the agent is.
const NetworkType & Network() const
Return the learning network.
Linear algebra utility functions, generally performed on matrices or vectors.
The core includes that mlpack expects; standard C++ includes and Armadillo.