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.

29 lines
1.4 KiB

8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
  1. import stormpy
  2. import stormpy.logic
  3. import stormpy.pars
  4. from helpers.helper import get_example_path
  5. class TestPLA:
  6. def test_pla(self):
  7. program = stormpy.parse_prism_program(get_example_path("pdtmc", "brp16_2.pm"))
  8. prop = "P<=0.84 [F s=5 ]"
  9. formulas = stormpy.parse_properties_for_prism_program(prop, program)
  10. model = stormpy.build_parametric_model(program, formulas)
  11. assert model.nr_states == 613
  12. assert model.nr_transitions == 803
  13. assert model.model_type == stormpy.ModelType.DTMC
  14. assert model.has_parameters
  15. checker = stormpy.pars.create_region_checker(model, formulas[0].raw_formula)
  16. parameters = model.collect_probability_parameters()
  17. assert len(parameters) == 2
  18. region = stormpy.pars.ParameterRegion("0.7<=pL<=0.9,0.75<=pK<=0.95", parameters)
  19. result = checker.check_region(region)
  20. assert result == stormpy.pars.RegionResult.ALLSAT
  21. region = stormpy.pars.ParameterRegion("0.4<=pL<=0.65,0.75<=pK<=0.95", parameters)
  22. result = checker.check_region(region, stormpy.pars.RegionResultHypothesis.UNKNOWN,
  23. stormpy.pars.RegionResult.UNKNOWN, True)
  24. assert result == stormpy.pars.RegionResult.EXISTSBOTH
  25. region = stormpy.pars.ParameterRegion("0.1<=pL<=0.73,0.2<=pK<=0.715", parameters)
  26. result = checker.check_region(region)
  27. assert result == stormpy.pars.RegionResult.ALLVIOLATED