Skip to content

Lunar Landing is the DQ learning code where the target is to land the lunar between the two target flags. And the landing of the lunar is done by reinforcement leaning.

Notifications You must be signed in to change notification settings

Sachidananda-17/Lunar-Landing

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 

Repository files navigation

LunarLander RL Agent

This repository contains a Reinforcement Learning (RL) agent implemented in PyTorch to solve the LunarLander-v2 environment from the OpenAI Gym. The agent utilizes a Deep Q-Network (DQN) to learn how to control the lunar lander and safely land it on the moon's surface.

Overview

The LunarLander-v2 environment simulates the task of landing a spacecraft on the moon. The agent has control over the craft's main engine and orientation engines to maneuver and land safely. The goal is to learn a policy that maximizes the cumulative reward while safely landing on the designated landing pad.

Key Concepts and Components

  • Deep Q-Network (DQN): The agent's neural network architecture is implemented using PyTorch. It consists of fully connected layers with ReLU activation functions.
  • Replay Memory: Experience replay is utilized to store and sample past experiences for efficient training. It helps stabilize and improve the learning process.
  • Target Network: A target Q-network is used to stabilize training by providing more stable target values during the learning process.
  • Epsilon-Greedy Exploration: The agent balances exploration and exploitation using an epsilon-greedy policy. It selects random actions with probability epsilon and greedy actions based on the learned Q-values otherwise.
  • Training Loop: The agent interacts with the environment, collects experiences, and updates its Q-network parameters using mini-batch gradient descent.

Metrics

  • Average Score per Episode: The training process prints the average score achieved by the agent over the last 100 episodes. This metric indicates the agent's learning progress and performance.
  • Environment Solving: The environment is considered solved when the average score over the last 100 episodes exceeds 200. Upon solving, the training process stops, and the model parameters are saved.

Installation and Usage

To run the RL agent and train it to solve the LunarLander-v2 environment, follow these steps:

  1. Clone this repository to your local machine.
  2. Install the required dependencies by executing the following command:
pip install gym gym[atari,accept-rom-license] box2d torch

Ensure you have the necessary dependencies installed, including Gym and PyTorch, to execute the code successfully.

Getting Started

To begin training the RL agent, execute the provided code in your preferred Python environment. Adjust hyperparameters and training settings as needed for your specific requirements.

License

This project is licensed under the MIT License.

About

Lunar Landing is the DQ learning code where the target is to land the lunar between the two target flags. And the landing of the lunar is done by reinforcement leaning.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published