struct Dqn {
struct Mlp q;
struct Mlp target;
struct Optimizer opt;
struct ReplayBuffer buffer;
struct DqnConfig cfg;
struct Rng rng;
struct TensorArena stepArena;
unsigned long obsDim;
unsigned long actions;
unsigned long steps;
unsigned long updates;
float lastLoss;
}Fields
environment steps observed
gradient steps taken
Methods
explore 1: epsilon-greedy with the current epsilon; 0: greedy.
§
float observe(
const &FloatTensor obs,
unsigned long action,
float reward,
const &FloatTensor next,
int terminal,
)source · definitionStores the transition and trains when due; returns the loss, or -1 when no gradient step ran.
Parameterized (module.h): the Q network's parameters; the state adds the target network.
= drop()
§
static struct Dqn new(unsigned long obsDim, unsigned long actions, const &DqnConfig cfg)source · definition