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.

30 lines
1.0 KiB

  1. import stormpy
  2. import stormpy.core
  3. import stormpy.examples
  4. import stormpy.examples.files
  5. def example_building_models_01():
  6. path = stormpy.examples.files.prism_pdtmc_brp
  7. prism_program = stormpy.parse_prism_program(path)
  8. formula_str = "P=? [F s=5]"
  9. properties = stormpy.parse_properties_for_prism_program(formula_str, prism_program)
  10. options = stormpy.BuilderOptions([p.raw_formula for p in properties])
  11. options.set_build_state_valuations()
  12. model = stormpy.build_sparse_parametric_model_with_options(prism_program, options)
  13. eval2 = model.state_valuations.get_state(2)
  14. integer_variables = []
  15. boolean_variables = []
  16. for module in prism_program.modules:
  17. print("module {}".format(module.name))
  18. integer_variables += module.integer_variables
  19. boolean_variables += module.boolean_variables
  20. print(",".join(["{}: {}".format(str(iv.name), eval2.get_integer_value(iv.expression_variable)) for iv in integer_variables]))
  21. if __name__ == '__main__':
  22. example_building_models_01()