garage.envs.grid_world_env

Simple 2D Grid environment.

MAPS
class GridWorldEnv(desc='4x4', max_episode_length=None)

Bases: garage.Environment

Inheritance diagram of garage.envs.grid_world_env.GridWorldEnv

A simply 2D grid environment.

‘S’ : starting point
‘F’ or ‘.’: free space
‘W’ or ‘x’: wall
‘H’ or ‘o’: hole (terminates episode)
‘G’ : goal
property action_space(self)

akro.Space: The action space specification.

property observation_space(self)

akro.Space: The observation space specification.

property spec(self)

EnvSpec: The environment specification.

property render_modes(self)

list: A list of string representing the supported render modes.

reset(self)

Resets the environment.

Returns

The first observation conforming to

observation_space.

dict: The episode-level information.

Note that this is not part of env_info provided in step(). It contains information of he entire episode, which could be needed to determine the first action (e.g. in the case of goal-conditioned or MTRL.)

Return type

numpy.ndarray

step(self, action)

Steps the environment.

action map: 0: left 1: down 2: right 3: up

Parameters

action (int) – an int encoding the action

Returns

The environment step resulting from the action.

Return type

EnvStep

Raises
  • RuntimeError – if step() is called after the environment has been constructed and reset() has not been called.

  • NotImplementedError – if a next step in self._desc does not match known state type.

render(self, mode)

Renders the environment.

Parameters

mode (str) – the mode to render with. The string must be present in Environment.render_modes.

visualize(self)

Creates a visualization of the environment.

close(self)

Close the env.