-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add second generator for grid based on MiniGrid Gym environment (#29)
Co-authored-by: Jendrik Seipp <jendrik.seipp@liu.se>
- Loading branch information
1 parent
a131021
commit 2c51b64
Showing
20 changed files
with
514 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# Without this dummy target, the test target becomes the default target. | ||
build: | ||
echo nothing to build | ||
|
||
test: | ||
./mini_grid.py floorplans/4room2.fpl 3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# Mini-Grid | ||
|
||
This is an alternative generator for the Grid domain, which was proposed by Drew | ||
McDermott for the AIPS-1998 competition. You can find the original generator | ||
under "grid". | ||
|
||
The "minigrid" generator is inspired by the Gym environment called MiniGrid that is | ||
heavily used in RL/DRL. The generator, that is guaranteed to generate solvable | ||
and interesting instances, is from Blai Bonet (https://github.com/bonetblai/mini-grid). | ||
|
||
Random instances are generated used given floorplans which already contain "walls" | ||
that create rooms, and locked cells that serve as doors between rooms. On such | ||
floorplans, shapes and keys are randomly assigned and placed around, together | ||
with initial and goal position for the robot. The goal is always for the robot | ||
to reach a designated cell. | ||
|
||
Different floorplans are provided but new floorplans can be used in creative ways, | ||
not necessarily rectangular shapes. The original repository contains example | ||
problems generated from the given floorplans together with solutions computed | ||
with pyperplan. | ||
|
||
The options for the generator are: | ||
|
||
``` | ||
usage: mini_grid.py [-h] [--seed SEED] [--debug_level DEBUG_LEVEL] [--num_instances NUM_INSTANCES] [--results RESULTS] [--floorplans_path FLOORPLANS_PATH] floorplan nshapes | ||
positional arguments: | ||
floorplan Filename for floorplan | ||
nshapes Number of shapes for locks (0 means choose it randomly) | ||
options: | ||
-h, --help show this help message and exit | ||
--seed SEED Seed for random generator (default=0) | ||
--debug_level DEBUG_LEVEL | ||
Set debug level (default=0) | ||
--num_instances NUM_INSTANCES | ||
Number of instances to generate (default=1) | ||
paths: | ||
--results RESULTS Path to results folders (default='') | ||
--floorplans_path FLOORPLANS_PATH | ||
Path to floorplans (default='') | ||
``` | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
(define (domain grid) | ||
(:requirements :strips) | ||
(:predicates (conn ?x ?y) | ||
(key-shape ?k ?s) | ||
(lock-shape ?x ?s) | ||
(at ?r ?x ) | ||
(at-robot ?x) | ||
(place ?p) | ||
(key ?k) | ||
(shape ?s) | ||
(locked ?x) | ||
(holding ?k) | ||
(open ?x) | ||
(arm-empty )) | ||
|
||
|
||
|
||
(:action unlock | ||
:parameters (?curpos ?lockpos ?key ?shape) | ||
:precondition (and (place ?curpos) (place ?lockpos) (key ?key) (shape ?shape) | ||
(conn ?curpos ?lockpos) (key-shape ?key ?shape) | ||
(lock-shape ?lockpos ?shape) (at-robot ?curpos) | ||
(locked ?lockpos) (holding ?key)) | ||
:effect (and (open ?lockpos) (not (locked ?lockpos)))) | ||
|
||
|
||
(:action move | ||
:parameters (?curpos ?nextpos) | ||
:precondition (and (place ?curpos) (place ?nextpos) | ||
(at-robot ?curpos) (conn ?curpos ?nextpos) (open ?nextpos)) | ||
:effect (and (at-robot ?nextpos) (not (at-robot ?curpos)))) | ||
|
||
(:action pickup | ||
:parameters (?curpos ?key) | ||
:precondition (and (place ?curpos) (key ?key) | ||
(at-robot ?curpos) (at ?key ?curpos) (arm-empty )) | ||
:effect (and (holding ?key) | ||
(not (at ?key ?curpos)) (not (arm-empty )))) | ||
|
||
|
||
(:action pickup-and-loose | ||
:parameters (?curpos ?newkey ?oldkey) | ||
:precondition (and (place ?curpos) (key ?newkey) (key ?oldkey) | ||
(at-robot ?curpos) (holding ?oldkey) (at ?newkey ?curpos)) | ||
:effect (and (holding ?newkey) (at ?oldkey ?curpos) | ||
(not (holding ?oldkey)) (not (at ?newkey ?curpos)))) | ||
|
||
(:action putdown | ||
:parameters (?curpos ?key) | ||
:precondition (and (place ?curpos) (key ?key) | ||
(at-robot ?curpos) (holding ?key)) | ||
:effect (and (arm-empty ) (at ?key ?curpos) (not (holding ?key))))) | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
..w.. | ||
..L.. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
...w... | ||
...L... | ||
...w... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
.. | ||
.. | ||
Lw | ||
.. | ||
.. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
... | ||
... | ||
... | ||
Lww | ||
... | ||
... | ||
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
..w..L.. | ||
..L..w.. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
...w...L... | ||
...L...w... | ||
...w...w... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
.. | ||
.. | ||
Lw | ||
.. | ||
.. | ||
wL | ||
.. | ||
.. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
... | ||
... | ||
... | ||
Lww | ||
... | ||
... | ||
... | ||
wwL | ||
... | ||
... | ||
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
..L.. | ||
..w.. | ||
LwwLw | ||
..w.. | ||
..w.. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
...L... | ||
...w... | ||
...w... | ||
wLwwLww | ||
...w... | ||
...w... | ||
...w... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
..L..w.. | ||
..w..L.. | ||
LwwwwwwL | ||
..L..w.. | ||
..w..L.. | ||
wLwwwwww | ||
..w..L.. | ||
..L..w.. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
...L...w... | ||
...w...L... | ||
...w...w... | ||
wLwwwwwwLww | ||
...L...w... | ||
...w...L... | ||
...w...w... | ||
wwLwwwwwwww | ||
...w...L... | ||
...w...w... | ||
...L...w... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
.. | ||
.. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
.... | ||
.... | ||
.... | ||
.... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
...... | ||
...... | ||
...... | ||
...... | ||
...... | ||
...... |
Oops, something went wrong.