Skip to content

Commit

Permalink
Merge pull request #81 from BolunDai0216/master
Browse files Browse the repository at this point in the history
Updated docstrings
  • Loading branch information
pseudo-rnd-thoughts authored Jan 24, 2023
2 parents d21b086 + 249e10c commit 7f8c890
Show file tree
Hide file tree
Showing 16 changed files with 84 additions and 55 deletions.
2 changes: 1 addition & 1 deletion miniworld/envs/collecthealth.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class CollectHealth(MiniWorldEnv, utils.EzPickle):
## Observation Space
The observation space is an `ndarray` with shape `(obs_height, obs_width, 3)`
representing the view the agents sees.
representing a RGB image of what the agents sees.
## Rewards:
Expand Down
9 changes: 5 additions & 4 deletions miniworld/envs/fourrooms.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ class FourRooms(MiniWorldEnv, utils.EzPickle):
"""
## Description
Classic four rooms environment. The agent must reach the red box to get a reward.
Classic four rooms environment. The goal is to reach the red box to get a
reward in as few steps as possible.
## Action Space
Expand All @@ -21,16 +22,16 @@ class FourRooms(MiniWorldEnv, utils.EzPickle):
## Observation Space
The observation space is an `ndarray` with shape `(obs_height, obs_width, 3)`
representing the view the agents sees.
representing a RGB image of what the agents sees.
## Rewards:
+(1 - 0.2 * (step_count / max_episode_steps)) when red box reached
+(1 - 0.2 * (step_count / max_episode_steps)) when red box reached and zero otherwise.
## Arguments
```python
FourRooms()
env = gym.make("MiniWorld-FourRooms-v0")
```
"""
Expand Down
8 changes: 4 additions & 4 deletions miniworld/envs/hallway.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ class Hallway(MiniWorldEnv, utils.EzPickle):
"""
## Description
Environment in which the goal is to go to a red box
at the end of a hallway
Environment in which the goal is to go to a red box at the end of a
hallway within as few steps as possible.
## Action Space
Expand All @@ -24,7 +24,7 @@ class Hallway(MiniWorldEnv, utils.EzPickle):
## Observation Space
The observation space is an `ndarray` with shape `(obs_height, obs_width, 3)`
representing the view the agents sees.
representing a RGB image of what the agents sees.
## Rewards:
Expand All @@ -33,7 +33,7 @@ class Hallway(MiniWorldEnv, utils.EzPickle):
## Arguments
```python
FourRooms(length=12)
Hallway(length=12)
```
`length`: length of the entire space
Expand Down
18 changes: 12 additions & 6 deletions miniworld/envs/maze.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@ class Maze(MiniWorldEnv, utils.EzPickle):
"""
## Description
Maze environment in which the agent has to reach a red box
Maze environment in which the agent has to reach a red box. There are a
few variants of the `Maze` environment. The `MazeS2` environment gives
you a 2x2 maze and the `MazeS3` environment gives you a 3x3 maze. The
`MazeS3Fast` also gives you a 2x2 maze, but the turning and moving motion
per action is larger.
## Action Space
Expand All @@ -22,20 +26,22 @@ class Maze(MiniWorldEnv, utils.EzPickle):
## Observation Space
The observation space is an `ndarray` with shape `(obs_height, obs_width, 3)`
representing the view the agents sees.
representing a RGB image of what the agents sees.
## Rewards:
+(1 - 0.2 * (step_count / max_episode_steps)) when red box reached
+(1 - 0.2 * (step_count / max_episode_steps)) when red box reached and zero otherwise.
## Arguments
```python
MazeS2()
env = gym.make("MiniWorld-Maze-v0")
# or
MazeS3()
env = gym.make("MiniWorld-MazeS2-v0")
# or
MazeS3Fast()
env = gym.make("MiniWorld-MazeS3-v0")
# or
env = gym.make("MiniWorld-MazeS3Fast-v0")
```
"""
Expand Down
17 changes: 11 additions & 6 deletions miniworld/envs/oneroom.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,11 @@ class OneRoom(MiniWorldEnv, utils.EzPickle):
"""
## Description
Environment in which the goal is to go to a red box
placed randomly in one big room.
Environment in which the goal is to go to a red box placed randomly in one big room.
The `OneRoom` environment has two variants. The `OneRoomS6` environment gives you
a room with size 6 (the `OneRoom` environment has size 10). The `OneRoomS6Fast`
environment also is using a room with size 6, but the turning and moving motion
is larger.
## Action Space
Expand All @@ -23,18 +26,20 @@ class OneRoom(MiniWorldEnv, utils.EzPickle):
## Observation Space
The observation space is an `ndarray` with shape `(obs_height, obs_width, 3)`
representing the view the agents sees.
representing a RGB image of what the agents sees.
## Rewards:
+(1 - 0.2 * (step_count / max_episode_steps)) when red box reached
+(1 - 0.2 * (step_count / max_episode_steps)) when red box reached and zero otherwise.
## Arguments
```python
OneRoomS6()
env = gym.make("MiniWorld-OneRoom-v0")
# or
OneRoomS6Fast()
env = gym.make("MiniWorld-OneRoomS6-v0")
# or
env = gym.make("MiniWorld-OneRoomS6Fast-v0")
```
"""
Expand Down
2 changes: 1 addition & 1 deletion miniworld/envs/pickupobjects.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class PickupObjects(MiniWorldEnv, utils.EzPickle):
## Observation Space
The observation space is an `ndarray` with shape `(obs_height, obs_width, 3)`
representing the view the agents sees.
representing a RGB image of what the agents sees.
## Rewards:
Expand Down
5 changes: 3 additions & 2 deletions miniworld/envs/putnext.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ class PutNext(MiniWorldEnv, utils.EzPickle):
## Description
Single-room environment where a red box must be placed next
to a yellow box.
to a yellow box. The goal is to perform this task in as few
steps as possible.
## Action Space
Expand All @@ -27,7 +28,7 @@ class PutNext(MiniWorldEnv, utils.EzPickle):
## Observation Space
The observation space is an `ndarray` with shape `(obs_height, obs_width, 3)`
representing the view the agents sees.
representing a RGB image of what the agents sees.
## Rewards:
Expand Down
9 changes: 4 additions & 5 deletions miniworld/envs/roomobjects.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,8 @@ class RoomObjects(MiniWorldEnv, utils.EzPickle):
"""
## Description
Single room with multiple objects
Inspired by the single room environment of
the Generative Query Networks paper:
Single room with multiple objects. Inspired by the single room environment
of the Generative Query Networks paper:
https://deepmind.com/blog/neural-scene-representation-and-rendering/
## Action Space
Expand All @@ -31,11 +30,11 @@ class RoomObjects(MiniWorldEnv, utils.EzPickle):
## Observation Space
The observation space is an `ndarray` with shape `(obs_height, obs_width, 3)`
representing the view the agents sees.
representing a RGB image of what the agents sees.
## Rewards:
+0
None
## Arguments
Expand Down
8 changes: 4 additions & 4 deletions miniworld/envs/sidewalk.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ class Sidewalk(MiniWorldEnv, utils.EzPickle):
"""
## Description
Walk on a sidewalk up to an object to be collected.
Don't walk into the street.
Walk on a sidewalk up to an object to be collected. Don't walk into the
street. The goal is to reach the object in as few steps as possible.
## Action Space
Expand All @@ -25,7 +25,7 @@ class Sidewalk(MiniWorldEnv, utils.EzPickle):
## Observation Space
The observation space is an `ndarray` with shape `(obs_height, obs_width, 3)`
representing the view the agents sees.
representing a RGB image of what the agents sees.
## Rewards:
Expand All @@ -34,7 +34,7 @@ class Sidewalk(MiniWorldEnv, utils.EzPickle):
## Arguments
```python
Sidewalk()
env = gym.make("MiniWorld-Sidewalk-v0")
```
"""
Expand Down
14 changes: 10 additions & 4 deletions miniworld/envs/sign.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class Sign(MiniWorldEnv, utils.EzPickle):
## Observation Space
The observation space is an `ndarray` with shape `(obs_height, obs_width, 3)`
representing the view the agents sees.
representing a RGB image of what the agents sees.
## Rewards:
Expand All @@ -75,7 +75,7 @@ class Sign(MiniWorldEnv, utils.EzPickle):
"""

def __init__(self, size=10, max_episode_steps=20, color_index=0, goal=0):
def __init__(self, size=10, max_episode_steps=20, color_index=0, goal=0, **kwargs):
if color_index not in [0, 1, 2]:
raise ValueError("Only supported values for color_index are 0, 1, 2.")

Expand All @@ -91,9 +91,15 @@ def __init__(self, size=10, max_episode_steps=20, color_index=0, goal=0):
self._color_index = color_index

MiniWorldEnv.__init__(
self, params=params, max_episode_steps=max_episode_steps, domain_rand=False
self,
params=params,
max_episode_steps=max_episode_steps,
domain_rand=False,
**kwargs,
)
utils.EzPickle.__init__(
self, size, max_episode_steps, color_index, goal, **kwargs
)
utils.EzPickle.__init__(self, size, max_episode_steps, color_index, goal)

self.observation_space = Dict(obs=self.observation_space, goal=Discrete(2))

Expand Down
8 changes: 5 additions & 3 deletions miniworld/envs/threerooms.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ class ThreeRooms(MiniWorldEnv, utils.EzPickle):
"""
## Description
Two small rooms connected to one large room
Two small rooms connected to one large room, with five different items
placed on the ground: a red box, a green box, a white ball, a key, and
a rubber duck.
## Action Space
Expand All @@ -23,7 +25,7 @@ class ThreeRooms(MiniWorldEnv, utils.EzPickle):
## Observation Space
The observation space is an `ndarray` with shape `(obs_height, obs_width, 3)`
representing the view the agents sees.
representing a RGB image of what the agents sees.
## Rewards:
Expand All @@ -32,7 +34,7 @@ class ThreeRooms(MiniWorldEnv, utils.EzPickle):
## Arguments
```python
ThreeRooms()
env = gym.make("MiniWorld-ThreeRooms-v0")
```
"""
Expand Down
16 changes: 9 additions & 7 deletions miniworld/envs/tmaze.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@ class TMaze(MiniWorldEnv, utils.EzPickle):
"""
## Description
Two hallways connected in a T-junction
Two hallways connected in a T-junction, the goal is to move the agent
towards a red box within as few steps as possible. In
`MiniWorld-TMazeLeft-v0`, the red box is located on the left wing of
the T-shaped junction. In `MiniWorld-TMazeRight-v0`, the red box is
located on the right wing of the T-shaped junction.
## Action Space
Expand All @@ -23,21 +27,19 @@ class TMaze(MiniWorldEnv, utils.EzPickle):
## Observation Space
The observation space is an `ndarray` with shape `(obs_height, obs_width, 3)`
representing the view the agents sees.
representing a RGB image of what the agents sees.
## Rewards:
+(1 - 0.2 * (step_count / max_episode_steps)) when box reached
+(1 - 0.2 * (step_count / max_episode_steps)) when box reached and zero otherwise.
## Arguments
```python
TMazeLeft()
env = gym.make("MiniWorld-TMazeLeft-v0")
# or
TMazeRight()
env = gym.make("MiniWorld-TMazeRight-v0")
```
"""

def __init__(self, goal_pos=None, **kwargs):
Expand Down
7 changes: 4 additions & 3 deletions miniworld/envs/wallgap.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ class WallGap(MiniWorldEnv, utils.EzPickle):
"""
## Description
Outside environment with two rooms connected by a gap in a wall
Outside environment with two rooms connected by a gap in a wall. The
goal is to go to a red box within as little steps as possible.
## Action Space
Expand All @@ -24,7 +25,7 @@ class WallGap(MiniWorldEnv, utils.EzPickle):
## Observation Space
The observation space is an `ndarray` with shape `(obs_height, obs_width, 3)`
representing the view the agents sees.
representing a RGB image of what the agents sees.
## Rewards:
Expand All @@ -33,7 +34,7 @@ class WallGap(MiniWorldEnv, utils.EzPickle):
## Arguments
```python
WallGap()
env = gym.make("MiniWorld-WallGap-v0")
```
"""

Expand Down
12 changes: 8 additions & 4 deletions miniworld/envs/ymaze.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@ class YMaze(MiniWorldEnv, utils.EzPickle):
"""
## Description
Two hallways connected in a Y-junction
Two hallways connected in a Y-junction. the goal is to move the agent
towards a red box within as little steps as possible. In
`MiniWorld-YMazeLeft-v0`, the red box is located on the left wing of
the Y-shaped junction. In `MiniWorld-YMazeRight-v0`, the red box is
located on the right wing of the Y-shaped junction.
## Action Space
Expand All @@ -25,7 +29,7 @@ class YMaze(MiniWorldEnv, utils.EzPickle):
## Observation Space
The observation space is an `ndarray` with shape `(obs_height, obs_width, 3)`
representing the view the agents sees.
representing a RGB image of what the agents sees.
## Rewards:
Expand All @@ -34,9 +38,9 @@ class YMaze(MiniWorldEnv, utils.EzPickle):
## Arguments
```python
YMazeLeft()
env = gym.make("MiniWorld-YMazeLeft-v0")
# or
YMazeRight()
env = gym.make("MiniWorld-YMazeRight-v0")
```
"""
Expand Down
Loading

0 comments on commit 7f8c890

Please sign in to comment.