aiplan4eu / unified-planning

The AIPlan4EU Unified Planning Library
Apache License 2.0
181 stars 39 forks source link

Imply keyword throws exception when performing QUANTIFIERS_REMOVING #593

Closed MFaisalZaki closed 5 months ago

MFaisalZaki commented 5 months ago

In one of the IPC-2006 domains (e.g. trucks), the domain model has forall and imply keywords in some actions' preconditions. I tried to apply a QUANTIFIERS_REMOVING followed by GROUNDING, but I do get this error:

Screenshot from 2024-04-11 13-03-41

Here is the code to reproduce:

from unified_planning.shortcuts import *
from unified_planning.engines import CompilationKind
from unified_planning.io import PDDLReader

task = PDDLReader().parse_problem('./domain.pddl', './problem.pddl')

compilation_kinds_to_apply = [
    CompilationKind.QUANTIFIERS_REMOVING,
    CompilationKind.CONDITIONAL_EFFECTS_REMOVING,
    CompilationKind.GROUNDING
]

compiled_results = None
for compilation_kind in compilation_kinds_to_apply:
    with Compiler(problem_kind=task.kind, compilation_kind=compilation_kind) as compiler:
        task = compiler.compile(task, compilation_kind)
        task = task.problem

and here is the used planning task

Framba-Luca commented 5 months ago

Hi @MFaisalZaki , it looks like the error comes from up-pyperplan, when you try to do the grounding.

The problem is that the IMPLY didn't set correctly the ProblemKind, so pyperplan was called on a problem it didn't support.

Let me know if the PR I opened works for you. Thanks

MFaisalZaki commented 5 months ago

Thanks a lot @Framba-Luca.

alvalentini commented 5 months ago

I close the issue since it is solved in #594