bitsim
Model, simulate, estimate and control robots in C++
Loading...
Searching...
No Matches
reinforce.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/statistics/distributions/torch_categorical.h"
#include "bitrl/rl/algorithms/pg/reinforce.h"
#include "bitrl/rl/algorithms/pg/reinforce_config.h"
#include "bitrl/rl/trainers/rl_serial_agent_trainer.h"
#include "bitrl/base/bitrl_log.h"
#include "bitrl/envs/gymnasium/classic_control/cart_pole_env.h"
#include "bitrl/network/rest_rl_env_client.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 dependency graph for reinforce.cpp:

Classes

class  rl_example_13::PolicyNetImpl
class  rl_example_13::CartPole
 The CartPole class Interface for CartPole environment. More...
class  rl_example_13::TorchCategorical
class  rl_example_13::RESTRLEnvClient
 Utility class to facilitate HTTP requests between the environments REST API and C++ drivers. More...
class  rl_example_13::RLSerialAgentTrainer< EnvType, AgentType >
struct  rl_example_13::RLSerialTrainerConfig
 The RLSerialTrainerConfig struct. Configuration struct for the serial RL agent trainer. More...
struct  rl_example_13::ReinforceConfig
 The ReinforceOpts struct. Holds various configuration options for the Reinforce algorithm. More...
class  rl_example_13::ReinforceSolver< EnvType, PolicyType >
 The ReinforceSolver class. The ReinforceSolver trains a policy represented by the PolicyTp template parameter on the environment represented by the EnvType parameter. More...

Namespaces

namespace  rl_example_13

Typedefs

typedef CartPole rl_example_13::env_type
typedef PolicyNet rl_example_13::policy_type
typedef ReinforceSolver< env_type, PolicyNet > rl_example_13::solver_type
using rl_example_13::float_t
 float
using rl_example_13::int_t
 integer type
using rl_example_13::real_t
 real_t
typedef torch::Tensor rl_example_13::torch_tensor_t
 torch_tensor_t
using rl_example_13::uint_t
 uint_t

Enumerations

enum class  rl_example_13::DeviceType
 Enumeration of various device types. More...

Functions

 rl_example_13::TORCH_MODULE (PolicyNet)
int main ()

Variables

const std::string rl_example_13::SERVER_URL = "http://0.0.0.0:8001/api"
const std::string rl_example_13::EXPERIMENT_ID = "2"
const std::string rl_example_13::POLICY = "policy.csv"
const uint_t rl_example_13::L1 = 4
const uint_t rl_example_13::L2 = 128
const uint_t rl_example_13::L3 = 2
const real_t rl_example_13::LEARNING_RATE = 0.01

Function Documentation

◆ main()

int main ( )