Skip to content

Commit

Permalink
Adding a minor change to allow for equality in metric goal conditions.
Browse files Browse the repository at this point in the history
  • Loading branch information
haz committed Dec 28, 2023
1 parent 7777d69 commit 260fe74
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
1 change: 0 additions & 1 deletion pddl/parser/problem.lark
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ basic_function_term: NAME
| LPAR NAME NAME* RPAR

atomic_formula_name: LPAR predicate NAME* RPAR
| LPAR EQUAL_OP NAME NAME RPAR

goal: LPAR GOAL gd_name RPAR

Expand Down
25 changes: 25 additions & 0 deletions tests/test_parser/test_problem.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,3 +153,28 @@ def test_numeric_function_comparison_in_goal() -> None:
"""
)
ProblemParser()(problem_str)


def test_numeric_function_equality_in_goal() -> None:
"""Try to parse a goal with a numeric condition and function."""
problem_str = dedent(
"""
(define (problem hello-3-times)
(:domain hello-world-functions)
(:init
; if this was undefined, some planners would not assumed `0`
(= (hello_counter jimmy) 0)
(= (hello_counter jammy) 0)
)
(:goal
(and
(= 3 (hello_counter jimmy))
(= (hello_counter jammy) 5)
)
)
)
"""
)
ProblemParser()(problem_str)

0 comments on commit 260fe74

Please sign in to comment.