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.
29 lines
1008 B
29 lines
1008 B
from . import _config
|
|
|
|
if not _config.storm_with_pars:
|
|
raise ImportError("No support for parametric analysis was built in Storm.")
|
|
|
|
from . import pars
|
|
from .pars import *
|
|
|
|
from stormpy import ModelType, StormError
|
|
|
|
pars._set_up()
|
|
|
|
|
|
def simplify_model(model, formula):
|
|
"""
|
|
Simplify parametric model preserving the given formula by eliminating states with constant outgoing probabilities.
|
|
:param model: Model.
|
|
:param formula: Formula.
|
|
:return: Tuple of simplified model and simplified formula.
|
|
"""
|
|
if model.model_type == ModelType.DTMC:
|
|
simplifier = pars._SparseParametricDtmcSimplifier(model)
|
|
elif model.model_type == ModelType.MDP:
|
|
simplifier = pars._SparseParametricMdpSimplifier(model)
|
|
else:
|
|
raise StormError("Model type {} cannot be simplified.".format(model.model_type))
|
|
if not simplifier.simplify(formula):
|
|
raise StormError("Model could not be simplified")
|
|
return simplifier.simplified_model, simplifier.simplified_formula
|