AI-Planning / AI-Planning/pddl

Types validation is case sensitive

未關閉
#95 5 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
bug high-priority
主要語言
Python
星號
177
分支
43
平均合併
49 分鐘
30 天內合併 PR
1

描述

### Subject of the issue

When types are validated, if the same type is written with different cases (e.g., sometimes capitalized sometimes not), the parser throws an error.

The specific error happens at line 228 of `pddl/_validation.py` in the `_check_types_are_available` function.

```python
def _check_types_are_available(
self, type_tags: Collection[name_type], what: str
) -> None:
"""Check that the types are available in the domain."""
if not self._types.all_types.issuperset(type_tags):
raise PDDLValidationError(
f"types {sorted(type_tags)} of {what} are not in available types {self._types.all_types}"
)
```

### Steps to reproduce

Minimal example to reproduce the error:

PDDL domain:
```pddl
;Hello world domain to test numerical fluents (functions)
(define (domain hello-world-functions)
(:requirements :strips :typing :numeric-fluents)

(:types Counter - object)
(:functions
(hello_counter)
)

(:action say-hello-world
:parameters (?c - counter)
:precondition (and (<= (hello_counter) 3))
:effect (and (increase (hello_counter) 1))
)
)
```

PDDL problem:
```pddl
(define (problem hello-3-times)
(:domain hello-world-functions)
(:objects counter1 - counter)
(:init
(counter1)
; if this was undefined, some planners would not assumed `0`
(= (hello_counter) 0)
)

(:goal
(>= (hello_counter) 3)
)
)
```

### Actual behaviour
```python
raise VisitError(tree.data, tree, e)
lark.exceptions.VisitError: Error trying to process rule "domain":

types ['counter'] of term Variable(c) are not in available types {'Counter', 'object'}
```

貢獻指南

開啟貢獻指南

評估

這個 Issue 還沒有評估資料。

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。