Closed chmeldax closed 5 months ago
Hi @chmeldax , thank you for spotting this and for the analysis!
I fixed it in the PR linked above by returning FrozenSets instead of Sets in the walkers.
Let me know if the PR #595 fixes it for you! Thanks again
Hi @Framba-Luca, thank you for fixing this in such short span of time!
I have just tested your PR with our domain/problem and I can confirm that it does fix the issue.
Thank you again.
I close the issue since it is fixed in #595
There seems to be an issue with determining free variables (unbounded variables) when parsing certain domains that contain quantifiers and the same predicates are specified in the effects and preconditions.
Steps to reproduce:
An example domain would be:
A call to
PDDLReader().parse_problem_string(pddl_string)
then fails with this message:Expected behaviour:
A valid
Problem
object should be generated.Investigation:
I have dug into this and it seems there is an issue with the way the library works with
FreeVarsOracle
:add_effect
method usesFreeVarsOracle
to find free variables.FreeVarsOracle
usesmemoization
dictionary to store the results (in the form of sets).add_effect
retrieves the stored results, it gets a reference to a set stored in thememoization
dictionary and modifies it directly. In our casepredicate-2
expression is assigned a set{object-2-1-1 - object-2-1 object-2-1-1}
.add_precondition
uses the very same instance ofFreeVarsOracle
. Therefore, when retrieving free variables, it retrieves it from the said memoization dictionary. Therefore, the value already modified byadd_effect
is retrieved.How to fix it:
It seems it could be fixed by explicitly copying
free_vars
in theadd_effect
, i.e. https://github.com/aiplan4eu/unified-planning/blob/master/unified_planning/model/action.py#L308 could be modified as follows:It certainly fixed the problem for us. I am not sure if this might break something else, though.