How to idiomatically extract all fluents present in a formula? #600
-
I'm doing some preprocessing of the preconditions of a problem, and I need to extract all variables present in them. Once I get a grounded action and access its precondition, I have been able to extract its variables by using: It feels a bit strange having to access the environment of the precondition to have access to the walker for then calling the Thanks and apologies in advance if there is a more obvious way that I've overlooked! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hi @JoanEspasa , for the Currently, the cleanest way to do it is to store the For example: fve = problem.environment.free_vars_extractor
...
pre_free_variables = fve.get(pre) |
Beta Was this translation helpful? Give feedback.
Hi @JoanEspasa , for the
simplification
andsubstitution
we made a "shortcut" (like pre.simplify()), but not for the extraction of variables; this might be a useful shortcut to add even if I am not entirely sure due to the complex and not immediate naming of that functionality.Currently, the cleanest way to do it is to store the
free_vars_extractor
of theenvironment
in a variable and call it.For example: