فهرست منبع

Added position randomization to RedBlueDoors env. Updated README.

Maxime Chevalier-Boisvert 7 سال پیش
والد
کامیت
041225e96b
2فایلهای تغییر یافته به همراه17 افزوده شده و 5 حذف شده
  1. 14 1
      README.md
  2. 3 4
      gym_minigrid/envs/redbluedoors.py

+ 14 - 1
README.md

@@ -20,7 +20,7 @@ Please use this bibtex if you want to cite this repository in your publications:
 
 ```
 @misc{gym_minigrid,
-  author = {Maxime Chevalier-Boisvert},
+  author = {Maxime Chevalier-Boisvert, Lucas Willems},
   title = {Minimalistic Gridworld Environment for OpenAI Gym},
   year = {2018},
   publisher = {GitHub},
@@ -223,6 +223,19 @@ place it next to another object. This environment is easy to solve with two
 objects, but difficult to solve with more, as it involves both textual
 understanding and spatial reasoning involving multiple objects.
 
+### Red and blue doors environment
+
+Registered configurations:
+- `MiniGrid-RedBlueDoors-6x6-v0`
+- `MiniGrid-RedBlueDoors-8x8-v0`
+
+The agent is randomly placed within a room with one red and one blue door
+facing opposite directions. The agent has to open the red door and then open
+the blue door, in that order. The purpose of this environment is to test
+memory. The agent, when facing one door, cannot see the door behind him.
+Hence, the agent needs to remember whether or not he has previously opened
+the other door in order to reliably succeed at completing the task.
+
 ### Locked Room Environment
 
 Registed configurations:

+ 3 - 4
gym_minigrid/envs/redbluedoors.py

@@ -23,8 +23,7 @@ class RedBlueDoorEnv(MiniGridEnv):
         self.grid.wall_rect(self.size//2, 0, self.size, self.size)
 
         # Place the agent in the top-left corner
-        self.start_pos = (self.size, self.size//2)
-        self.start_dir = 0
+        self.place_agent(top=(self.size//2, 0), size=(self.size, self.size))
 
         # Add a red door at a random position in the left wall
         pos = self._rand_int(1, self.size - 1)
@@ -44,7 +43,7 @@ class RedBlueDoorEnv(MiniGridEnv):
         #   - 1 means "red door opened"
         #   - 2 means "red then blue door opened"
         self.resolution_state = 0
-    
+
     def step(self, action):
         red_door_opened_before = self.red_door.is_open
         blue_door_opened_before = self.blue_door.is_open
@@ -78,4 +77,4 @@ register(
 register(
     id='MiniGrid-RedBlueDoors-8x8-v0',
     entry_point='gym_minigrid.envs:RedBlueDoorEnv'
-)
+)