This implementation uses the bwstates application from John Slaney and Sylvie Thiébaux
Clone this repository.
Download the bwstates sources from ftp://arp.anu.edu.au/pub/bwstates.1.tar.gz (In case you cannot find it you can download my compiled version also with the sources here)
Untar and unzip the file with
tar xvfz bwstates.1.tar.gz
(this will create a folder bwstates.1)
Copy the entire folder bwstates.1 into the folder /gym-blocksworld/gym_blocksworld/envs/BWSTATES
Compile the sources in the folder bwstates.1 (follow the instructions in bwstates1/README.ms). This should generate a binary file /bwstates.1/bwstates
Go to the folder containing the cloned repository (this folder should contain the cloned folder gym-blocksworld) and run the following command:
pip install -e gym-blocksworld
The folder /examples includes the file runEnvironment.py
IMPORTANT: You need to specify the number of blocks in a file numBlocks.json. See the file numBlocks.json in the folder /examples
Edit the file numBlocks.json
The observations of the environment include the current state of the environment and also the goal state.
For example for an environment of 3 Blocks:
The representation for the above observation would be [3 1 0 0 0 2] The three first digits (3 1 0) are the current state of the environment. Each array's position represents the position of the block and a value of 0 represents the table or the floor.
For example, for the (3 1 0), the 3 in the first position of the array means "Block 1 is on top of Block 3", the 1 in the second position of the array means "Block 2 is on top of Block 1" and finally the 0 in the third position of the array means "Block 3 is on top of the table or the floor").
The three last digits (0 0 2) are the goal state of the environment. For example (0 0 2) means "Block 1 is on top of the table", "Block 2 is on top of the table", "Block 3 is on top of Block ".
For the actions, the representation is a 2 position array. The first position indicates which block to be moved, and the second value indicates the destination of such block. A value of 0 represents the table or the floor. For example, if next action is [1, 0] means "Move Block 1 to the table or to the floor". If the action is [2, 1] would mean "Move Block 2 on top of Block 1".