bitsim
Model, simulate, estimate and control robots in C++
Loading...
Searching...
No Matches
ppo_parallel_rollouts.cpp File Reference
#include "bitrl/base/bitrl_types.h"
#include "bitrl/envs/classic_control/cart_pole.h"
#include "bitrl/envs/parallel_envs.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/parallel_ppo.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/concurrency/thread_pool.h"
#include "bitsim/utils/io/print_utils.h"
#include <torch/torch.h>
#include <algorithm>
#include <any>
#include <chrono>
#include <cstdlib>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <map>
#include <string>
#include <tuple>
#include <unordered_map>
#include <vector>
Include dependency graph for ppo_parallel_rollouts.cpp:

Classes

struct  ppo_parallel_rollouts::ActorImpl
struct  ppo_parallel_rollouts::CriticImpl
struct  ppo_parallel_rollouts::SlowCartPole
struct  ppo_parallel_rollouts::Networks
struct  ppo_parallel_rollouts::Training
class  ppo_parallel_rollouts::ParallelEnvs< EnvType >
 Several copies of an environment, stepped at the same time on the threads of a bitsim::utils::concurrency::ThreadPool. More...
class  ppo_parallel_rollouts::CartPole
 The cart-pole of Barto, Sutton and Anderson, simulated in this process with bitsim::dynamics::CartPoleDynamics. More...
class  ppo_parallel_rollouts::TorchCategorical

Namespaces

namespace  ppo_parallel_rollouts

Typedefs

using ppo_parallel_rollouts::steady = std::chrono::steady_clock
using ppo_parallel_rollouts::real_t
 real_t
typedef torch::Tensor ppo_parallel_rollouts::torch_tensor_t
 torch_tensor_t
using ppo_parallel_rollouts::uint_t
 uint_t

Functions

torch_tensor_t ppo_parallel_rollouts::to_tensor (const std::vector< real_t > &state)
 ppo_parallel_rollouts::TORCH_MODULE (Actor)
 ppo_parallel_rollouts::TORCH_MODULE (Critic)
pg::PPOConfig ppo_parallel_rollouts::ppo_config ()
real_t ppo_parallel_rollouts::greedy_return (Actor &actor)
real_t ppo_parallel_rollouts::seconds (steady::duration d)
real_t ppo_parallel_rollouts::tail_mean (const std::vector< real_t > &v)
Training ppo_parallel_rollouts::one_at_a_time (uint_t n_episodes)
template<typename Env>
Training ppo_parallel_rollouts::in_rounds (uint_t n_episodes, uint_t n_copies, bool threads, uint_t max_rounds=0)
void ppo_parallel_rollouts::report (const std::string &name, const Training &t)
int ppo_parallel_rollouts::run (uint_t n_episodes, uint_t n_copies)
int main (int argc, char **argv)

Variables

const uint_t ppo_parallel_rollouts::SEED = 42
const uint_t ppo_parallel_rollouts::MAX_STEPS = 500
const real_t ppo_parallel_rollouts::LEARNING_RATE = 0.001

Function Documentation

◆ main()

int main ( int argc,
char ** argv )