bitsim
Model, simulate, estimate and control robots in C++
Loading...
Searching...
No Matches
dqn.cpp File Reference
#include "bitrl/base/bitrl_config.h"
#include "bitrl/base/bitrl_types.h"
#include "bitrl/maths/optimization/optimizer_type.h"
#include "bitrl/maths/optimization/pytorch_optimizer_factory.h"
#include "bitrl/maths/vector_math.h"
#include "bitrl/rl/policies/epsilon_greedy_policy.h"
#include "bitrl/rl/trainers/rl_serial_agent_trainer.h"
#include "bitrl/utils/torch_adaptor.h"
#include "bitrl/base/bitrl_log.h"
#include "bitrl/envs/grid_world/grid_world_env.h"
#include "bitsim/utils/io/csv_file_writer.h"
#include <torch/torch.h>
#include <any>
#include <filesystem>
#include <fstream>
#include <iostream>
#include <map>
#include <string>
#include <unordered_map>
#include <vector>
Include dependency graph for dqn.cpp:

Classes

class  rl_example_12::QNetImpl
class  rl_example_12::Gridworld< side_size_ >
class  rl_example_12::RLSerialAgentTrainer< EnvType, AgentType >
struct  rl_example_12::RLSerialTrainerConfig
 The RLSerialTrainerConfig struct. Configuration struct for the serial RL agent trainer. More...
class  rl_example_12::EpsilonGreedyPolicy
 The EpsilonGreedyPolicy class. More...
class  rl_example_12::CSVWriter
 The CSVWriter class. Handles writing into CSV file format. More...

Namespaces

namespace  rl_example_12

Typedefs

typedef Gridworld< 4 > rl_example_12::env_type
typedef env_type::state_type rl_example_12::state_type
using rl_example_12::float_t
 float
using rl_example_12::real_t
 real_t
typedef torch::Tensor rl_example_12::torch_tensor_t
 torch_tensor_t
using rl_example_12::uint_t
 uint_t

Functions

 rl_example_12::TORCH_MODULE (QNet)
std::vector< float_t > rl_example_12::flattened_observation (const state_type &state)
int main ()

Variables

const std::string rl_example_12::EXPERIMENT_ID = "3"
constexpr uint_t rl_example_12::l1 = 64
constexpr uint_t rl_example_12::l2 = 150
constexpr uint_t rl_example_12::l3 = 100
constexpr uint_t rl_example_12::l4 = 4
constexpr uint_t rl_example_12::SEED = 42
constexpr uint_t rl_example_12::TOTAL_EPOCHS = 1000
constexpr uint_t rl_example_12::TOTAL_ITRS_PER_EPOCH = 50
constexpr real_t rl_example_12::GAMMA = 0.9
constexpr real_t rl_example_12::EPSILON = 1.0
constexpr real_t rl_example_12::LEARNING_RATE = 1.0e-3

Function Documentation

◆ main()

int main ( )