|
bitsim
Model, simulate, estimate and control robots in C++
|
#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/distributed_ppo.h"#include "bitrl/rl/algorithms/pg/parallel_ppo.h"#include "bitrl/rl/algorithms/pg/ppo_config.h"#include "bitrl/rl/distributed/communicator.h"#include "bitsim/utils/concurrency/parallel.h"#include "bitsim/utils/io/print_utils.h"#include <ATen/CPUGeneratorImpl.h>#include <torch/torch.h>#include <algorithm>#include <any>#include <chrono>#include <cstdint>#include <cstdlib>#include <iomanip>#include <iostream>#include <map>#include <memory>#include <string>#include <thread>#include <tuple>#include <vector>
Classes | |
| struct | ppo_distributed::ActorImpl |
| struct | ppo_distributed::CriticImpl |
| struct | ppo_distributed::Networks |
| struct | ppo_distributed::Rank |
| class | ppo_distributed::ParallelEnvs< EnvType > |
| Several copies of an environment, stepped at the same time on the threads of a bitsim::utils::concurrency::ThreadPool. More... | |
| class | ppo_distributed::CartPole |
| The cart-pole of Barto, Sutton and Anderson, simulated in this process with bitsim::dynamics::CartPoleDynamics. More... | |
| class | ppo_distributed::TorchCategorical |
| class | ppo_distributed::Communicator |
| How the ranks of a distributed training exchange numbers. More... | |
| class | ppo_distributed::TCPStoreCommunicator |
| A Communicator through c10d::TCPStore, the key-value store that comes with libtorch. More... | |
Namespaces | |
| namespace | ppo_distributed |
Typedefs | |
| using | ppo_distributed::steady = std::chrono::steady_clock |
| using | ppo_distributed::real_t |
| real_t | |
| typedef torch::Tensor | ppo_distributed::torch_tensor_t |
| torch_tensor_t | |
| using | ppo_distributed::uint_t |
| uint_t | |
Functions | |
| ppo_distributed::TORCH_MODULE (Actor) | |
| ppo_distributed::TORCH_MODULE (Critic) | |
| pg::PPOConfig | ppo_distributed::ppo_config (uint_t n_rounds) |
| real_t | ppo_distributed::greedy_return (Actor &actor) |
| real_t | ppo_distributed::seconds (steady::duration d) |
| real_t | ppo_distributed::tail_mean (const std::vector< real_t > &v) |
| Rank | ppo_distributed::train_rank (Communicator &communicator, Networks &nets, uint_t n_rounds, uint_t n_copies) |
| Rank | ppo_distributed::one_thread (uint_t n_rounds, uint_t n_copies) |
| void | ppo_distributed::report (const std::string &name, const Rank &r) |
| bool | ppo_distributed::compare (const std::string &title, uint_t n_episodes, uint_t n_ranks, uint_t n_copies, uint_t port) |
| int | ppo_distributed::run_threads (uint_t n_episodes, uint_t n_ranks, uint_t n_copies, uint_t port) |
| int | ppo_distributed::run_rank (uint_t rank, uint_t n_episodes, uint_t n_ranks, uint_t n_copies, const std::string &host, uint_t port) |
| int | main (int argc, char **argv) |
| uint_t | ppo_distributed::task_seed (uint_t base_seed, uint_t task) noexcept |
| A seed for task task, made from base_seed. | |
Variables | |
| const uint_t | ppo_distributed::SEED = 42 |
| const uint_t | ppo_distributed::MAX_STEPS = 500 |
| const real_t | ppo_distributed::LEARNING_RATE = 0.001 |
| int main | ( | int | argc, |
| char ** | argv ) |