University project for training and evaluating reinforcement learning agents in OpenAI Gym environments using DQN.

Overview

Reinforcement Learning Gym

Train and evaluate reinforcement learning agents in OpenAI Gym environments using Deep Q-learning (DQN).

Pong-v5 graph Pong-v5 graph

Environments

The following environments are implemented for training and evaluating:

Classic Control

  • CartPole
  • MountainCar
  • Acrobot

Atari

  • Pong
  • Breakout

more can be added, and hyperparameters can be tuned in config.py

Trained Models

The following are trained models included in this repository for evaluation:

Classic Control

  • CartPole-v1
  • Acrobot-v1

Atari

  • Pong-v0
  • Pong-v5

Each trained model can be found in the /models directory.

Demonstration videos of trained models can be found in the OpenAI Gym YouTube playlist.

Setup

For training and evaluating the OpenAI Gym environments with a GPU, the following setup has been used:

  • Anaconda 2.11
  • CUDA 11.3
  • Python 3.10
  • PyTorch 1.11
  • OpenAI gym 0.24

Install

pip install -r requirements.txt

Run

CartPole

CartPole-v1 video

CartPole-v0

Train

python src/train.py --env CartPole-v0 --eval_freq <int> --num_eval_episodes <int>

Evaluate

python src/evaluate.py --env CartPole-v0 --num_eval_episodes <int> --is_render --is_record

CartPole-v1

Train

python src/train.py --env CartPole-v1 --eval_freq <int> --num_eval_episodes <int>

Evaluate

python src/evaluate.py --env CartPole-v1 --num_eval_episodes <int> --is_render --is_record

Acrobot

Acrobot-v1 video

Acrobot-v1

Train

python src/train.py --env Acrobot-v1 --eval_freq <int> --num_eval_episodes <int>

Evaluate

python src/evaluate.py --env Acrobot-v1 --num_eval_episodes <int> --is_render --is_record

MountainCar

MountainCar-v0

Train

python src/train.py --env MountainCar-v0 --eval_freq <int> --num_eval_episodes <int>

Evaluate

python src/evaluate.py --env MountainCar-v0 --num_eval_episodes <int> --is_render --is_record

Pong

Pong-v5 video

Pong-v0

Train

python src/train.py --env Pong-v0 --eval_freq <int> --num_eval_episodes <int>

Evaluate

python src/evaluate.py --env Pong-v0 --num_eval_episodes <int> --is_render --is_record

Pong-v4

Train

python src/train.py --env Pong-v4 --eval_freq <int> --num_eval_episodes <int>

Evaluate

python src/evaluate.py --env Pong-v4 --num_eval_episodes <int> --is_render --is_record

Pong-v5

Train

python src/train.py --env ALE/Pong-v5 --eval_freq <int> --num_eval_episodes <int>

Evaluate

python src/evaluate.py --env ALE/Pong-v5 --num_eval_episodes <int> --is_render --is_record

Breakout

Breakout-v0

Train

python src/train.py --env Breakout-v0 --eval_freq <int> --num_eval_episodes <int>

Evaluate

python src/evaluate.py --env Breakout-v0 --num_eval_episodes <int> --is_render --is_record

Breakout-v4

Train

python src/train.py --env Breakout-v4 --eval_freq <int> --num_eval_episodes <int>

Evaluate

python src/evaluate.py --env Breakout-v4 --num_eval_episodes <int> --is_render --is_record

Breakout-v5

Train

python src/train.py --env ALE/Breakout-v5 --eval_freq <int> --num_eval_episodes <int>

Evaluate

python src/evaluate.py --env ALE/Breakout-v5 --num_eval_episodes <int> --is_render --is_record
You might also like...

Reinforcement learning agents take on osu!

neurosama training reinforcement learning agents with a 100% vision based approach custom gym environment is not a wrapper - built without interacting

Sep 4, 2022

Final Project of Istanbul Technical University BLG-638E (Deep Reinforcement Learning) Lecture

Final Project of Istanbul Technical University BLG-638E (Deep Reinforcement Learning) Lecture

Deep Reinforcement Learning Final Racing Project Final Project of Istanbul Technical University BLG-638E (Deep Reinforcement Learning) Lecture How to

Jun 17, 2022

A Deep Reinforcement Learning solution to the famous mountain car problem using OpenAI's classical control environment

A Deep Reinforcement Learning solution to the famous mountain car problem using OpenAI's classical control environment

Deep RL/Robotics Classical Control Problem - Mountain Car Problem Description A car is on a one-dimensional track, positioned between two "mountains".

Nov 5, 2022

This is a concise Pytorch implementation of Rainbow DQN, including Double Q-learning, Dueling network, Noisy network, PER and n-steps Q-learning.

This is a concise Pytorch implementation of Rainbow DQN, including Double Q-learning, Dueling network, Noisy network, PER and n-steps Q-learning.

Rainbow DQN This is a concise Pytorch implementation of Rainbow DQN, including Double Q-learning, Dueling network, Noisy network, PER and n-steps Q-le

Dec 20, 2022

Training and evaluating NBM and SPAM for interpretable machine learning.

Neural Basis Model (NBM) and Scalable Polynomial Additive Model (SPAM) Training and evaluating NBM and SPAM for interpretable machine learning. Librar

Dec 25, 2022

Reinforcement Learning Environments in JAX 🌍

Reinforcement Learning Environments in JAX 🌍

Reinforcement Learning Environments in JAX 🌍 Are you fed up with slow CPU-based RL environment processes? Do you want to leverage massive vectorizati

Dec 30, 2022

Code of my thesis project for the Master in Data Science and Business Analytics at Bocconi University. The project consists in a combination of NLP and CV to determine food prices on a popular food delivery service.

Food Pricing with NLP and CV Introduction This repository contains the code written for Giacomo Rebecchi's thesis for the Master in Data Science and B

Oct 14, 2022

Trained DQN agent to learn how to play a social deduction game.

AIWolfPy Create python agents that can play Werewolf, following the specifications of the AIWolf Project This has been forked from the official reposi

Aug 25, 2022

This Project is an implementation of a Database System for university E-learning management system using MySQL and Python

This Project is an implementation of a Database System for university E-learning management system using MySQL and Python

Database-System-for-E-learning-management-system This project is an implementation of a database system for university E-learning management system us

Aug 23, 2022
A standard API for reinforcement learning and a diverse set of reference environments (formerly Gym)

Important notice Due to issues with the domain registration, the documentation has been moved to https://www.gymlibrary.dev/ as opposed to the old .ml

Farama Foundation 881 Jan 5, 2023
Multi-objective gym environments for reinforcement learning.

MO-Gym: Multi-Objective Reinforcement Learning Environments Gym environments for multi-objective reinforcement learning (MORL). The environments follo

Lucas Alegre 73 Dec 8, 2022
A Minimal Example of Isaac Gym with DQN and PPO.

Minimal Isaac Gym This repository provides a minimal example of NVIDIA's Isaac Gym, to assist other researchers like me to quickly understand the code

Shikun Liu 25 Nov 23, 2022
This small program allows you to quickly and easily select random agents for multiple people when you are playing with your friends and want random agents.

Valorant Random Agent Selector Written by Caelan Shoop. Features Randomly selects agents for players in your party -Checkboxes allow you to select who

Cael 1 Jun 3, 2022
Playing OpenAI Gym's Cartpole environment using deep Q learning.

DQN-Cartpole Solving OpenAI Gym's cartpole environment using deep Q learning Libraries used: Pytorch, Gym, Numpy, Matplotlib Results from training 100

Xingyu Bian 0 Jun 29, 2022
Snake Game AI built with Reinforcement Learning (DQN)

Snake Game AI built with Reinforcement Learning (DQN) Notes The requirements.txt file should list all Python libraries that your notebooks depend on,

Kyle Lim 3 May 17, 2022
Realization of UAV's Track Planning in 3D Urban Environment Based on Reinforcement Learning Algorithm(DQN)

?? *∙ 简体中文∙ English 基于DQN算法的无人机三维城市空间航线规划 本文基于强化学习算法DQN实现离散3维城市空间环境下的智能航线规划,能根据无人机感知进行避障,并根据风速情况选择能耗较低的路线。 环境需求 python 3.7 pytorch(cuda) 模型简介 在x100 y1

young how 80 Dec 27, 2022
The OpenAI-Gym-compatible Room environment.

The Room environment We have released a challenging OpenAI Gym compatible environment. The best strategy for this environment is to have both episodic

Taewoon Kim 2 Dec 6, 2022
A bot I built to automate gym reservations at my University during COVID restrictions.

Reservation Bot I built this bot with Python & Selenium to automate a booking process for my school's gym during the peak of COVID. The bot is specifi

Doug L 0 Mar 28, 2022