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.

76 lines
3.5 KiB

  1. import stormpy
  2. import stormpy.info
  3. import stormpy.logic
  4. from helpers.helper import get_example_path
  5. from configurations import pars
  6. @pars
  7. class TestSparseParametricModel:
  8. def test_build_parametric_dtmc(self):
  9. program = stormpy.parse_prism_program(get_example_path("pdtmc", "brp16_2.pm"))
  10. formulas = stormpy.parse_properties_for_prism_program("P=? [ F s=5 ]", program)
  11. model = stormpy.build_parametric_model(program, formulas)
  12. assert model.nr_states == 613
  13. assert model.nr_transitions == 803
  14. assert model.model_type == stormpy.ModelType.DTMC
  15. assert model.supports_parameters
  16. assert model.has_parameters
  17. assert type(model) is stormpy.SparseParametricDtmc
  18. def test_build_dtmc_supporting_parameters(self):
  19. program = stormpy.parse_prism_program(get_example_path("dtmc", "die.pm"))
  20. formulas = stormpy.parse_properties_for_prism_program("P=? [ F \"one\" ]", program)
  21. model = stormpy.build_parametric_model(program, formulas)
  22. assert model.nr_states == 13
  23. assert model.nr_transitions == 20
  24. assert model.model_type == stormpy.ModelType.DTMC
  25. assert model.supports_parameters
  26. assert not model.has_parameters
  27. assert type(model) is stormpy.SparseParametricDtmc
  28. def test_build_parametric_mdp(self):
  29. program = stormpy.parse_prism_program(get_example_path("pmdp", "two_dice.nm"))
  30. formulas = stormpy.parse_properties_for_prism_program("P=? [ F \"two\" ]", program)
  31. model = stormpy.build_parametric_model(program, formulas)
  32. assert model.nr_states == 169
  33. assert model.nr_transitions == 435
  34. assert model.model_type == stormpy.ModelType.MDP
  35. assert model.supports_parameters
  36. assert type(model) is stormpy.SparseParametricMdp
  37. @pars
  38. class TestSymbolicParametricModel:
  39. def test_build_parametric_dtmc(self):
  40. program = stormpy.parse_prism_program(get_example_path("pdtmc", "brp16_2.pm"))
  41. formulas = stormpy.parse_properties_for_prism_program("P=? [ F s=5 ]", program)
  42. model = stormpy.build_symbolic_parametric_model(program, formulas)
  43. assert model.nr_states == 613
  44. assert model.nr_transitions == 803
  45. assert model.model_type == stormpy.ModelType.DTMC
  46. assert model.supports_parameters
  47. assert model.has_parameters
  48. assert type(model) is stormpy.SymbolicSylvanParametricDtmc
  49. def test_build_dtmc_supporting_parameters(self):
  50. program = stormpy.parse_prism_program(get_example_path("dtmc", "die.pm"))
  51. formulas = stormpy.parse_properties_for_prism_program("P=? [ F \"one\" ]", program)
  52. model = stormpy.build_symbolic_parametric_model(program, formulas)
  53. assert model.nr_states == 13
  54. assert model.nr_transitions == 20
  55. assert model.model_type == stormpy.ModelType.DTMC
  56. assert model.supports_parameters
  57. assert not model.has_parameters
  58. assert type(model) is stormpy.SymbolicSylvanParametricDtmc
  59. def test_build_parametric_mdp(self):
  60. program = stormpy.parse_prism_program(get_example_path("pmdp", "two_dice.nm"))
  61. formulas = stormpy.parse_properties_for_prism_program("P=? [ F \"two\" ]", program)
  62. model = stormpy.build_symbolic_parametric_model(program, formulas)
  63. assert model.nr_states == 169
  64. assert model.nr_transitions == 435
  65. assert model.model_type == stormpy.ModelType.MDP
  66. assert model.supports_parameters
  67. assert type(model) is stormpy.SymbolicSylvanParametricMdp