Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -70,3 +70,4 @@ tyreworld/tyreworld
visitall/grid
zenotravel/ztravel
termes/boards/random_*
__pycache__/
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ This repository is a collection of PDDL generators, some of which have been used
to generate benchmarks for the International Planning Competition (IPC).

# Instructions
* Install dependencies: ``sudo apt install g++ make python3``
* Install dependencies: ``sudo apt install g++ make cmake python3``
* Build all generators: ``./build_all``
* Build in parallel: ``./build_all -j4``
* Delete (some) intermediate files: ``./build_all clean``
Expand Down
22 changes: 19 additions & 3 deletions minigrid/mini_grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from collections import deque
from copy import deepcopy
import logging
import os
from pathlib import Path
import random
import sys
Expand Down Expand Up @@ -305,14 +306,29 @@ def main(args: argparse.Namespace):
floorplan = Floorplan(args.floorplans_path / args.floorplan, logger)

# generate random instances
name = args.floorplan.name
args.results.mkdir(parents=True, exist_ok=True)
nr_generated = 0
for i in range(args.num_instances):
name = f'grid_{name}_s{args.nshapes}_seed{args.seed}_n{i}'.replace('.', '_')
name = f'grid_{args.floorplan.name}_s{args.nshapes}_seed{args.seed}_n{i}'.replace('.', '_')
pddl_name = args.results / Path(name).with_suffix('.pddl')
instance = Instance(name, floorplan, args.nshapes, logger)
try:
instance = Instance(name, floorplan, args.nshapes, logger)
except AssertionError as e:
logger.error(f'Could not generate instance {name}: {e}')
continue
instance.write(pddl_name)
logger.info(f'{pddl_name} written!')
nr_generated += 1

logger.info(f'Generated {nr_generated} instances, out of {args.num_instances} requested')

# Copy the domain file to the results folder
domain_src = Path(__file__).parent / 'domain.pddl'
domain_dst = args.results / 'domain.pddl'
if domain_src != domain_dst and not os.path.exists(domain_dst):
import shutil
shutil.copy(domain_src, domain_dst)
logger.info(f'Copied domain file to {domain_dst}')


if __name__ == '__main__':
Expand Down