Skip to content

Commit 47f09fc

Browse files
committed
Merge branch 'master' into lprelax
2 parents 76c177e + a84cf18 commit 47f09fc

34 files changed

Lines changed: 1175 additions & 508 deletions

File tree

ci/ipc.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
11
import os
2-
from pathlib import Path
32
import re
43
import subprocess # nosec: B404
54
import sys
65
import time
6+
from pathlib import Path
77
from typing import Dict, List, Optional, Tuple
88

99
from unified_planning.engines.results import PlanGenerationResultStatus as Status
1010
from unified_planning.io.pddl_reader import PDDLReader
1111
from unified_planning.plans import Plan
1212
from unified_planning.shortcuts import OneshotPlanner
1313

14-
1514
# ============================================================================ #
1615
# Constants #
1716
# ============================================================================ #
@@ -162,10 +161,7 @@ def validate_plan_with_val(pb: Path, dom: Path, plan: Path) -> bool:
162161
ext = "pddl"
163162
if ":hierarchy" in dom.read_text():
164163
ext = "hddl"
165-
cmd = (
166-
f"./planning/ext/val-{ext} "
167-
f"{dom.as_posix()} {pb.as_posix()} {plan.as_posix()}"
168-
)
164+
cmd = f"./planning/ext/val-{ext} {dom.as_posix()} {pb.as_posix()} {plan.as_posix()}"
169165
return (
170166
subprocess.run(
171167
cmd,
@@ -185,6 +181,9 @@ def validate_plan_with_val(pb: Path, dom: Path, plan: Path) -> bool:
185181
pb_folders = Path(__file__).parent.parent / "planning/problems/upf"
186182
problems = sorted(pb_folders.iterdir(), key=lambda f: f.stem)
187183

184+
# ignore the woodworking domain that requires adherence to the delete-before-add semantics
185+
problems = [f for f in problems if "ipc2008-woodworking" not in f.stem]
186+
188187
if len(sys.argv) > 1:
189188
problems = [pb for pb in problems if pb.stem in sys.argv[1:]]
190189

@@ -264,7 +263,9 @@ def validate_plan_with_val(pb: Path, dom: Path, plan: Path) -> bool:
264263
# Solved problem
265264
if result.status in VALID_STATUS:
266265
write_line("\nValidating plan by Val", cyan=True)
267-
out_path = Path(out_file).with_stem((Path(out_file).stem + "_val"))
266+
out_path = Path(out_file).with_stem(
267+
(Path(out_file).stem + "_val")
268+
)
268269
extract_plan_for_val(result.plan, domain, problem, out_path)
269270
if validate_plan_with_val(problem, domain, out_path):
270271
write_line("Plan is valid", bold=True, green=True)

justfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ ci: ci-up-solve ci-up-val ci-ipc ci-warm-up
44

55
# Run planning tests for UP integration
66
ci-up-solve:
7-
python3 planning/unified/deps/unified-planning/up_test_cases/report.py aries -e up_aries_tests
7+
# ignore invalid problem `robot_with_variable_duration`. Bug report: https://github.com/aiplan4eu/unified-planning/pull/734
8+
python3 planning/unified/deps/unified-planning/up_test_cases/report.py aries -e up_aries_tests -b robot_with_variable_duration
89

910
# Run validation tests for UP integration
1011
ci-up-val:

planning/engine/README.md

Lines changed: 54 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,65 @@
11

2-
# Aries Planning Engine
2+
# Aries Planning Engine (APE)
33

4-
WIP: this in an ongoing effort to reimplement the Aries solver planning capabilities for PDDL.
4+
Disclaimer this in an ongoing effort to reimplement the Aries solver planning capabilities for PDDL and different functionalities have different maturity levels.
5+
In particular, elements marked as WIP are not feature complete and should not be relied upon.
56

7+
The CLI tool currently proposes the following functionalities:
68

9+
- `parse`: parsing of PDDL problem files
10+
- `parse-domain`: parsing of lone PDDL domain file
11+
- `validate` (WIP): validate a PDDL plan
12+
- `plan-optimization` (WIP): optimize a given PDDL plans, specifying the target metrics and allowed relaxations
13+
- `dom-repair`: Propose fixes of a broken PDDL domain so that a target plan is valid.
714

15+
## Installation
16+
17+
The usage section assumes that you have the `ape` executable on your path. It can be installed globally from the latest version in the git repository (but requires a [rust toolchain](https://rust-lang.org/tools/install/)).
818

9-
## Domain repair
19+
```sh
20+
# Install
21+
cargo install --bin ape --git https://github.com/plaans/aries aries-plan-engine
22+
```
23+
24+
To install from a locally checked-out version of aries:
1025

26+
```sh
27+
# Install `ape` globally, assuming that you are in the same directory as this file (planning/engine/).
28+
cargo install --bin ape --path .
29+
```
1130

31+
For development, you can simply replace the `ape` command by `cargo run [--release] --bin ape --` which will compile `ape` and then run it with the arguments provided after the finals `--`.
32+
Omitting the `--release` flag will produce non-optimized builds that would be substantially faster to compile (but much slower for execution.)
33+
34+
## Usage
1235

1336
```sh
14-
# Domain repair options.
15-
cargo run --bin aries-plan-engine -- dom-repair --help
16-
# Attempts to find fix to the (autmoatically infered) domain for this plan
17-
cargo run --bin aries-plan-engine -- dom-repair planning/problems/pddl/tests/gripper.plan
37+
# List available commands
38+
ape --help
39+
40+
# Print help for a particular command (here `validate`)
41+
ape validate --help
1842
```
43+
44+
45+
## Naming conventions for PDDL problems and domains
46+
47+
Ape relies on naming conventions to find the domain associated to a problem files (which avoids having to specify it manually on the command line).
48+
49+
Given a problem file, `ape` would consider candidate domain files in the same or parent directory, with a set of possible name depending on the problem filename:
50+
51+
- `*.pddl` -> `domain.pddl`
52+
- `XXXXX.YY.pb.pddl` -> `XXXXX.dom.pddl`
53+
- `XXXXX.pb.pddl` -> `XXXXX-domain.pddl`
54+
- `instance-NN.pddl` -> `domain-NN.pddl`
55+
56+
These are implemented in the [find_domain_of](https://github.com/plaans/aries/blob/master/planning/planx/src/pddl/find_file.rs) function, which may serve as a reference.
57+
58+
This can be used on the command line with the `find-domain` command, that will print the domain file on the standard output.
59+
This can be useful when integration with other tools, e.g.,
60+
```sh
61+
my-planner --domain `ape find-domain ${PROBLEM_FILE}` --problem ${PROBLEM_FILE}
62+
```
63+
It is notably used in the [`zed-pddl`](https://github.com/arbimo/zed-pddl) extension for Zed.
64+
65+
Note that at this point, the discovery is purely based on the filenames, with no attempt to validate that the domain name matches the one declared in the problem.

0 commit comments

Comments
 (0)