Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Types validation is case sensitive #95

Open
francescofuggitti opened this issue Oct 14, 2023 · 0 comments
Open

Types validation is case sensitive #95

francescofuggitti opened this issue Oct 14, 2023 · 0 comments
Labels
bug Something isn't working high-priority High-priority tasks.

Comments

@francescofuggitti
Copy link
Collaborator

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.

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:

;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:

(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

    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'}
@francescofuggitti francescofuggitti added bug Something isn't working high-priority High-priority tasks. labels Oct 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working high-priority High-priority tasks.
Projects
None yet
Development

No branches or pull requests

1 participant