From c5b4b3fa21761b6d970a9379ce8586572e9d52b9 Mon Sep 17 00:00:00 2001 From: Alessandro Valentini Date: Mon, 24 Apr 2023 17:46:35 +0200 Subject: [PATCH] Fixed bug in SimulatedEnvironment --- unified_planning/model/contingent/environment.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/unified_planning/model/contingent/environment.py b/unified_planning/model/contingent/environment.py index 93ce252fe..0acf22032 100644 --- a/unified_planning/model/contingent/environment.py +++ b/unified_planning/model/contingent/environment.py @@ -123,9 +123,13 @@ def apply( raise UPUsageError("The given action is not applicable!") self._state = new_state res = {} + subs: Dict[Expression, Expression] = dict( + zip(action.action.parameters, action.actual_parameters) + ) if isinstance(action.action, up.model.contingent.sensing_action.SensingAction): for f in action.action.observed_fluents: - res[f] = self._state.get_value(f) + f_exp = f.substitute(subs) + res[f_exp] = self._state.get_value(f_exp) return res def is_goal_reached(self) -> bool: