garage.envs.point_env

Simple 2D environment containing a point and a goal location.

class PointEnv(goal=np.array((1.0, 1.0), dtype=np.float32), arena_size=5.0, done_bonus=0.0, never_done=False, max_episode_length=math.inf)

Bases: garage.Environment

Inheritance diagram of garage.envs.point_env.PointEnv

A simple 2D point environment.

Parameters:
  • goal (np.ndarray) – A 2D array representing the goal position
  • arena_size (float) – The size of arena where the point is constrained within (-arena_size, arena_size) in each dimension
  • done_bonus (float) – A numerical bonus added to the reward once the point as reached the goal
  • never_done (bool) – Never send a done signal, even if the agent achieves the goal
  • max_episode_length (int) – The maximum steps allowed for an episode.
action_space

The action space specification.

Type:akro.Space
observation_space

The observation space specification.

Type:akro.Space
spec

The environment specification.

Type:EnvSpec
render_modes

A list of string representing the supported render modes.

Type:list
reset(self)

Reset 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)

Step the environment.

Parameters:

action (np.ndarray) – An action provided by the agent.

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.
render(self, mode)

Renders the environment.

Parameters:mode (str) – the mode to render with. The string must be present in self.render_modes.
Returns:the point and goal of environment.
Return type:str
visualize(self)

Creates a visualization of the environment.

close(self)

Close the env.

sample_tasks(self, num_tasks)

Sample a list of num_tasks tasks.

Parameters:num_tasks (int) – Number of tasks to sample.
Returns:
A list of “tasks”, where each task is
a dictionary containing a single key, “goal”, mapping to a point in 2D space.
Return type:list[dict[str, np.ndarray]]
set_task(self, task)

Reset with a task.

Parameters:task (dict[str, np.ndarray]) – A task (a dictionary containing a single key, “goal”, which should be a point in 2D space).