Notice that properties is now a list of properties containing a single element.
@ -74,13 +77,15 @@ However, if we build the model as before, then the appropriate information that
In order to label the states accordingly, we should notify storm upon building the model that we would like to preserve given properties.
Storm will then add the labels accordingly::
model = stormpy.build_model(prism_program, properties)
print("Labels in the model: {}".format(model.labels) # out: Labels in the model: {"init", "deadlock", "s=2"})
>>> model = stormpy.build_model(prism_program, properties)
>>> print("Labels in the model: {}".format(sorted(model.labeling.get_labels())))
Labels in the model: ['(s = 2)', 'deadlock', 'init']
Model building however now behaves slightly different: Only the properties passed are preserved, which means that model building might skip parts of the model.
In particular, to check the probability of eventually reaching a state x where s=2, successor states of x are not relevant::
print("Number of states: {}".format(model.nr_states)) # out: Number of states: 8
>>> print("Number of states: {}".format(model.nr_states))
Number of states: 8
If we consider another property, however, such as::
@ -96,24 +101,27 @@ Checking properties
The last lesson taught us to construct properties and models with matching state labels.
Now default checking routines are just a simple command away::
>>> model = stormpy.build_model(prism_program, properties)
>>> result = stormpy.model_checking(model, properties[0])
The result may contain information about all states.
Instead, we can iterate over the results::
assert result.result_for_all_states
for x in result.get_values():
print(x)
>>> assert result.result_for_all_states
>>> for x in result.get_values():
... pass # do something with x
..topic:: Results for all states
Some model checking algorithms do not provide results for all states. In those cases, the result is not valid for all states, and to iterate over them, a different method is required. We will explain this later.
A good way to get the result for the initial states is as follows::
Input formats such as prism allow to specify programs with open constants. We refer to these open constants as parameters.
If the constants only influence the probabilities or rates, but not the topology of the underlying model, we can build these models as parametric models::
model = stormpy.build_parametric_model(prism_program, properties)
>>> model = stormpy.build_parametric_model(prism_program, properties)