Creating an environment
We will be using a package called OpenAI Gym to build RL agents. You can learn more about it here: https://gym.openai.com. It can be installed using pip
by running the following command:
$ pip3 install gym
You can find various tips and tricks related to its installation here:
https://github.com/openai/gym#installation
Now that you have installed it, let's go ahead and write some code.
Create a new Python file and import the following packages:
import argparse
import gym
Define a function to parse the input arguments. The input arguments will be used to specify the type of environment to be run:
def build_arg_parser():
parser = argparse.ArgumentParser(description='Run an environment')
parser.add_argument('--input-env', dest='input_env', required=True,
choices=['cartpole', 'mountaincar', 'pendulum', 'taxi', 'lake'],
...