Matthias Volk
4 years ago
No known key found for this signature in database
GPG Key ID: 83A57678F739FCD3
5 changed files with
44 additions and
3 deletions
-
doc/source/doc/models/building_ctmcs.rst
-
doc/source/doc/models/building_mas.rst
-
examples/building_ctmcs/01-building-ctmcs.py
-
examples/building_mas/01-building-mas.py
-
examples/building_mdps/01-building-mdps.py
|
|
@ -3,6 +3,17 @@ Continuous-time Markov chains (CTMCs) |
|
|
|
************************************** |
|
|
|
|
|
|
|
|
|
|
|
.. check if the following doctest should be run (and hide it in Sphinx) |
|
|
|
>>> # Skip tests if numpy is not available |
|
|
|
>>> import pytest |
|
|
|
>>> try: |
|
|
|
... import numpy as np |
|
|
|
... except ModuleNotFoundError: |
|
|
|
... np = None |
|
|
|
>>> if np is None: |
|
|
|
... pytest.skip("skipping the doctest below since it's not going to work.") |
|
|
|
|
|
|
|
|
|
|
|
Background |
|
|
|
===================== |
|
|
|
|
|
|
|
|
|
@ -3,6 +3,17 @@ Markov automata (MAs) |
|
|
|
************************************** |
|
|
|
|
|
|
|
|
|
|
|
.. check if the following doctest should be run (and hide it in Sphinx) |
|
|
|
>>> # Skip tests if numpy is not available |
|
|
|
>>> import pytest |
|
|
|
>>> try: |
|
|
|
... import numpy as np |
|
|
|
... except ModuleNotFoundError: |
|
|
|
... np = None |
|
|
|
>>> if np is None: |
|
|
|
... pytest.skip("skipping the doctest below since it's not going to work.") |
|
|
|
|
|
|
|
|
|
|
|
Background |
|
|
|
===================== |
|
|
|
|
|
|
|
|
|
@ -1,8 +1,18 @@ |
|
|
|
import stormpy |
|
|
|
import numpy as np |
|
|
|
|
|
|
|
# Check if numpy is available |
|
|
|
try: |
|
|
|
import numpy as np |
|
|
|
numpy_found = True |
|
|
|
except ModuleNotFoundError: |
|
|
|
numpy_found = False |
|
|
|
|
|
|
|
|
|
|
|
def example_building_ctmcs_01(): |
|
|
|
if not numpy_found: |
|
|
|
print("Numpy not available") |
|
|
|
return |
|
|
|
|
|
|
|
# Building the transition matrix using numpy |
|
|
|
transitions = np.array([ |
|
|
|
[0, 1.5, 0, 0], |
|
|
|
|
|
@ -1,8 +1,18 @@ |
|
|
|
import stormpy |
|
|
|
import numpy as np |
|
|
|
|
|
|
|
# Check if numpy is available |
|
|
|
try: |
|
|
|
import numpy as np |
|
|
|
numpy_found = True |
|
|
|
except ModuleNotFoundError: |
|
|
|
numpy_found = False |
|
|
|
|
|
|
|
|
|
|
|
def example_building_mas_01(): |
|
|
|
if not numpy_found: |
|
|
|
print("Numpy not available") |
|
|
|
return |
|
|
|
|
|
|
|
# Building the transition matrix using numpy |
|
|
|
transitions = np.array([ |
|
|
|
[0, 1, 0, 0, 0], |
|
|
|
|
|
@ -1,5 +1,4 @@ |
|
|
|
import stormpy |
|
|
|
import numpy as np |
|
|
|
|
|
|
|
|
|
|
|
# Knuth's model of a fair die using only fair coins |
|
|
|