Browse Source

Added docs to methods in lib

refactoring
Matthias Volk 7 years ago
parent
commit
8b2a11ad42
  1. 14
      lib/stormpy/__init__.py
  2. 1
      lib/stormpy/examples/__init__.py
  3. 7
      lib/stormpy/examples/files.py
  4. 18
      lib/stormpy/storage/__init__.py
  5. 2
      lib/stormpy/utility/__init__.py

14
lib/stormpy/__init__.py

@ -108,6 +108,13 @@ def build_parametric_model_from_drn(file):
def perform_bisimulation(model, properties, bisimulation_type): def perform_bisimulation(model, properties, bisimulation_type):
"""
Perform bisimulation on model.
:param model: Model.
:param properties: Properties to preserve during bisimulation.
:param bisimulation_type: Type of bisimulation (weak or strong).
:return: Model after bisimulation.
"""
formulae = [prop.raw_formula for prop in properties] formulae = [prop.raw_formula for prop in properties]
if model.supports_parameters: if model.supports_parameters:
return core._perform_parametric_bisimulation(model, formulae, bisimulation_type) return core._perform_parametric_bisimulation(model, formulae, bisimulation_type)
@ -116,6 +123,13 @@ def perform_bisimulation(model, properties, bisimulation_type):
def model_checking(model, property): def model_checking(model, property):
"""
Perform model checking on model for property.
:param model: Model.
:param property: Property to check for.
:return: Model checking result.
:rtype: CheckResult
"""
if model.supports_parameters: if model.supports_parameters:
task = core.ParametricCheckTask(property.raw_formula, False) task = core.ParametricCheckTask(property.raw_formula, False)
return core._parametric_model_checking_sparse_engine(model, task) return core._parametric_model_checking_sparse_engine(model, task)

1
lib/stormpy/examples/__init__.py

@ -0,0 +1 @@
# intentionally left blank

7
lib/stormpy/examples/files.py

@ -4,7 +4,12 @@ testfile_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), "files")
def _path(folder, file): def _path(folder, file):
"""Internal method for simpler listing of examples"""
"""
Internal method for simpler listing of examples.
:param folder: Folder.
:param file: Example file.
:return: Complete path to example file.
"""
return os.path.join(testfile_dir, folder, file) return os.path.join(testfile_dir, folder, file)

18
lib/stormpy/storage/__init__.py

@ -1,8 +1,17 @@
from . import storage from . import storage
from .storage import * from .storage import *
class ModelInstantiator: class ModelInstantiator:
"""
Class for instantiating models.
"""
def __init__(self, model): def __init__(self, model):
"""
Constructor.
:param model: Model.
"""
if model.model_type == ModelType.MDP: if model.model_type == ModelType.MDP:
self._instantiator = PmdpInstantiator(model) self._instantiator = PmdpInstantiator(model)
elif model.model_type == ModelType.DTMC: elif model.model_type == ModelType.DTMC:
@ -14,5 +23,10 @@ class ModelInstantiator:
else: else:
raise ValueError("Model type {} not supported".format(model.model_type)) raise ValueError("Model type {} not supported".format(model.model_type))
def instantiate(self, point):
return self._instantiator.instantiate(point)
def instantiate(self, valuation):
"""
Instantiate model with given valuation.
:param valuation: Valuation from parameter to value.
:return: Instantiated model.
"""
return self._instantiator.instantiate(valuation)

2
lib/stormpy/utility/__init__.py

@ -1,2 +1,2 @@
from . import utility from . import utility
from .utility import *
from .utility import *
Loading…
Cancel
Save