Skip to content

Commit

Permalink
fix strips requirements
Browse files Browse the repository at this point in the history
  • Loading branch information
francescofuggitti committed Sep 28, 2023
1 parent 0354e20 commit e28585f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 12 deletions.
18 changes: 7 additions & 11 deletions pddl/requirements.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,11 @@ class Requirements(Enum):
NON_DETERMINISTIC = RS.NON_DETERMINISTIC.strip()

@classmethod
def strips_requirements(cls) -> Set["Requirements"]:
"""Get the STRIPS requirements."""
def quantified_precondition_requirements(cls) -> Set["Requirements"]:
"""Get the quantified precondition requirements."""
return {
Requirements.TYPING,
Requirements.NEG_PRECONDITION,
Requirements.DIS_PRECONDITION,
Requirements.EQUALITY,
Requirements.CONDITIONAL_EFFECTS,
Requirements.UNIVERSAL_PRECONDITION,
Requirements.EXISTENTIAL_PRECONDITION,
}

@classmethod
Expand All @@ -55,9 +52,8 @@ def adl_requirements(cls) -> Set["Requirements"]:
Requirements.NEG_PRECONDITION,
Requirements.DIS_PRECONDITION,
Requirements.EQUALITY,
Requirements.QUANTIFIED_PRECONDITION,
Requirements.CONDITIONAL_EFFECTS,
}
}.union(cls.quantified_precondition_requirements())

def __str__(self) -> str:
"""Get the string representation."""
Expand All @@ -80,8 +76,8 @@ def _extend_domain_requirements(
) -> Set[Requirements]:
"""Extend the requirements with the domain requirements."""
extended_requirements = set(requirements)
if Requirements.STRIPS in requirements:
extended_requirements.update(Requirements.strips_requirements())
if Requirements.QUANTIFIED_PRECONDITION in requirements:
extended_requirements.update(Requirements.quantified_precondition_requirements())
if Requirements.ADL in requirements:
extended_requirements.update(Requirements.adl_requirements())
return extended_requirements
2 changes: 1 addition & 1 deletion tests/test_parser/test_domain.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ def test_typing_requirement_under_other_domain_requirements() -> None:
"""Check :typing requirement does not throw error if other domain requirements that includes it are detected."""
domain_str = dedent(
"""
(define (domain tictactoe)
(define (domain test)
(:requirements :adl)
(:types a b c)
(:predicates
Expand Down

0 comments on commit e28585f

Please sign in to comment.