his repository presents a comprehensive study on reinforcement learning (RL) algorithms applied to a custom MuJoCo Hopper environment. The project aims to build robust locomotion policies under uncertain dynamics using:
- Classic Policy Gradient Methods: REINFORCE, Actor-Critic
- Advanced On-Policy Algorithms: Proximal Policy Optimization (PPO)
- Robustness Techniques: Domain Randomization (UDR), Curriculum Learning (CDR), Entropy Scheduling (ES)
Click to watch the full 15-second demo
. βββ src/ # Core code (Python package) β βββ agents/ # RL algorithm implementations β βββ env/ # Custom MuJoCo-Hopper wrappers β βββ evaluation/ # Metrics, plotting, helper scripts β βββ training/ # Training entry-points & configs β βββ Logs/ # Raw tensorboard/CSV logs β βββ Learning_Curve/ # β’ learning-curve CSVs β βββ PPO_episode_rewards/ # β’ per-episode returns β βββ PPO_robustness/ # β’ domain-randomisation runs β βββ PPO_runtime_tmp/ # β’ scratch & tmp logs β βββ actor_critic/ # β’ AC experiments β βββ baseline/ # β’ REINFORCE baseline runs β βββ models/ β βββ PPO/ β βββ actor_critic/ β βββ reinforce_baseline/ β βββ render/ # Visual outputs (GIF/MP4/PNG) β βββ plots/ β βββ requirements.txt # Python dependencies βββ README.md # You are here π βββ __init__.py # Makes repo import-able (`import rl_master`) βββ .idea/ # IDE settings (β’ add to .gitignore) βββ __pycache__/ # Byte-code cache (auto-generated)
The environment is based on a custom subclass of the MuJoCo Hopper (custom_hopper.py), extended with:
- Parameter Randomization: friction, damping, body mass, initial state
- Domain Randomization:
- Uniform DR (UDR): randomized every episode
- Curriculum DR (ES-CDR): difficulty scaled with agent performance and return entropy
| Algorithm | Description |
|---|---|
| REINFORCE | Monte Carlo policy gradient with optional baseline |
| Actor-Critic | TD-based policy/value method |
| PPO | Clipped surrogate objective with GAE (Stable-Baselines3) |
| UDR | Domain variation with uniform sampling |
| ES-CDR | Return entropy-driven difficulty adjustment |
Install the required packages:
pip install -r requirements.txt
Youβll need MuJoCo 2.1+ properly installed and licensed. Refer to: π https://github.com/openai/mujoco-py#install-mujoco
From the root directory, run:
# REINFORCE python src/training/Train_Reinforce_vanila.py # REINFORCE with baseline python src/training/Train_Baseline.py # Actor-Critic python src/training/Train_Actor_Critic.py # PPO + UDR + ES-CDR python src/training/PPO_UDR_ES_CDR.py --Domain cdr --Entropy_Scheduling True --seed 0
python src/training/PPO_Hyperparameter_Calculation.py
You can adjust sweep parameters via JSON or inline config.
Training metrics (returns, entropy, etc.) are saved as CSV in the Logs/ directory.
To plot results:
python evaluation/plot_csv_scripts/plot_metrics.py
Or use the built-in metric utilities in src/evaluation.
Implemented in src/env/custom_hopper.py, our environment introduces:
- Dynamic randomization of:
- Mass, friction, damping, init pose
- UDR: Resampled every episode
- CDR + ES: Difficulty increases based on policy performance and entropy
This project extends PPO with adaptive training difficulty using:
CDR gradually increases the range of domain parameters (e.g., torso mass, friction) during training, helping the agent:
- First master simple dynamics.
- Then adapt to complex, realistic scenarios.
Use it with:
--Domain cdr
ES monitors the policyβs return entropy. When the agent is confident (low entropy), it:
- Advances the curriculum level.
- Makes the environment harder.
Enable it with:
--Entropy_Scheduling True
python src/training/PPO_UDR_ES_CDR.py --Domain cdr --Entropy_Scheduling True --seed 0
| Level | Mean Return | Std Dev | Return Entropy |
|---|---|---|---|
| 1 | 820 | Β±50 | 1.02 |
| 2 | 710 | Β±70 | 1.30 |
| 3 | 665 | Β±85 | 1.48 |
- OpenAI Baselines
- Stable-Baselines3 Docs
- MuJoCo Documentation
- Add evaluation over unseen dynamics
- Experiment with off-policy algorithms (e.g., SAC, DDPG)
- Integrate video rendering and performance visualizations
Please reach out via GitHub issues or Linkedin profiles.