Browse Source

Screenshots for some environments (#22)

* Obstructed maze environment

* Add unlock environment

* Fix env id

* Unlock pickup environment

* Add screenshots for some environments
Lucas Willems 6 years ago
parent
commit
afb32770de

+ 42 - 1
README.md

@@ -243,6 +243,15 @@ Registed configurations:
 - `MiniGrid-KeyCorridorS5R3-v0`
 - `MiniGrid-KeyCorridorS6R3-v0`
 
+<p align="center">
+    <img src="figures/KeyCorridorS3R1.png" width="250">
+    <img src="figures/KeyCorridorS3R2.png" width="250">
+    <img src="figures/KeyCorridorS3R3.png" width="250">
+    <img src="figures/KeyCorridorS4R3.png" width="250">
+    <img src="figures/KeyCorridorS5R3.png" width="250">
+    <img src="figures/KeyCorridorS6R3.png" width="250">
+</p>
+
 This environment is similar to the locked room environment, but there are
 multiple registered environment configurations of increasing size,
 making it easier to use curriculum learning to train an agent to solve it.
@@ -256,14 +265,34 @@ key is placed. This environment can be solved without relying on language.
 Registed configurations:
 - `MiniGrid-Unlock-v0`
 
+<p align="center">
+    <img src="figures/Unlock.png" width="200">
+</p>
+
 The agent has to open a locked door. This environment can be solved without
 relying on language.
 
+### Unlock pickup environment
+
+Registed configurations:
+- `MiniGrid-UnlockPickup-v0`
+
+<p align="center">
+    <img src="figures/UnlockPickup.png" width="250">
+</p>
+
+The agent has to pick up a box which is placed in another room, behind a
+locked door. This environment can be solved without relying on language.
+
 ### Blocked unlock pickup environment
 
 Registed configurations:
 - `MiniGrid-BlockedUnlockPickup-v0`
 
+<p align="center">
+    <img src="figures/BlockedUnlockPickup.png" width="250">
+</p>
+
 The agent has to pick up a box which is placed in another room, behind a
 locked door. The door is also blocked by a ball which the agent has to move
 before it can unlock the door. Hence, the agent has to learn to move the ball,
@@ -283,6 +312,18 @@ Registered configurations:
 - `MiniGrid-ObstructedMaze-2Q-v0`
 - `MiniGrid-ObstructedMaze-Full-v0`
 
+<p align="center">
+  <img src="figures/ObstructedMaze-1Dl.png" width="250">
+  <img src="figures/ObstructedMaze-1Dlh.png" width="250">
+  <img src="figures/ObstructedMaze-1Dlhb.png" width="250">
+  <img src="figures/ObstructedMaze-2Dl.png" width="100">
+  <img src="figures/ObstructedMaze-2Dlh.png" width="100">
+  <img src="figures/ObstructedMaze-2Dlhb.png" width="100">
+  <img src="figures/ObstructedMaze-1Q.png" width="250">
+  <img src="figures/ObstructedMaze-2Q.png" width="250">
+  <img src="figures/ObstructedMaze-4Q.png" width="250">
+</p>
+
 The agent has to pick up a box which is placed in a corner of a 3x3 maze.
 The doors are locked, the keys are hidden in boxes and doors are obstructed
-by balls. This environment can be solved without relying on language.
+by balls. This environment can be solved without relying on language.

BIN
figures/BlockedUnlockPickup.png


BIN
figures/KeyCorridorS3R1.png


BIN
figures/KeyCorridorS3R2.png


BIN
figures/KeyCorridorS3R3.png


BIN
figures/KeyCorridorS4R3.png


BIN
figures/KeyCorridorS5R3.png


BIN
figures/KeyCorridorS6R3.png


BIN
figures/ObstructedMaze-1Dl.png


BIN
figures/ObstructedMaze-1Dlh.png


BIN
figures/ObstructedMaze-1Dlhb.png


BIN
figures/ObstructedMaze-1Q.png


BIN
figures/ObstructedMaze-2Dl.png


BIN
figures/ObstructedMaze-2Dlh.png


BIN
figures/ObstructedMaze-2Dlhb.png


BIN
figures/ObstructedMaze-2Q.png


BIN
figures/ObstructedMaze-4Q.png


BIN
figures/Unlock.png


BIN
figures/UnlockPickup.png


+ 1 - 0
gym_minigrid/envs/__init__.py

@@ -8,6 +8,7 @@ from gym_minigrid.envs.putnear import *
 from gym_minigrid.envs.lockedroom import *
 from gym_minigrid.envs.keycorridor import *
 from gym_minigrid.envs.unlock import *
+from gym_minigrid.envs.unlockpickup import *
 from gym_minigrid.envs.blockedunlockpickup import *
 from gym_minigrid.envs.playground_v0 import *
 from gym_minigrid.envs.redbluedoors import *

+ 48 - 0
gym_minigrid/envs/unlockpickup.py

@@ -0,0 +1,48 @@
+from gym_minigrid.minigrid import Ball
+from gym_minigrid.roomgrid import RoomGrid
+from gym_minigrid.register import register
+
+class UnlockPickup(RoomGrid):
+    """
+    Unlock a door, then pick up a box in another room
+    """
+
+    def __init__(self, seed=None):
+        room_size = 6
+        super().__init__(
+            num_rows=1,
+            num_cols=2,
+            room_size=room_size,
+            max_steps=8*room_size**2,
+            seed=seed
+        )
+
+    def _gen_grid(self, width, height):
+        super()._gen_grid(width, height)
+
+        # Add a box to the room on the right
+        obj, _ = self.add_object(1, 0, kind="box")
+        # Make sure the two rooms are directly connected by a locked door
+        door, _ = self.add_door(0, 0, 0, locked=True)
+        # Add a key to unlock the door
+        self.add_object(0, 0, 'key', door.color)
+
+        self.place_agent(0, 0)
+
+        self.obj = obj
+        self.mission = "pick up the %s %s" % (obj.color, obj.type)
+
+    def step(self, action):
+        obs, reward, done, info = super().step(action)
+
+        if action == self.actions.pickup:
+            if self.carrying and self.carrying == self.obj:
+                reward = self._reward()
+                done = True
+
+        return obs, reward, done, info
+
+register(
+    id='MiniGrid-UnlockPickup-v0',
+    entry_point='gym_minigrid.envs:UnlockPickup'
+)