bitsim
Model, simulate, estimate and control robots in C++
Loading...
Searching...
No Matches
ppo_cartpole.cpp File Reference
#include "bitrl/base/bitrl_types.h"
#include "bitrl/envs/gymnasium/classic_control/cart_pole_env.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/network/rest_rl_env_client.h"
#include "bitrl/rl/algorithms/pg/ppo.h"
#include "bitrl/rl/algorithms/pg/ppo_config.h"
#include "bitrl/rl/trainers/rl_serial_agent_trainer.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 <tuple>
#include <unordered_map>
#include <vector>
Include dependency graph for ppo_cartpole.cpp:

Classes

struct  ppo_cartpole::ActorImpl
struct  ppo_cartpole::CriticImpl
class  ppo_cartpole::TorchCategorical

Namespaces

namespace  ppo_cartpole

Typedefs

typedef bitrl::envs::gymnasium::CartPole ppo_cartpole::env_type
typedef bitrl::rl::algos::pg::PPOSolver< env_type, Actor, Critic > ppo_cartpole::solver_type
using ppo_cartpole::real_t
 real_t
typedef torch::Tensor ppo_cartpole::torch_tensor_t
 torch_tensor_t
using ppo_cartpole::uint_t
 uint_t

Functions

torch_tensor_t ppo_cartpole::to_tensor (const std::vector< real_t > &state)
 ppo_cartpole::TORCH_MODULE (Actor)
 ppo_cartpole::TORCH_MODULE (Critic)
int main ()

Variables

const std::string ppo_cartpole::SERVER_URL = "http://0.0.0.0:8001/api"
const uint_t ppo_cartpole::SEED = 42
const uint_t ppo_cartpole::N_EPISODES = 500
const uint_t ppo_cartpole::MAX_STEPS = 500
const real_t ppo_cartpole::LEARNING_RATE = 0.001

Function Documentation

◆ main()

int main ( )