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.

32 lines
1.5 KiB

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. from configurations import pars
  5. @pars
  6. class TestPLA:
  7. def test_pla(self):
  8. program = stormpy.parse_prism_program(get_example_path("pdtmc", "brp16_2.pm"))
  9. prop = "P<=0.84 [F s=5 ]"
  10. formulas = stormpy.parse_properties_for_prism_program(prop, 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.has_parameters
  16. env = stormpy.Environment()
  17. checker = stormpy.pars.create_region_checker(env, model, formulas[0].raw_formula)
  18. parameters = model.collect_probability_parameters()
  19. assert len(parameters) == 2
  20. region = stormpy.pars.ParameterRegion("0.7<=pL<=0.9,0.75<=pK<=0.95", parameters)
  21. result = checker.check_region(env, region)
  22. assert result == stormpy.pars.RegionResult.ALLSAT
  23. region = stormpy.pars.ParameterRegion("0.4<=pL<=0.65,0.75<=pK<=0.95", parameters)
  24. result = checker.check_region(env, region, stormpy.pars.RegionResultHypothesis.UNKNOWN,
  25. stormpy.pars.RegionResult.UNKNOWN, True)
  26. assert result == stormpy.pars.RegionResult.EXISTSBOTH
  27. region = stormpy.pars.ParameterRegion("0.1<=pL<=0.73,0.2<=pK<=0.715", parameters)
  28. result = checker.check_region(env, region)
  29. assert result == stormpy.pars.RegionResult.ALLVIOLATED