Skip to content

Commit

Permalink
example with strings now also works
Browse files Browse the repository at this point in the history
  • Loading branch information
PimLeerkes committed Feb 11, 2025
1 parent 024cfee commit 80277e9
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions tests/test_pgc.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,3 +291,26 @@ def delta(s: pgc.State):
rewardmodel.set_state_reward(state, 2)

assert pgc_model == regular_model


def test_pgc_dtmc_string():
def delta(current_state):
match current_state:
case "hungry":
return [(1.0, "eating")]
case "eating":
return [(1.0, "hungry")]

pgc_model = pgc.build_pgc(
delta, initial_state_pgc="hungry", modeltype=model.ModelType.DTMC
)

regular_model = model.new_dtmc()
regular_model.set_transitions(
regular_model.get_initial_state(), [(1, regular_model.new_state())]
)
regular_model.set_transitions(
regular_model.get_state_by_id(1), [(1, regular_model.get_initial_state())]
)

assert pgc_model == regular_model

0 comments on commit 80277e9

Please sign in to comment.