From 0a6fe4420117e6b46f9e50162e846e5a34bb301c Mon Sep 17 00:00:00 2001 From: Alessandro Valentini Date: Mon, 24 Apr 2023 17:49:40 +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..bc0454910 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["up.model.Expression", "up.model.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: