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.

48 lines
1.4 KiB

  1. import stormpy
  2. import stormpy.core
  3. import stormpy.info
  4. import pycarl
  5. import pycarl.core
  6. import stormpy.examples
  7. import stormpy.examples.files
  8. import stormpy._config as config
  9. def example_parametric_models_02():
  10. # Check support for parameters
  11. if not config.storm_with_pars:
  12. print("Support parameters is missing. Try building storm-pars.")
  13. return
  14. import stormpy.pars
  15. from pycarl.formula import FormulaType, Relation
  16. if stormpy.info.storm_ratfunc_use_cln():
  17. import pycarl.cln.formula
  18. else:
  19. import pycarl.gmp.formula
  20. path = stormpy.examples.files.prism_pdtmc_die
  21. prism_program = stormpy.parse_prism_program(path)
  22. formula_str = "P=? [F s=7 & d=2]"
  23. properties = stormpy.parse_properties_for_prism_program(formula_str, prism_program)
  24. model = stormpy.build_parametric_model(prism_program, properties)
  25. initial_state = model.initial_states[0]
  26. result = stormpy.model_checking(model, properties[0])
  27. print("Result: {}".format(result.at(initial_state)))
  28. collector = stormpy.ConstraintCollector(model)
  29. print("Well formed constraints:")
  30. for formula in collector.wellformed_constraints:
  31. print(formula.get_constraint())
  32. print("Graph preserving constraints:")
  33. for formula in collector.graph_preserving_constraints:
  34. print(formula.get_constraint())
  35. if __name__ == '__main__':
  36. example_parametric_models_02()