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.

36 lines
1.2 KiB

  1. import stormpy
  2. import stormpy.core
  3. import stormpy.examples
  4. import stormpy.examples.files
  5. import stormpy.pomdp
  6. def example_building_models_01():
  7. path = stormpy.examples.files.drn_ctmc_dft
  8. model = stormpy.build_model_from_drn(path)
  9. print(model.model_type)
  10. print("Number of states: {}".format(model.nr_states))
  11. # And the parametric
  12. path = stormpy.examples.files.drn_pdtmc_die
  13. model = stormpy.build_parametric_model_from_drn(path)
  14. print(model.model_type)
  15. print("Number of states: {}".format(model.nr_states))
  16. path = stormpy.examples.files.jani_dtmc_die
  17. jani_program, properties = stormpy.parse_jani_model(path)
  18. model = stormpy.build_model(jani_program)
  19. print(model.model_type)
  20. print("Number of states: {}".format(model.nr_states))
  21. # POMDPs should be constructed with choice labels
  22. path = stormpy.examples.files.drn_pomdp_maze
  23. opts = stormpy.DirectEncodingParserOptions()
  24. opts.build_choice_labels = True
  25. pomdp = stormpy.build_model_from_drn(stormpy.examples.files.drn_pomdp_maze, opts)
  26. # POMDPs need to be in a canonic representation
  27. pomdp = stormpy.pomdp.make_canonic(pomdp)
  28. if __name__ == '__main__':
  29. example_building_models_01()