Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug on compilation? #260

Closed
francescofuggitti opened this issue Jul 7, 2023 · 1 comment
Closed

Bug on compilation? #260

francescofuggitti opened this issue Jul 7, 2023 · 1 comment
Assignees
Labels
bug Something isn't working high priority

Comments

@francescofuggitti
Copy link
Member

francescofuggitti commented Jul 7, 2023

The formula O(end) & ~((~(hasDoneD)) S ((hasDoneE) & (~(hasDoneD)))) is not enforced in the actual plan. The first part of the formula is a reachability goal (i.e., reach the end), the second part of the formula intuitively says "whenever hasDoneE happens, hasDoneD has to happen eventually afterwards", which matches the DECLARE Response(hasDoneE, hasDoneD) template.

A minimal reproducible example is:

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

goal = "O(end) & ~((~(hasDoneD)) S ((hasDoneE) & (~(hasDoneD))))"

domain_parser = DomainParser()
problem_parser = ProblemParser()

domain = domain_parser(Path("domain.pddl").read_text(encoding="utf-8"))
problem = problem_parser(Path("problem.pddl").read_text(encoding="utf-8"))
formula = parse_pltl(goal)

compiler = Compiler(domain, problem, formula)
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(
        "Something wrong occurred while writing the compiled domain and problem."
    ) from e

with the following minimal domain.pddl and the problem.pddl.

The expected plan would be:

  • b, c, e, d, goal
@francescofuggitti
Copy link
Member Author

Looking better at the formula, we found that this is actually not a bug on the compilation but at problem about the specification.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working high priority
Projects
None yet
Development

No branches or pull requests

3 participants