diff --git a/blocksworld/README b/blocksworld/README index 5dcd0a1b6..8789baf71 100644 --- a/blocksworld/README +++ b/blocksworld/README @@ -4,12 +4,12 @@ subdirectory. The directories 3ops/2pddl and 4ops/2pddl contain programs that translate the generator's output to PDDL. The random instances can then be generated by running the script -./blocksworld +./blocksworld -which takes as input the number of operators (either 3 or 4) and blocks -in the problem to be generated. This is currently maximal 200 due to -the random state generator. To increase that, edit the Makefile in -bwstates.1 and increase SIZE. +which takes as input the number of operators (either 3 or 4), blocks +in the problem to be generated, and a random seed for reproducibility. +The number of blocks is currently limited to 200 due to the random state generator. +To increase that, edit the Makefile in bwstates.1 and increase SIZE. ## Blocksworld-3ops diff --git a/blocksworld/blocksworld b/blocksworld/blocksworld index 74f282313..0ee021cf3 100755 --- a/blocksworld/blocksworld +++ b/blocksworld/blocksworld @@ -4,6 +4,7 @@ set -euo pipefail OPS=$1 # Either 3 or 4. BLOCKS=$2 +SEED=$3 # Get full directory name of the script (https://stackoverflow.com/a/246128). SCRIPT_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" @@ -11,7 +12,7 @@ SCRIPT_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) BS=${SCRIPT_DIR}/bwstates.1/bwstates TR=${SCRIPT_DIR}/${OPS}ops/2pddl/2pddl -${BS} -s 2 -n ${BLOCKS} > STATES +${BS} -s 2 -n ${BLOCKS} -r ${SEED} > STATES ${TR} -d STATES -n ${BLOCKS} rm STATES diff --git a/blocksworld/matching/README.txt b/blocksworld/matching/README.txt index 617208413..f528b6c79 100644 --- a/blocksworld/matching/README.txt +++ b/blocksworld/matching/README.txt @@ -15,10 +15,10 @@ You also need to make sure that the shell script is executable via: chmod +x matching-bw-generator.sh -Then to generate a matching-bw problem with base name "bname" and size -"n" you can call: +Then to generate a matching-bw problem with base name "bname", size +"n", and random seed "s" you can call: - ./matching-bw-generator.sh bname n + ./matching-bw-generator.sh bname n s This will create two files: bname-typed.pddl and bname-untyped.pddl diff --git a/blocksworld/matching/matching-bw-generator.sh b/blocksworld/matching/matching-bw-generator.sh index 50a335ae0..42c32d6dd 100755 --- a/blocksworld/matching/matching-bw-generator.sh +++ b/blocksworld/matching/matching-bw-generator.sh @@ -6,8 +6,8 @@ set -euo pipefail cd "$(dirname "$0")" -./../bwstates.1/bwstates -n $2 > temp.blocks || true -./../bwstates.1/bwstates -n $2 >> temp.blocks || true +./../bwstates.1/bwstates -n $2 -r $3 > temp.blocks || true +./../bwstates.1/bwstates -n $2 -r $3 >> temp.blocks || true ./2pddl-typed -d temp.blocks -n $2 > $1-typed.pddl ./2pddl-untyped -d temp.blocks -n $2 > $1-untyped.pddl