diff --git a/unified_planning/engines/compilers/interpreted_functions_remover.py b/unified_planning/engines/compilers/interpreted_functions_remover.py index 328aef305..a18767db0 100644 --- a/unified_planning/engines/compilers/interpreted_functions_remover.py +++ b/unified_planning/engines/compilers/interpreted_functions_remover.py @@ -207,7 +207,6 @@ def _compile( new_fluents: dict = {} if_known: dict = {} for ifun_exp, val in self._interpreted_functions_values.items(): - # this does not add the functions we have not found with the validator yet ifun = ifun_exp.interpreted_function() if ifun not in if_known: if_known[ifun] = [] @@ -280,10 +279,6 @@ def _compile( else: - # if effect assigns value to an unknown fluent, put tracker back to known state - # TODO - fix cascade effect that might lead to incorrect results - # cascade effect is preset not only here - effs.append((time, ef)) if ef.fluent.fluent() in assignment_tracking_fluents.keys(): # if the fluent is one of the changing ones diff --git a/unified_planning/engines/interpreted_functions_planner.py b/unified_planning/engines/interpreted_functions_planner.py index 5ac82b615..3be1cc19b 100644 --- a/unified_planning/engines/interpreted_functions_planner.py +++ b/unified_planning/engines/interpreted_functions_planner.py @@ -215,9 +215,9 @@ def _attempt_to_solve( def _refine(self, problem, validation_result): newProb = None if validation_result.calculated_interpreted_functions is None: - print("no updates available, the problem has no solution") + pass elif len(validation_result.calculated_interpreted_functions) == 0: - print("no updates available, the problem has no solution") + pass else: for k in validation_result.calculated_interpreted_functions: self.add_knowledge(k, validation_result.calculated_interpreted_functions[k]) diff --git a/unified_planning/test/test_interpreted_functions_planner.py b/unified_planning/test/test_interpreted_functions_planner.py index 40cf6039c..1174a7a8c 100644 --- a/unified_planning/test/test_interpreted_functions_planner.py +++ b/unified_planning/test/test_interpreted_functions_planner.py @@ -50,10 +50,8 @@ def test_interpreted_functions_in_preconditions_planner_always_impossible(self): with OneshotPlanner( name="interpreted_functions_planning[opt-pddl-planner]" ) as planner: - planner._skip_checks = True # enhsp does not like bounded fluents but it does not make any difference here + planner.skip_checks = True # enhsp does not like bounded fluents but it does not make any difference here result = planner.solve(problem) - print(result) - print(result.plan) self.assertFalse(result.status in up.engines.results.POSITIVE_OUTCOMES) @@ -65,11 +63,9 @@ def test_interpreted_functions_planner_int_assignment(self): with OneshotPlanner( name="interpreted_functions_planning[opt-pddl-planner]" ) as planner: - planner._skip_checks = True # ----------------------------- + planner.skip_checks = True # enhsp does not like bounded fluents but it does not make any difference here result = planner.solve(problem) - print(result) - print(result.plan) self.assertTrue(result.status in up.engines.results.POSITIVE_OUTCOMES) @@ -80,12 +76,8 @@ def test_interpreted_functions_in_preconditions(self): with OneshotPlanner( name="interpreted_functions_planning[opt-pddl-planner]" ) as planner: - planner._skip_checks = True + planner.skip_checks = True # enhsp does not like bounded fluents but it does not make any difference here result = planner.solve(problem) - print(result) - print(result.plan) - print("increase val -> action if in condition ") - print("is a valid solution") self.assertEqual(len(result.plan.actions), 2) self.assertEqual(result.plan.actions[0].action, problem.actions[0]) self.assertEqual(result.plan.actions[1].action, problem.actions[1]) @@ -101,11 +93,8 @@ def test_interpreted_functions_in_preconditions_planner_complex(self): with OneshotPlanner( name="interpreted_functions_planning[opt-pddl-planner]" ) as planner: - planner._skip_checks = True # ----------------------------- + planner.skip_checks = True # enhsp does not like bounded fluents but it does not make any difference here result = planner.solve(problem) - print(result) - print("known valid plan:") - print(testproblem.valid_plans[0]) self.assertTrue(result.status in up.engines.results.POSITIVE_OUTCOMES) self.assertEqual( len(result.plan.actions), len(testproblem.valid_plans[0].actions) @@ -126,11 +115,8 @@ def test_interpreted_functions_reals(self): with OneshotPlanner( name="interpreted_functions_planning[opt-pddl-planner]" ) as planner: - planner._skip_checks = True # ----------------------------- + planner.skip_checks = True # enhsp does not like bounded fluents but it does not make any difference here result = planner.solve(problem) - print(result) - print("known valid plan:") - print(testproblem.valid_plans[0]) self.assertTrue(result.status in up.engines.results.POSITIVE_OUTCOMES) self.assertEqual( len(result.plan.actions), len(testproblem.valid_plans[0].actions) @@ -142,22 +128,15 @@ def test_interpreted_functions_in_durations_planner(self): problem = testproblem.problem with OneshotPlanner(name="interpreted_functions_planning[tamer]") as planner: - # print("now attempting to solve") - planner.skipChecks = True result = planner.solve(problem) - print(result) self.assertTrue(result.status in up.engines.results.POSITIVE_OUTCOMES) self.assertEqual(len(result.plan._actions), 2) - print(result.plan) - print(testproblem.valid_plans[0]) i = 0 while i < len(testproblem.valid_plans[0].timed_actions): j = 0 while j < 3: # the result tuple has 3 values: start time, action, duration - print(result.plan.timed_actions[i][j]) - print(testproblem.valid_plans[0].timed_actions[i][j]) if j != 1: self.assertEqual( result.plan.timed_actions[i][j], diff --git a/unified_planning/test/test_interpreted_functions_remover.py b/unified_planning/test/test_interpreted_functions_remover.py index 62554ddbe..75e2df248 100644 --- a/unified_planning/test/test_interpreted_functions_remover.py +++ b/unified_planning/test/test_interpreted_functions_remover.py @@ -72,10 +72,6 @@ def test_interpreted_functions_in_preconditions_remover_simple(self): problem, CompilationKind.INTERPRETED_FUNCTIONS_REMOVING ) compiled_problem = ifr.problem - # print(problem) - # print(problem.kind) - # print(compiled_problem) - # print(compiled_problem.kind) self.assertTrue(problem.kind.has_interpreted_functions_in_conditions()) self.assertFalse(problem.kind.has_simple_numeric_planning()) @@ -99,10 +95,6 @@ def test_interpreted_functions_in_preconditions_remover_always_impossible(self): problem, CompilationKind.INTERPRETED_FUNCTIONS_REMOVING ) compiled_problem = ifr.problem - # print(problem) - # print(problem.kind) - # print(compiled_problem) - # print(compiled_problem.kind) self.assertTrue(problem.kind.has_interpreted_functions_in_conditions()) self.assertFalse(problem.kind.has_simple_numeric_planning()) self.assertFalse( @@ -120,10 +112,6 @@ def test_interpreted_functions_in_durative_conditions_remover(self): problem, CompilationKind.INTERPRETED_FUNCTIONS_REMOVING ) compiled_problem = ifr.problem - # print(problem) - # print(problem.kind) - # print(compiled_problem) - # print(compiled_problem.kind) self.assertTrue(problem.kind.has_interpreted_functions_in_conditions()) self.assertFalse( compiled_problem.kind.has_interpreted_functions_in_conditions() diff --git a/unified_planning/test/test_problem.py b/unified_planning/test/test_problem.py index 709922084..89f10e122 100644 --- a/unified_planning/test/test_problem.py +++ b/unified_planning/test/test_problem.py @@ -626,8 +626,6 @@ def test_interpreted_functions_simple(self): def test_interpreted_functions_complex(self): problem = self.problems["go_home_with_rain_and_interpreted_functions"].problem - print(problem) - print(problem.kind) self.assertTrue(problem.kind.has_interpreted_functions_in_durations()) self.assertTrue(problem.kind.has_interpreted_functions_in_boolean_assignments()) problem = self.problems["IF_in_conditions_complex_1"].problem