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.7 KiB

  1. from . import core
  2. from .core import *
  3. from . import storage
  4. from .storage import *
  5. from .version import __version__
  6. core._set_up("")
  7. def build_model(program, properties = None):
  8. if properties:
  9. formulae = [prop.raw_formula for prop in properties]
  10. else:
  11. formulae = []
  12. intermediate = core._build_sparse_model_from_prism_program(program, formulae)
  13. assert not intermediate.supports_parameters
  14. if intermediate.model_type == ModelType.DTMC:
  15. return intermediate._as_dtmc()
  16. elif intermediate.model_type == ModelType.MDP:
  17. return intermediate._as_mdp()
  18. else:
  19. raise RuntimeError("Not supported non-parametric model constructed")
  20. def build_parametric_model(program, properties = None):
  21. if properties:
  22. formulae = [prop.raw_formula for prop in properties]
  23. else:
  24. formulae = []
  25. intermediate = core._build_sparse_parametric_model_from_prism_program(program, formulae)
  26. assert intermediate.supports_parameters
  27. if intermediate.model_type == ModelType.DTMC:
  28. return intermediate._as_pdtmc()
  29. elif intermediate.model_type == ModelType.MDP:
  30. return intermediate._as_pmdp()
  31. else:
  32. raise RuntimeError("Not supported parametric model constructed")
  33. def perform_bisimulation(model, property, bisimulation_type):
  34. if model.supports_parameters:
  35. return core._perform_parametric_bisimulation(model, property.raw_formula, bisimulation_type)
  36. else:
  37. return core._perform_bisimulation(model, property.raw_formula, bisimulation_type)
  38. def model_checking(model, property):
  39. if model.supports_parameters:
  40. return core._parametric_model_checking(model, property.raw_formula)
  41. else:
  42. return core._model_checking(model, property.raw_formula)