Closed MFaisalZaki closed 3 months ago
Hi @MFaisalZaki, can you also provide the python code to reproduce the error?
Hi @alvalentini, I tried to provide a code to reproduce the bug since the original code that generated the bug is part of my research, and I cannot share it for now.
My code follows the following pattern:
from unified_planning.io import PDDLReader
from unified_planning.engines import PlanGenerationResultStatus as ResultsStatus
from unified_planning.shortcuts import OneshotPlanner, AnytimePlanner
from unified_planning.shortcuts import *
import up_symk
domainfile = "domain.pddl"
problemfile = "p01.pddl"
task = PDDLReader().parse_problem(domainfile, problemfile)
planlist = []
k = 5
search_config = f"symq-bd(plan_selection=top_k(num_plans={k},dump_plans=true),quality=1.0)"
with AnytimePlanner(name='symk-opt', params={"symk_anytime_search_config": search_config}) as planner:
for i, result in enumerate(planner.get_solutions(task)):
if result.status == ResultsStatus.INTERMEDIATE:
planlist.append(result.plan) if i < k else None
task = PDDLReader().parse_problem(domainfile, problemfile)
with Compiler(problem_kind = task.kind,
compilation_kind = CompilationKind.QUANTIFIERS_REMOVING) as quantifiers_remover:
qr_result = quantifiers_remover.compile(task, CompilationKind.QUANTIFIERS_REMOVING)
with Compiler(problem_kind = qr_result.problem.kind,
compilation_kind = CompilationKind.GROUNDING) as grounder:
gr_result = grounder.compile(qr_result.problem, CompilationKind.GROUNDING)
# perform other stuff
The pattern is that I solve the planning task using symk
and then generate plans and perform other operations on it. The bug appears in the grounding phase.
I hope this helps. If not, please feel free to close the issue until I release my original code, and then we can reopen it again.
Thanks.
Hi again @alvalentini,
I could reproduce the bug using one of the publicly available packages.
Please install this Python package to reproduce this:
pip install git+https://github.com/pyPMT/pyPMT.git
Using the same domain and problem files provided earlier with this code snippet, you can reproduce the bug.
from unified_planning.io import PDDLReader
from unified_planning.engines import PlanGenerationResultStatus as ResultsStatus
from unified_planning.shortcuts import OneshotPlanner, AnytimePlanner
from unified_planning.shortcuts import *
from pypmt.shortcuts import EncoderSequential
import up_symk
domainfile = "domain.pddl"
problemfile = "p01.pddl"
task = PDDLReader().parse_problem(domainfile, problemfile)
planlist = []
k = 5
search_config = f"symq-bd(plan_selection=top_k(num_plans={k},dump_plans=true),quality=1.0)"
with AnytimePlanner(name='symk-opt', params={"symk_anytime_search_config": search_config}) as planner:
for i, result in enumerate(planner.get_solutions(task)):
if result.status == ResultsStatus.INTERMEDIATE:
planlist.append(result.plan) if i < k else None
encoded_task = EncoderSequential(task)
Also, you can try it without the need for an external package.
from unified_planning.io import PDDLReader
domainfile = "domain.pddl"
problemfile = "p01.pddl"
task = PDDLReader().parse_problem(domainfile, problemfile)
with Compiler(problem_kind = task.kind,
compilation_kind = CompilationKind.QUANTIFIERS_REMOVING) as quantifiers_remover:
qr_result = quantifiers_remover.compile(task, CompilationKind.QUANTIFIERS_REMOVING)
with Compiler(problem_kind = qr_result.problem.kind,
compilation_kind = CompilationKind.GROUNDING) as grounder:
gr_result = grounder.compile(qr_result.problem, CompilationKind.GROUNDING)
@MFaisalZaki I tried to reproduce the bug but I was not able.
Looking at the error message, the UPUnsupportedProblemTypeError
exception is probably raised by pyperplan, that is not able to handle implies. So it is an expected exception if you are using pyperplan with this kind of problem.
However the code that you provided should not select pyperplan to ground the problem. And if I try to run your code, pyperplan is not selected and I get no errors.
Which version of the library are you using? And which versions of the engines?
@alvalentini here are the packages versions installed:
ConfigSpace==0.7.1
more-itertools==10.3.0
networkx==3.3
numpy==1.26.4
pyparsing==3.1.2
pyperplan==2.1
pypmt @ git+https://github.com/pyPMT/pyPMT.git@554c4e87f37ee903ebb07e733f36d63c3b920078
scipy==1.13.1
typing_extensions==4.12.2
unified-planning==1.1.0
up-fast-downward==0.4.1
up-pyperplan==1.1.0
up-symk==1.3.1
z3-solver==4.13.0.0
Ok, the problem is the one you reported in #593 and that is solved in #594.
The fix it is still not in a stable release but if you install the latest version of the library it should be fixed.
You can install the master
of this repo or the latest pre release version from pypi (pip3 install --pre unified-planning
)
great, thanks @alvalentini.
The parser throws due to an
implies
keyword:We can use Compliers to simplify such expressions. However, I can't figure out which compiler I should use.
Here is the planning task that throws this exception.
Thanks