https://github.com/hrshl212/td3-libtorch
TD3 reinforcement learning algorithm using libtorch in simple environment
https://github.com/hrshl212/td3-libtorch
deep-reinforcement-learning libtorch pytorch reinforcement-learning
Last synced: about 1 month ago
JSON representation
TD3 reinforcement learning algorithm using libtorch in simple environment
- Host: GitHub
- URL: https://github.com/hrshl212/td3-libtorch
- Owner: hrshl212
- Created: 2022-02-09T10:34:00.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2024-06-11T19:58:24.000Z (about 2 years ago)
- Last Synced: 2024-06-12T04:42:04.400Z (about 2 years ago)
- Topics: deep-reinforcement-learning, libtorch, pytorch, reinforcement-learning
- Language: Makefile
- Homepage:
- Size: 19.6 MB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# TD3-Pytorch-C++-
TD3 deep reinforcement learning algorithm using C++/libtorch in simple environment of finding shortest distance between two points. The environment is taken from https://github.com/mhubii/ppo_libtorch
This is an implementation of the twin-delayed deep deterministic (TD3) policy gradient algorithm for the C++ API of Pytorch. It uses a simple TestEnvironment to test the algorithm. Below is a small visualization of the environment, the algorithm is tested in.

Fig. 1: The agent in training during epoch 30.
You first need to install LibTorch. I used the version 1.4.0+cpu.
Do
```
mkdir build
cd build
cmake -DCMAKE_PREFIX_PATH=/absolut/path/to/libtorch ..
make
```
# Run
Run the executable with
```
cd build
./train_ppo
```
It should produce something like shown below.


Fig. 2: From left to right, the agent for successive epochs in training mode as it takes actions in the environment to reach the goal.
# Visualization
The results are saved to data/data.csv and can be visualized by running python plot.py.