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
932 B

  1. import stormpy
  2. import stormpy.core
  3. import stormpy.examples
  4. import stormpy.examples.files
  5. def example_schedulers_01():
  6. path = stormpy.examples.files.prism_mdp_coin_2_2
  7. formula_str = "Pmin=? [F \"finished\" & \"all_coins_equal_1\"]"
  8. program = stormpy.parse_prism_program(path)
  9. formulas = stormpy.parse_properties_for_prism_program(formula_str, program)
  10. model = stormpy.build_model(program, formulas)
  11. initial_state = model.initial_states[0]
  12. assert initial_state == 0
  13. result = stormpy.model_checking(model, formulas[0], extract_scheduler = True)
  14. assert result.has_scheduler
  15. print(result.scheduler)
  16. assert result.scheduler.memoryless
  17. assert result.scheduler.deterministic
  18. for i in range(0,model.nr_states):
  19. print("In state {} choose action {}".format(i,result.scheduler.get_choice(i).get_deterministic_choice()))
  20. if __name__ == '__main__':
  21. example_schedulers_01()