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.

23 lines
1021 B

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