diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index bffa87e01..d6635599f 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -11,10 +11,10 @@ on: required: true env: - up_tamer_commit: "631dfd43a56e7c2dda44fe273ec6f5492e99cfe1" + up_tamer_commit: "fba59b93ed7a85370f4bbf0dc5310bbeffce05b7" up_pyperplan_commit: "a24854213caf5038e1540e31613d24b93825fbb3" up_fast_downward_commit: "c60b6ab82cb8c3046cfd4782afe4d4c6071c4109" - up_enhsp_commit: "78cc3331beb1fcc36380a8f698f49b4312dc411a" + up_enhsp_commit: "f689d3b65bed921bed35c61b468ca771ae6f54a2" up_fmap_commit: "f29e66c8483abcb8f17ff1c46a0745ee9b1e95fa" jobs: diff --git a/unified_planning/engines/plan_validator.py b/unified_planning/engines/plan_validator.py index fb35c6595..b24f78e72 100644 --- a/unified_planning/engines/plan_validator.py +++ b/unified_planning/engines/plan_validator.py @@ -311,6 +311,7 @@ def _apply_effect( updates: Dict[FNode, FNode], problem: Problem, ) -> Dict[FNode, FNode]: + em = problem.environment.expression_manager result = {} for instantiated_effect in effect.expand_effect(problem): if self._check_condition( @@ -326,9 +327,13 @@ def _apply_effect( if instantiated_effect.kind == EffectKind.ASSIGN: result[g_fluent] = se.evaluate(g_value, state=state) elif instantiated_effect.kind == EffectKind.DECREASE: - result[g_fluent] = f_value - se.evaluate(g_value, state=state) + result[g_fluent] = se.evaluate( + em.Minus(f_value, g_value), state=state + ) elif instantiated_effect.kind == EffectKind.INCREASE: - result[g_fluent] = f_value - se.evaluate(g_value, state=state) + result[g_fluent] = se.evaluate( + em.Plus(f_value, g_value), state=state + ) return result def _states_in_interval( diff --git a/unified_planning/test/examples/minimals.py b/unified_planning/test/examples/minimals.py index 08d3cd194..2b224e620 100644 --- a/unified_planning/test/examples/minimals.py +++ b/unified_planning/test/examples/minimals.py @@ -427,6 +427,31 @@ def get_example_problems(): counter_to_50 = TestCase(problem=problem, solvable=True, valid_plans=[plan]) problems["counter_to_50"] = counter_to_50 + # temporal counter + counter_f = Fluent("counter", IntType(0, 100)) + d_increase = DurativeAction("increase") + d_increase.set_fixed_duration(1) + d_increase.add_condition(StartTiming(), LT(counter_f, 99)) + d_increase.add_increase_effect(EndTiming(), counter_f, 2) + d_decrease = DurativeAction("decrease") + d_decrease.set_fixed_duration(1) + d_decrease.add_condition(StartTiming(), GT(counter_f, 0)) + d_decrease.add_decrease_effect(EndTiming(), counter_f, 1) + problem = Problem("temporal_counter") + problem.add_fluent(counter_f) + problem.add_action(d_increase) + problem.add_action(d_decrease) + problem.set_initial_value(counter_f, 0) + problem.add_goal(Equals(counter_f, 1)) + ttplan = up.plans.TimeTriggeredPlan( + [ + (Fraction(0, 1), up.plans.ActionInstance(d_increase), Fraction(1, 1)), + (Fraction(2, 1), up.plans.ActionInstance(d_decrease), Fraction(1, 1)), + ] + ) + t_counter = TestCase(problem=problem, solvable=True, valid_plans=[ttplan]) + problems["temporal_counter"] = t_counter + # basic with object constant Location = UserType("Location") is_at = Fluent("is_at", BoolType(), loc=Location) diff --git a/unified_planning/test/test_problem.py b/unified_planning/test/test_problem.py index 75b02a6c1..687ae4bd8 100644 --- a/unified_planning/test/test_problem.py +++ b/unified_planning/test/test_problem.py @@ -520,6 +520,7 @@ def test_simple_numeric_planning_kind(self): self.assertFalse(problem.kind.has_simple_numeric_planning()) names_of_SNP_problems = [ + "temporal_counter", "counter_to_50", "robot_decrease", "robot_locations_connected",