Skip to content

Commit 0328d35

Browse files
Add random seed to Blocksworld generator for reproducibility (#41)
1 parent bec7c5f commit 0328d35

File tree

4 files changed

+12
-11
lines changed

4 files changed

+12
-11
lines changed

blocksworld/README

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@ subdirectory. The directories 3ops/2pddl and 4ops/2pddl contain
44
programs that translate the generator's output to PDDL. The random
55
instances can then be generated by running the script
66

7-
./blocksworld <ops> <num>
7+
./blocksworld <ops> <num> <seed>
88

9-
which takes as input the number of operators (either 3 or 4) and blocks
10-
in the problem to be generated. This is currently maximal 200 due to
11-
the random state generator. To increase that, edit the Makefile in
12-
bwstates.1 and increase SIZE.
9+
which takes as input the number of operators (either 3 or 4), blocks
10+
in the problem to be generated, and a random seed for reproducibility.
11+
The number of blocks is currently limited to 200 due to the random state generator.
12+
To increase that, edit the Makefile in bwstates.1 and increase SIZE.
1313

1414
## Blocksworld-3ops
1515

blocksworld/blocksworld

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,15 @@ set -euo pipefail
44

55
OPS=$1 # Either 3 or 4.
66
BLOCKS=$2
7+
SEED=$3
78

89
# Get full directory name of the script (https://stackoverflow.com/a/246128).
910
SCRIPT_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
1011

1112
BS=${SCRIPT_DIR}/bwstates.1/bwstates
1213
TR=${SCRIPT_DIR}/${OPS}ops/2pddl/2pddl
1314

14-
${BS} -s 2 -n ${BLOCKS} > STATES
15+
${BS} -s 2 -n ${BLOCKS} -r ${SEED} > STATES
1516
${TR} -d STATES -n ${BLOCKS}
1617

1718
rm STATES

blocksworld/matching/README.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ You also need to make sure that the shell script is executable via:
1515

1616
chmod +x matching-bw-generator.sh
1717

18-
Then to generate a matching-bw problem with base name "bname" and size
19-
"n" you can call:
18+
Then to generate a matching-bw problem with base name "bname", size
19+
"n", and random seed "s" you can call:
2020

21-
./matching-bw-generator.sh bname n
21+
./matching-bw-generator.sh bname n s
2222

2323
This will create two files: bname-typed.pddl and bname-untyped.pddl
2424

blocksworld/matching/matching-bw-generator.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ set -euo pipefail
66

77
cd "$(dirname "$0")"
88

9-
./../bwstates.1/bwstates -n $2 > temp.blocks || true
10-
./../bwstates.1/bwstates -n $2 >> temp.blocks || true
9+
./../bwstates.1/bwstates -n $2 -r $3 > temp.blocks || true
10+
./../bwstates.1/bwstates -n $2 -r $3 >> temp.blocks || true
1111

1212
./2pddl-typed -d temp.blocks -n $2 > $1-typed.pddl
1313
./2pddl-untyped -d temp.blocks -n $2 > $1-untyped.pddl

0 commit comments

Comments
 (0)