Classical and FOND Planning for Pure-Past Linear Temporal Logic Goals.
Installation
- from PyPI:
pip install plan4past
- from source (
mainbranch):
pip install git+https://github.com/whitemech/Plan4Past.git
or, clone the repository and install:
git clone https://github.com/whitemech/Plan4Past.git
cd Plan4Past
pip install .
Quickstart
You can use the plan4past package in two ways: as a library, and as a CLI tool.
As a library
This is an example of how you can encode a PPLTL goal formula into a PDDL domain and problem programmatically.
from pathlib import Path
from pddl.formatter import domain_to_string, problem_to_string
from pddl.parser.domain import DomainParser
from pddl.parser.problem import ProblemParser
from pylogics.parsers import parse_pltl
from plan4past.compiler import Compiler
formula = "on_b_a & O(ontable_c)"
domain_parser = DomainParser()
problem_parser = ProblemParser()
domain = domain_parser(Path("examples/pddl/domain.pddl").read_text(encoding="utf-8"))
problem = problem_parser(Path("examples/pddl/p-0.pddl").read_text(encoding="utf-8"))
goal = parse_pltl(formula)
compiler = Compiler(domain, problem, goal)
compiler.compile()
compiled_domain, compiled_problem = compiler.result
try:
with open("./new-domain.pddl", "w+", encoding="utf-8") as d:
d.write(domain_to_string(compiled_domain))
with open("./new-problem.pddl", "w+", encoding="utf-8") as p:
p.write(problem_to_string(compiled_problem))
except Exception as e:
raise IOError(
"[ERROR]: Something wrong occurred while writing the compiled domain and problem."
) from e
By executing the code above, you will obtain a new-domain.pddl as well as a new-problem.pddl in output.
As a CLI tool
The package can also be used as a CLI tool. The supported command is:
plan4past -d DOMAIN_FILE -p PROBLEM_FILE -g "PPLTL_FORMULA" [-m MAPPING]
where DOMAIN_FILE and PROBLEM_FILE are the PDDL domain and problem files, respectively, and PPLTL_FORMULA is the
goal formula expressed in Pure-Past Linear Temporal Logic.
The optional MAPPING file is a mapping between the PDDL objects and the PPLTL formula's atomic propositions.
For instance:
plan4past -d examples/pddl/domain.pddl -p examples/pddl/p-0.pddl -g "ontable_c & O(on_b_a)"
Docker & Apptainer images
A Docker image as well as an Apptainer image are available for Plan4Past.
-
To use Docker:
docker build -t plan4past .anddocker run --rm -it plan4past -
To use Apptainer:
apptainer build plan4past.sif plan4past.def
# to launch the tool:
./plan4past.sif -d examples/pddl/domain.pddl -p examples/pddl/p-0.pddl -g "ontable_c & O(on_b_a)"
Development
If you want to contribute, set up your development environment as follows:
- Intall Poetry
- Clone the repository:
git clone https://github.com/whitemech/Plan4Past.git && cd Plan4Past - Install the dependencies:
poetry shell && poetry install
Docs
To build the docs: mkdocs build
To view documentation in a browser: mkdocs serve
and then go to http://localhost:8000
License
Plan4Past is released under the GNU Lesser General Public License v3.0 or later (LGPLv3+).
Copyright 2021 -- 2023 WhiteMech
Citing
If you use Plan4Past in your research, please consider citing the following paper:
@inproceedings{icaps2023bdffgs,
author = {Luigi Bonassi and
Giuseppe {De Giacomo} and
Marco Favorito and
Francesco Fuggitti and
{Alfonso Emilio} Gerevini and
Enrico Scala},
title = {Planning for Temporally Extended Goals in Pure-Past Linear Temporal Logic},
booktitle = {{ICAPS}},
volume = {33},
url = {https://ojs.aaai.org/index.php/ICAPS/article/view/27179},
doi = {10.1609/icaps.v33i1.27179},
number = {1},
month = {Jul.},
pages = {61-69},
year = {2023},
}
Acknowledgements
Plan4Past has been partially supported by the EU H2020 project AIPlan4EU (No. 101016442), the ERC-ADG WhiteMech (No. 834228), the EU ICT-48 2020 project TAILOR (No. 952215), the PRIN project RIPER (No. 20203FFYLK), and the PNRR MUR project FAIR (No. PE0000013).
Metadata
Release files for plan4past 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| plan4past-0.1.0.tar.gz | 15.9 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| plan4past-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 39.0 kB
Release files / plan4past-0.1.0.tar.gz
| Download URL | plan4past-0.1.0.tar.gz |
|---|---|
| Size | 15.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9456a7705b8f4c3df62e34f59f9a551c45f887d145c5a7a40704f74a2769c310
|
|
BLAKE2b-256 checksum How to use checksums |
e0da28b9d30aa731a8593f23a9297cd24f60537d149ca96dcdd7a48c21a51a69
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.11
|
Release files / plan4past-0.1.0-py3-none-any.whl
| Download URL | plan4past-0.1.0-py3-none-any.whl |
|---|---|
| Size | 23.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8641a9f738e11d8c83f890b6e418b27f8ff5c192a81a01b87fc8658ab01d52c8
|
|
BLAKE2b-256 checksum How to use checksums |
c03c3e8655982a72af55cec34bba9a0cde220d940ca2dcb5d461250bb8c2a76b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.11
|
Security for plan4past 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.