Skip to content

Commit

Permalink
fix(interpreted functions): excluding bad kaleido version
Browse files Browse the repository at this point in the history
  • Loading branch information
Samuel Gobbi committed Nov 18, 2024
1 parent 7cfd221 commit b3e1299
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 10 deletions.
2 changes: 1 addition & 1 deletion plot-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
-r requirements.txt
plotly
matplotlib==3.7.3
kaleido
kaleido<=0.2.1,>0.4.1
pandas
pygraphviz
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ def supported_kind() -> ProblemKind:
supported_kind.set_effects_kind("FORALL_EFFECTS")
supported_kind.set_effects_kind("INTERPRETED_FUNCTIONS_IN_BOOLEAN_ASSIGNMENTS")
supported_kind.set_effects_kind("INTERPRETED_FUNCTIONS_IN_NUMERIC_ASSIGNMENTS")
supported_kind.set_effects_kind("INTERPRETED_FUNCTIONS_IN_OBJECT_ASSIGNMENTS")
supported_kind.set_time("CONTINUOUS_TIME")
supported_kind.set_time("DISCRETE_TIME")
supported_kind.set_time("INTERMEDIATE_CONDITIONS_AND_EFFECTS")
Expand Down Expand Up @@ -178,6 +179,8 @@ def resulting_problem_kind(
new_kind.unset_effects_kind("INTERPRETED_FUNCTIONS_IN_BOOLEAN_ASSIGNMENTS")
if new_kind.has_interpreted_functions_in_numeric_assignments():
new_kind.unset_effects_kind("INTERPRETED_FUNCTIONS_IN_NUMERIC_ASSIGNMENTS")
if new_kind.has_interpreted_functions_in_object_assignments():
new_kind.unset_effects_kind("INTERPRETED_FUNCTIONS_IN_OBJECT_ASSIGNMENTS")

return new_kind

Expand Down Expand Up @@ -236,8 +239,8 @@ def _compile(

has_changed_fluents: Dict = {}
for a in problem.actions:
# these fluents are created and added to the problem at the start
# as might need some of them before we encounter them during the compilation
# these fluents are created and added to the problem at the start as we
# might need some of them before we encounter them during the compilation
found_effects = self._get_effects(a)
for time, ef in found_effects:
f = ef.fluent.fluent()
Expand Down Expand Up @@ -287,12 +290,6 @@ def _expand_action(
conds = []
effs = []
ifs = []
# ifs will contain a tuple with the information needed to remove the interpreted functions
# the time (None if instantaneous)
# the expression that contains some IFs
# the list of IFs contained in the expression
# the ElementKind
# the effect that is being handled (None if we are not on an effect)
for t, exp in self._get_conditions(a):
all_fluent_exps = self.free_vars_extractor.get(exp)
all_f = [f_exp.fluent() for f_exp in all_fluent_exps]
Expand Down
4 changes: 3 additions & 1 deletion unified_planning/engines/interpreted_functions_planner.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ def _supported_kind(engine: Type[Engine]) -> "ProblemKind":
supported_kind.set_conditions_kind("EQUALITIES")
supported_kind.set_conditions_kind("EXISTENTIAL_CONDITIONS")
supported_kind.set_conditions_kind("UNIVERSAL_CONDITIONS")

supported_kind.set_effects_kind("CONDITIONAL_EFFECTS")
supported_kind.set_effects_kind("INCREASE_EFFECTS")
supported_kind.set_effects_kind("DECREASE_EFFECTS")
Expand Down Expand Up @@ -134,6 +133,9 @@ def _supported_kind(engine: Type[Engine]) -> "ProblemKind":
additive_supported_kind.set_effects_kind(
"INTERPRETED_FUNCTIONS_IN_BOOLEAN_ASSIGNMENTS"
)
additive_supported_kind.set_effects_kind(
"INTERPRETED_FUNCTIONS_IN_OBJECT_ASSIGNMENTS"
)
return final_supported_kind.union(additive_supported_kind)

@staticmethod
Expand Down

0 comments on commit b3e1299

Please sign in to comment.