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.

39 lines
1.1 KiB

  1. import stormpy
  2. import stormpy.core
  3. import stormpy.simulator
  4. import stormpy.shields
  5. import stormpy.examples
  6. import stormpy.examples.files
  7. from stormpy.dtcontrol import export_decision_tree
  8. def export_shield_as_dot():
  9. path = stormpy.examples.files.prism_mdp_lava_simple
  10. formula_str = "<pre, PreSafety, lambda=0.9> Pmax=? [G !\"AgentIsInLavaAndNotDone\"]"
  11. program = stormpy.parse_prism_program(path)
  12. formulas = stormpy.parse_properties_for_prism_program(formula_str, program)
  13. options = stormpy.BuilderOptions([p.raw_formula for p in formulas])
  14. options.set_build_state_valuations(True)
  15. options.set_build_choice_labels(True)
  16. options.set_build_all_labels()
  17. options.set_build_with_choice_origins(True)
  18. model = stormpy.build_sparse_model_with_options(program, options)
  19. result = stormpy.model_checking(model, formulas[0], extract_scheduler=True) #, shielding_expression=shield_specification)
  20. assert result.has_shield
  21. shield = result.shield
  22. stormpy.shields.export_shieldDouble(model, shield, "preshield.storm.json")
  23. export_decision_tree(result.shield)
  24. if __name__ == '__main__':
  25. export_shield_as_dot()