The LunarLanding-AIModel project utilizes reinforcement learning techniques to train an agent to land a spacecraft safely on the moon's surface. This environment simulates a classic rocket trajectory optimization problem, where the agent must learn to control the spacecraft's engines to navigate and land on a designated landing pad. The project is based on the Gymnasium framework.
- Environment Name: LunarLander-v2
- Framework: Gymnasium
- Actions: The agent can take one of four discrete actions:
- 0: Do nothing
- 1: Fire the left orientation engine
- 2: Fire the main engine
- 3: Fire the right orientation engine
- Observations: The state is represented by an 8-dimensional vector, including the coordinates of the lander in x and y, linear velocities in x and y, angle, angular velocity, and two booleans indicating whether each leg is in contact with the ground.
- Rewards:
- Rewards are given based on proximity to the landing pad, velocity, angle, and leg contact with the ground.
- Each leg in contact with the ground gives a reward of 10 points.
- Penalty for engine firing: 0.03 points for side engines and 0.3 points for the main engine.
- Additional rewards of -100 for crashing and +100 for landing safely are given at the end of each episode.
- Goal: The episode is considered solved if the agent achieves an average score of at least 200 points over 100 consecutive episodes.
Gymnasium Framework - https://gymnasium.farama.org/
- Install Gymnasium and other necessary dependencies. 2 .Import required libraries.
- Define the neural network architecture for the agent.
- Implement experience replay and the DQN algorithm.
- Initialize the DQN agent and set hyperparameters.
- Train the agent on the LunarLander-v2 environment.
- Visualize the trained agent's performance.