bitsim
Model, simulate, estimate and control robots in C++
Loading...
Searching...
No Matches
bitrl

bitrl is a C++20 library for reinforcement learning, built on bitsim. It has environments, from grid worlds, Connect2 and multi-armed bandits to bitsim's robots in Project Chrono and Gymnasium's environments, and the algorithms that learn in them, from dynamic programming to proximal policy optimization. Its deep reinforcement learning uses libtorch, the C++ API of PyTorch. The source is on GitHub.

PPO learns to land Gymnasium's LunarLander, with continuous throttles. Example Monte Carlo tree search drives bitsim's Chrono robot around a track and around boxes, planning every 0.2 s. Example

The paths four temporal difference methods learn on CliffWalking: Q-learning walks along the edge of the cliff, SARSA keeps away from it. Example Value iteration on FrozenLake: the values spread back from the goal, sweep by sweep. Example

What is in it

Area What bitrl has
Environments grid worlds, Connect2, multi-armed bandits, GymWalk, bitsim robots in Chrono, and Gymnasium's FrozenLake, CliffWalking, Taxi, Blackjack, CartPole, MountainCar, Pendulum, Acrobot and LunarLander
Dynamic programming iterative policy evaluation, policy iteration, value iteration
Monte Carlo first visit Monte Carlo, Monte Carlo tree search
Temporal difference SARSA, Q-learning, expected SARSA, double Q-learning
Policy gradients REINFORCE, with and without a baseline, A2C, PPO
Policies epsilon-greedy with decay, soft-max, greedy and uniform tabular policies
Tools experience replay buffers, trainers, policies saved to and loaded from files, Tensorboard logging, PyTorch distributions and optimizers
Parallel and distributed many copies of an environment, PPO from several episodes at once, every agent in a process of its own, PPO over several processes or machines. See Parallel and distributed training

Gymnasium environments

The Gymnasium environments run in Python, on the bitrl-rest-api server, and bitrl talks to them over HTTP, at http://0.0.0.0:8001/api by default. Start the server before you run the code that uses them. The other environments, the grid worlds, Connect2, the bandits and the Chrono robots, run in bitrl itself.

Where to start

  • Installing bitrl lists what bitrl needs, and explains how to build and install it.
  • The examples build on each other: the basic ideas of reinforcement learning, the PyTorch C++ API, running and logging experiments, the environments, and then the algorithms, from bandits to deep reinforcement learning. Each has a page that explains it, and every algorithm's ends by showing what it learned.