Classical and FOND Planning for Pure-Past Linear Temporal Logic Goals
Project description
Classical and FOND Planning for Pure-Past Linear Temporal Logic Goals.
Installation
- from PyPI:
pip install plan4past
- from source (
main
branch):
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).
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file plan4past-0.1.0.tar.gz
.
File metadata
- Download URL: plan4past-0.1.0.tar.gz
- Upload date:
- Size: 15.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.11
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9456a7705b8f4c3df62e34f59f9a551c45f887d145c5a7a40704f74a2769c310 |
|
MD5 | 8364de8efa3293990e72b697322fb79e |
|
BLAKE2b-256 | e0da28b9d30aa731a8593f23a9297cd24f60537d149ca96dcdd7a48c21a51a69 |
File details
Details for the file plan4past-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: plan4past-0.1.0-py3-none-any.whl
- Upload date:
- Size: 23.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.11
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8641a9f738e11d8c83f890b6e418b27f8ff5c192a81a01b87fc8658ab01d52c8 |
|
MD5 | 0306e0c89b34a3a5ef30918c3aaf09d4 |
|
BLAKE2b-256 | c03c3e8655982a72af55cec34bba9a0cde220d940ca2dcb5d461250bb8c2a76b |