vscode-pddl icon indicating copy to clipboard operation
vscode-pddl copied to clipboard

External Function call for numerical evaluation

Open ShrutheeshIR opened this issue 3 years ago • 1 comments

Hello, this is more of a planner question, rather than an issue that belongs here, but I was wondering if you support a feature, where instead of very simple arithmetic functions, such as '+', '-', '>=', if I could be able to call a function such as evaluate(a,b,c), which would return a boolean value, similar to the simple arithmetic functions. Eg., instead of

(>= (length ?a) (+ ( length ?b) (length ?c)))

to be something like

def eval_len(a,b,c):
    return a>=b+c
...
(eval_len(length ?a, length ?b, length ?c))

If this question does not belong here, apologies, will remove it.

Thanks.

ShrutheeshIR avatar Mar 03 '22 07:03 ShrutheeshIR

Theoretically the expressions could be anything, if the planner could evaluate it. Practically, however, the planner needs to be able to handle it efficiently. For that, planners build meta data about the pddl domain at hand using static and dynamic analysis. The simplicity of the pddl language makes it possible. If you build a planner that handles calls to this kind of Python code, you would have to implement static analysis of the Python expressions in order to keep the planner performant.

jan-dolejsi avatar Apr 03 '22 22:04 jan-dolejsi