Browse Source

Fixed rounding problem in doctest

refactoring
Matthias Volk 4 years ago
parent
commit
2cfa252278
No known key found for this signature in database GPG Key ID: 83A57678F739FCD3
  1. 4
      doc/source/doc/reward_models.rst
  2. 4
      examples/reward_models/01-reward-models.py

4
doc/source/doc/reward_models.rst

@ -28,8 +28,8 @@ We can do model checking analogous to probabilities::
>>> initial_state = model.initial_states[0] >>> initial_state = model.initial_states[0]
>>> result = stormpy.model_checking(model, properties[0]) >>> result = stormpy.model_checking(model, properties[0])
>>> print("Result: {}".format(result.at(initial_state)))
Result: 3.666666666666667
>>> print("Result: {}".format(round(result.at(initial_state), 6)))
Result: 3.666667
The reward model has a name which we can obtain as follows:: The reward model has a name which we can obtain as follows::

4
examples/reward_models/01-reward-models.py

@ -10,11 +10,11 @@ def example_reward_models_01():
prop = "R=? [F \"done\"]" prop = "R=? [F \"done\"]"
properties = stormpy.parse_properties_for_prism_program(prop, program, None) properties = stormpy.parse_properties_for_prism_program(prop, program, None)
model = stormpy.build_model(program, properties) model = stormpy.build_model(program, properties)
assert len(model.reward_models) == 1
initial_state = model.initial_states[0] initial_state = model.initial_states[0]
result = stormpy.model_checking(model, properties[0]) result = stormpy.model_checking(model, properties[0])
print("Result: {}".format(result.at(initial_state)))
print("Result: {}".format(round(result.at(initial_state), 6)))
assert len(model.reward_models) == 1
reward_model_name = list(model.reward_models.keys())[0] reward_model_name = list(model.reward_models.keys())[0]
print(reward_model_name) print(reward_model_name)
assert reward_model_name == "coin_flips" assert reward_model_name == "coin_flips"

Loading…
Cancel
Save