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.

40 lines
2.0 KiB

  1. import stormpy
  2. import stormpy.logic
  3. class TestBisimulation:
  4. def test_bisimulation(self):
  5. program = stormpy.parse_program("../examples/dtmc/crowds/crowds5_5.pm")
  6. assert program.nr_modules() == 1
  7. assert program.model_type() == stormpy.PrismModelType.DTMC
  8. prop = "P=? [F \"observe0Greater1\"]"
  9. formulas = stormpy.parse_formulas_for_program(prop, program)
  10. pair = stormpy.build_model_from_prism_program(program, formulas)
  11. model = pair.model
  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, formulas[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_program("../examples/pdtmc/crowds/crowds_3-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. formulas = stormpy.parse_formulas_for_program(prop, program)
  28. pair = stormpy.build_parametric_model_from_prism_program(program, formulas)
  29. model = pair.model
  30. assert model.nr_states() == 1367
  31. assert model.nr_transitions() == 2027
  32. assert model.model_type() == stormpy.ModelType.DTMC
  33. assert model.has_parameters()
  34. model_bisim = stormpy.perform_bisimulation(model, formulas[0], stormpy.BisimulationType.STRONG)
  35. assert model_bisim.nr_states() == 80
  36. assert model_bisim.nr_transitions() == 120
  37. assert model_bisim.model_type() == stormpy.ModelType.DTMC
  38. assert model_bisim.has_parameters()