From c15e331b0d72b8af7f560c934776e31ae873b9c2 Mon Sep 17 00:00:00 2001 From: Samuel Gobbi Date: Fri, 18 Oct 2024 12:06:00 +0200 Subject: [PATCH] fix(interpreted functions): variables declared and overwritten in wrong places --- .../engines/compilers/interpreted_functions_remover.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/unified_planning/engines/compilers/interpreted_functions_remover.py b/unified_planning/engines/compilers/interpreted_functions_remover.py index afc9fe7ef..57bb760c7 100644 --- a/unified_planning/engines/compilers/interpreted_functions_remover.py +++ b/unified_planning/engines/compilers/interpreted_functions_remover.py @@ -254,6 +254,10 @@ def _compile( # for each possible combination (known function combinations) new_action = a.clone() new_action.name = get_fresh_name(new_problem, a.name) + + new_condition = None + new_precondition_list = list() + for kf in kfc: substituter_instantaneous_action: up.model.walkers.Substituter = up.model.walkers.Substituter( @@ -288,8 +292,6 @@ def _compile( new_action.add_precondition(new_precondition) argumentcounter = 0 - new_condition = None - new_precondition_list = list() while argumentcounter < len(kf.args): for aif in all_ifs_in_instantaneous_action: if ( @@ -796,8 +798,8 @@ def _compile( else: raise NotImplementedError - # print("compilation complete!") - # print(new_problem) + print("compilation complete!") + print(new_problem) return CompilerResult( new_problem, partial(replace_action, map=new_to_old), self.name )