Requirements:
- Python 3.5+
- OpenAI Gym
- NumPy
- Matplotlib (optional, only needed for display)
It is an implementation of the classical FourRooms environemnt from the original options paper. However, here we do not assume that the features are tabular, but rather an image that can be passed through a neural network.
We want the agent to be able to move up, down, left and right. However, in the MiniGrid's repo the agent can turn while remaining in the same location. We want to avoid that as to be able to print insightful plots such as
where a state-dependent function is evaluated and plotteed for each location. This is very useful for debugging.
import gym
import gym_minigrid
class Minigrid2Image(gym.ObservationWrapper):
def __init__(self, env):
gym.ObservationWrapper.__init__(self, env)
self.observation_space = env.observation_space.spaces['image']
def observation(self, observation):
return observation['image']
from gym_minigrid import wrappers as wrappers
env = wrappers.FullyObsWrapper(gym.make('MiniGrid-FourRooms-v0', max_steps=100))
env = Minigrid2Image(env)