From b5819cabf37577faa28b23d2f5aae053a5da310c Mon Sep 17 00:00:00 2001 From: Alelafar Date: Fri, 20 Dec 2024 12:48:15 +0100 Subject: [PATCH 1/2] caching action.name instead of action inside ground_action --- unified_planning/engines/compilers/grounder.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/unified_planning/engines/compilers/grounder.py b/unified_planning/engines/compilers/grounder.py index 7c1c925d4..30d734294 100644 --- a/unified_planning/engines/compilers/grounder.py +++ b/unified_planning/engines/compilers/grounder.py @@ -127,7 +127,7 @@ def ground_action( assert len(action.parameters) == len( parameters ), "The number of given parameters for the grounding is different from the action's parameters" - key = (action, tuple(parameters)) + key = (action.name, tuple(parameters)) value = self._grounded_actions.get(key, 0) if value != 0: # The action is already created assert isinstance(value, Action) or value is None From 704e01b319165d56b64a37edee8869bed48498b6 Mon Sep 17 00:00:00 2001 From: Alelafar Date: Fri, 20 Dec 2024 13:01:17 +0100 Subject: [PATCH 2/2] fixed incompatibility mypy --- unified_planning/engines/compilers/grounder.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/unified_planning/engines/compilers/grounder.py b/unified_planning/engines/compilers/grounder.py index 30d734294..be408b32e 100644 --- a/unified_planning/engines/compilers/grounder.py +++ b/unified_planning/engines/compilers/grounder.py @@ -94,7 +94,7 @@ def __init__( # - his conditions create a contradiction # - the action has conflicting effects self._grounded_actions: Dict[ - Tuple[Action, Tuple[FNode, ...]], Optional[Action] + Tuple[str, Tuple[FNode, ...]], Optional[Action] ] = {} env = problem.environment if prune_actions: