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.

24 lines
1.0 KiB

8 years ago
8 years ago
8 years ago
8 years ago
  1. import pycarl
  2. import stormpy
  3. import stormpy.logic
  4. import stormpy.pars
  5. from helpers.helper import get_example_path
  6. class TestModel:
  7. def test_instantiate_dtmc(self):
  8. program = stormpy.parse_prism_program(get_example_path("pdtmc", "brp16_2.pm"))
  9. formulas = stormpy.parse_properties_for_prism_program("P=? [ F s=5 ]", program)
  10. model = stormpy.build_parametric_model(program, formulas)
  11. parameters = model.collect_probability_parameters()
  12. instantiator = stormpy.pars.PDtmcInstantiator(model)
  13. point = {p: stormpy.RationalRF("0.4") for p in parameters}
  14. instantiated_model = instantiator.instantiate(point)
  15. assert instantiated_model.nr_states == model.nr_states
  16. assert not instantiated_model.has_parameters
  17. assert "0.4" in str(instantiated_model.transition_matrix[1])
  18. point = {p: stormpy.RationalRF("0.5") for p in parameters}
  19. instantiated_model2 = instantiator.instantiate(point)
  20. assert "0.5" in str(instantiated_model2.transition_matrix[1])