Skip to content

Commit

Permalink
action dicts now get compared
Browse files Browse the repository at this point in the history
  • Loading branch information
PimLeerkes committed Nov 14, 2024
1 parent 10ee288 commit 5149b9c
Showing 1 changed file with 7 additions and 11 deletions.
18 changes: 7 additions & 11 deletions stormvogel/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -897,24 +897,20 @@ def __str__(self) -> str:

def __eq__(self, other) -> bool:
if isinstance(other, Model):
# TODO compare action dicts
# if self.supports_actions():
# actions_equal = sorted(self.actions.values()) == sorted(
# other.actions.values()
# )
# else:
# actions_equal = True

# if not actions_equal:
# print(self.actions,'\n', other.actions)
if self.supports_actions():
assert self.actions is not None and other.actions is not None
for action, other_action in zip(
sorted(self.actions.values()), sorted(other.actions.values())
):
if not action == other_action:
return False
return (
self.type == other.type
and self.states == other.states
and self.transitions == other.transitions
and sorted(self.rewards) == sorted(other.rewards)
and self.exit_rates == other.exit_rates
and self.markovian_states == other.markovian_states
# and actions_equal
)
return False

Expand Down

0 comments on commit 5149b9c

Please sign in to comment.