Lunar lander using A2C
Let's learn how to implement A2C with Stable Baselines for the lunar landing task. In the lunar lander environment, our agent drives the space vehicle, and the goal of the agent is to land correctly on the landing pad. If our agent (lander) lands away from the landing pad, then it loses the reward, and the episode will get terminated if the agent crashes or comes to rest. The action space of the environment includes four discrete actions, which are: do nothing, fire left orientation engine, fire main engine, and fire right orientation engine. Now, let's see how to train the agent using A2C to correctly land on the landing pad.
First, let's import the necessary libraries:
from stable_baselines.common.policies import MlpPolicy
from stable_baselines.common.vec_env import DummyVecEnv
from stable_baselines.common.evaluation import evaluate_policy
from stable_baselines import A2C
Create the lunar lander environment using...