The source code and dockerfile for the GSW2024 AI Lab.
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.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.

34 lines
1.0 KiB

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