Skip to content

Commit f235fee

Browse files
committed
Stop claiming bfs is cost-optimal, and rewrite the contributing guide
The optimality sentence was wrong in a way that matters. `bfs` and `iddfs` minimise plan *length*; that is only cost-optimality when every action costs the same. On a four-action `:action-costs` domain with one expensive shortcut, A* and Dijkstra return the three-step plan costing 3 and both of those return the one-step plan costing 10. `iddfs` is in `OPTIMAL_PLANNERS` and the README did not even list it, so the two disagreed in both directions. The source knew -- `uninformed.py` has `optimal = True # for unit-cost / plan-length` -- the README dropped the qualifier. `awastar` needed its admissibility precondition back, and `bnb`'s default 200 000-expansion ceiling is worth saying out loud, since a run that hits it is no longer a proof of anything. `docs/CONTRIBUTING.md` was an unadapted 2018 template. It told contributors their work would be "licensed under its MIT License" -- the project is Apache-2.0, as the same file says twenty lines earlier -- pointed "report bugs using Github's issues" at a stranger's unrelated repository, offered an empty link for opening one, asked people to branch from `master`, and spent a paragraph in the first person about someone else's StackOverflow question about R. It now defers to the org-wide guide and covers only what is specific here: the submodule, the real floor, the commands CI runs, and the fact that this repo's guarantee words are wired to an attribute the workbench publishes. Also: the install line said Python 3.9 in the release whose changelog announced the move to 3.10; `demos/` was described as six instances and holds thirteen; `generate` was said to reproduce most of them, where it reproduces two byte-for-byte; and the architecture tree omitted `learn/` and `api.py` -- a headline feature and the module every library example imports from.
1 parent e0522cc commit f235fee

3 files changed

Lines changed: 78 additions & 48 deletions

File tree

.github/workflows/pages.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,9 @@ concurrency:
1919
cancel-in-progress: true
2020

2121
jobs:
22-
# Not called `build`: .mergify.yml keys a merge rule on a check named
23-
# `build`, and that must mean the packaging workflow, not this one.
22+
# Not called `build`: that name belongs to the packaging workflow, and two
23+
# checks with one name is a reliable way to gate a merge on the wrong one.
24+
# (Mergify used to key a rule on it; Mergify is gone, the reasoning is not.)
2425
bundle:
2526
runs-on: ubuntu-latest
2627
steps:

README.md

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ actually *watch*. ✨
99
**[▶ Open the workbench](https://openplan-labs.github.io/PythonPDDL/)** ·
1010
[Watch the 105-second tour](promo/jupyddl-promo.mp4)
1111

12+
The repository is `PythonPDDL`; the package is `jupyddl`. That is what you
13+
install and what you import.
14+
1215
</div>
1316

1417
<div align="center">
@@ -72,7 +75,7 @@ is trivial to install, embed, teach with, and build on.
7275

7376
## Install 💾
7477

75-
Requires Python ≥ 3.9, and nothing else:
78+
Requires Python ≥ 3.10, and nothing else:
7679

7780
```bash
7881
pip install jupyddl # the framework and the CLI
@@ -423,7 +426,7 @@ jupyddl benchmark demos --planners astar,gbfs,ehc,bfs --heuristic hff \
423426

424427
## Demo instances 🧪
425428

426-
`demos/` holds six instances chosen to stress different parts of the framework —
429+
`demos/` holds thirteen instances chosen to stress different parts of the framework —
427430
and to make the difference between planners obvious:
428431

429432
| Instance | What it exercises | Optimal cost |
@@ -442,8 +445,12 @@ and to make the difference between planners obvious:
442445
| `errands` | **preferences + constraints**: soft goals priced by a metric | 10 |
443446
| `timed-market` | **timed initial literals**: the plan waits for opening time | 4 |
444447

445-
Most were produced by the generators, so `jupyddl generate` reproduces them
446-
exactly; `network` is hand-written because a recursive axiom is the point of it.
448+
Two of them are byte-for-byte generator output — `blocksworld12` is
449+
`generate blocksworld --size 12 --seed 3`, `workshop` is
450+
`generate workshop --size 3 --seed 1`. The rest were either hand-written
451+
(`sokoban`, `hanoi`, `elevator`, `errands`, `timed-market`, and `network`,
452+
whose recursive axiom is the point of it) or generated and then edited by hand,
453+
so `generate` will produce something equivalent but not identical.
447454

448455
The `pddl-examples` git submodule supplies the smaller instances used by the
449456
parser and grounder tests.
@@ -459,10 +466,15 @@ parser and grounder tests.
459466

460467
Heuristics: `blind`, `goalcount`, `hmax`, `hadd`, `hff`, `h1`, `h2`/`hm`, `lmcut`.
461468

462-
`astar`, `idastar`, `bnb` and `dijkstra`/`bfs` are cost-optimal (the first three
463-
given an admissible heuristic — `blind`, `hmax`, `h1`/`h2`, `lmcut`). `awastar`
464-
lowers its weight until it reaches plain A*, so its last plan is optimal if the
465-
run completes. `hc`, `beam` and `iw` trade completeness for speed, and `iw` needs
469+
`astar`, `idastar` and `bnb` are cost-optimal given an **admissible** heuristic
470+
`blind`, `hmax`, `h1`/`h2`, `lmcut`. `dijkstra` is cost-optimal
471+
unconditionally. `bfs` and `iddfs` minimise **plan length**, which is the same
472+
thing only when every action costs the same; on a domain with `:action-costs`
473+
they will happily return a shorter, more expensive plan. `bnb` also carries a
474+
default ceiling (200 000 expansions, depth 200), and a run that hits it is no
475+
longer a proof of optimality. `awastar` lowers its weight until it reaches
476+
plain A*, so its last plan is optimal if the run completes **and** the
477+
heuristic is admissible. `hc`, `beam` and `iw` trade completeness for speed, and `iw` needs
466478
no heuristic at all — it prunes by *novelty* instead.
467479

468480
## PDDL support 🧾
@@ -534,9 +546,13 @@ jupyddl/
534546
trace.py search observers, events and serialisable traces
535547
live.py zero-dependency live terminal dashboard
536548
generator.py reproducible instance generators
549+
learn/ heuristic learning: feature extraction, CEM, evaluation
550+
(the 'learn' extra; NumPy only makes it faster)
551+
api.py the library entry points -- solve, build_task, trace_search
537552
viz/ matplotlib theme, charts, animations (the 'viz' extra)
538553
benchmark.py comparative benchmarking (CSV + plots)
539-
cli.py solve / benchmark / animate / demo / requirements / generate
554+
cli.py solve / benchmark / animate / demo / requirements /
555+
generate / learn
540556
web/ the Pyodide workbench
541557
tools/ web bundler and the promo-video renderer
542558
demos/ demo instances used by the docs, charts and video

docs/CONTRIBUTING.md

Lines changed: 50 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,64 @@
11
# Contributing to PythonPDDL
2-
We love your input! We want to make contributing to this project as easy and transparent as possible, whether it's:
32

4-
- Reporting a bug
5-
- Discussing the current state of the code
6-
- Submitting a fix
7-
- Proposing new features
8-
- Becoming a maintainer
3+
Thanks for showing up.
94

10-
## We Develop with Github
11-
We use github to host code, to track issues and feature requests, as well as accept pull requests.
5+
This repository is `openplan-labs/PythonPDDL`; the package it publishes is
6+
called **`jupyddl`**, which is what you import and what you `pip install`.
127

13-
## We Use [Github Flow](https://guides.github.com/introduction/flow/index.html), So All Code Changes Happen Through Pull Requests
14-
Pull requests are the best way to propose changes to the codebase (we use [Github Flow](https://guides.github.com/introduction/flow/index.html)). We actively welcome your pull requests:
8+
The [org-wide contributing guide](https://github.com/openplan-labs/.github/blob/main/CONTRIBUTING.md)
9+
covers the PR flow, commit style, and what a useful bug report contains. This
10+
page covers only what is specific to this repository.
1511

16-
1. Fork the repo and create your branch from `master`.
17-
2. If you've added code that should be tested, add tests.
18-
3. If you've changed APIs, update the documentation.
19-
4. Ensure the test suite passes.
20-
5. Make sure your code lints.
21-
6. Issue that pull request!
12+
## Setting up
2213

23-
## Any contributions you make will be under the Apache 2.0 Software License
24-
In short, when you submit code changes, your submissions are understood to be under the same [Apache 2.0](https://choosealicense.com/licenses/apache-2.0/) that covers the project. Feel free to contact the maintainers if that's a concern.
14+
The `pddl-examples` submodule supplies the instances the tests and benchmarks
15+
read, so clone with it:
2516

26-
## Report bugs using Github's [issues](https://github.com/briandk/transcriptase-atom/issues)
27-
We use GitHub issues to track public bugs. Report a bug by [opening a new issue](); it's that easy!
17+
```bash
18+
git clone --recurse-submodules https://github.com/openplan-labs/PythonPDDL
19+
```
2820

29-
## Write bug reports with detail, background, and sample code
30-
[This is an example](http://stackoverflow.com/q/12488905/180626) of a bug report I wrote, and I think it's not a bad model. Here's [another example from Craig Hockenberry](http://www.openradar.me/11905408), an app developer whom I greatly respect.
21+
Python 3.10 is the floor; CI runs 3.10 through 3.14.
3122

32-
**Great Bug Reports** tend to have:
23+
```bash
24+
uv venv
25+
uv pip install -e ".[dev,viz,learn]"
26+
```
3327

34-
- A quick summary and/or background
35-
- Steps to reproduce
36-
- Be specific!
37-
- Give sample code if you can. [My stackoverflow question](http://stackoverflow.com/q/12488905/180626) includes sample code that *anyone* with a base R setup can run to reproduce what I was seeing
38-
- What you expected would happen
39-
- What actually happens
40-
- Notes (possibly including why you think this might be happening, or stuff you tried that didn't work)
28+
## What CI will run
4129

42-
People *love* thorough bug reports. I'm not even kidding.
30+
```bash
31+
flake8 jupyddl tests tools --count --statistics
32+
pytest
33+
black . # CI reformats main automatically, but reviewers read diffs
34+
```
4335

44-
## Use a Consistent Coding Style
45-
We use black to format automatically your PR to master. Please ensure PEP8 and PEP20 are respected.
36+
The `learn` extra is optional at runtime and its NumPy path is not exercised by
37+
every CI job. If you touch `jupyddl/learn/`, run the suite with it installed.
4638

47-
## License
48-
By contributing, you agree that your contributions will be licensed under its MIT License.
39+
## Filing a bug
4940

50-
## References
51-
This document was adapted from the open-source contribution guidelines for [Facebook's Draft](https://github.com/facebook/draft-js/blob/a9316a723f9e918afde44dea68b5f9f39b7d9b00/CONTRIBUTING.md)
41+
A parser or planner bug needs its input. Attach the **domain and problem
42+
files**, say which **planner and heuristic** you ran (`astar` alone is
43+
ambiguous; `astar` with `lmcut` is not), and give the exact command.
44+
45+
If you are reporting that something is slow, conditions are part of the report:
46+
machine, instance, and how you measured. A number without them is not a result.
47+
48+
## Changing a guarantee
49+
50+
`optimal`, `complete`, `admissible` and `anytime` are load-bearing words here —
51+
`OPTIMAL_PLANNERS` in [`jupyddl/search/__init__.py`](../jupyddl/search/__init__.py)
52+
is derived from an `optimal` attribute on each planner, and the workbench
53+
publishes it. If a change moves a planner in or out of that set, or narrows the
54+
assumption a guarantee holds under, say so in the PR description.
55+
56+
New planners and heuristics should cite the paper they implement — name and
57+
year — in the docstring. It tells a later reader which variant they are
58+
getting.
59+
60+
## Licence
61+
62+
This project is licensed under **Apache 2.0** (see [`LICENSE`](../LICENSE)). By
63+
contributing, you agree that your contributions are licensed under the same
64+
terms.

0 commit comments

Comments
 (0)