You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

44 lines
1.9 KiB

8 years ago
8 years ago
8 years ago
8 years ago
  1. import stormpy
  2. import stormpy.logic
  3. from helpers.helper import get_example_path
  4. class TestBisimulation:
  5. def test_bisimulation(self):
  6. program = stormpy.parse_prism_program(get_example_path("dtmc", "crowds5_5.pm"))
  7. assert program.nr_modules == 1
  8. assert program.model_type == stormpy.PrismModelType.DTMC
  9. prop = "P=? [F \"observe0Greater1\"]"
  10. properties = stormpy.parse_properties_for_prism_program(prop, program)
  11. model = stormpy.build_model(program, properties)
  12. assert model.nr_states == 7403
  13. assert model.nr_transitions == 13041
  14. assert model.model_type == stormpy.ModelType.DTMC
  15. assert not model.supports_parameters
  16. model_bisim = stormpy.perform_bisimulation(model, properties[0], stormpy.BisimulationType.STRONG)
  17. assert model_bisim.nr_states == 64
  18. assert model_bisim.nr_transitions == 104
  19. assert model_bisim.model_type == stormpy.ModelType.DTMC
  20. assert not model_bisim.supports_parameters
  21. def test_parametric_bisimulation(self):
  22. program = stormpy.parse_prism_program(get_example_path("pdtmc", "crowds3_5.pm"))
  23. assert program.nr_modules == 1
  24. assert program.model_type == stormpy.PrismModelType.DTMC
  25. assert program.has_undefined_constants
  26. prop = "P=? [F \"observe0Greater1\"]"
  27. properties = stormpy.parse_properties_for_prism_program(prop, program)
  28. model = stormpy.build_parametric_model(program, properties)
  29. assert model.nr_states == 1367
  30. assert model.nr_transitions == 2027
  31. assert model.model_type == stormpy.ModelType.DTMC
  32. assert model.has_parameters
  33. model_bisim = stormpy.perform_bisimulation(model, properties[0], stormpy.BisimulationType.STRONG)
  34. assert model_bisim.nr_states == 80
  35. assert model_bisim.nr_transitions == 120
  36. assert model_bisim.model_type == stormpy.ModelType.DTMC
  37. assert model_bisim.has_parameters