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.

27 lines
747 B

  1. import stormpy
  2. import stormpy.core
  3. import stormpy.simulator
  4. import stormpy.examples
  5. import stormpy.examples.files
  6. def example_simulator_01():
  7. path = stormpy.examples.files.prism_dtmc_die
  8. prism_program = stormpy.parse_prism_program(path)
  9. model = stormpy.build_model(prism_program)
  10. simulator = stormpy.simulator.create_simulator(model, seed=42)
  11. final_outcomes = dict()
  12. for n in range(1000):
  13. for i in range(100):
  14. observation = simulator.step()
  15. if observation not in final_outcomes:
  16. final_outcomes[observation] = 1
  17. else:
  18. final_outcomes[observation] += 1
  19. simulator.restart()
  20. print(final_outcomes)
  21. if __name__ == '__main__':
  22. example_simulator_01()