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.
136 lines
3.1 KiB
136 lines
3.1 KiB
{
|
|
"cells": [
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"# Building Models"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"## Background\n",
|
|
"\n",
|
|
"Storm supports a wide range of formalisms. Stormpy can be used to build models from some of these formalisms.\n",
|
|
"Moreover, during construction, various options can be set. This document yields information about the most important options."
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"## Building different formalisms\n",
|
|
"\n",
|
|
"We use some standard examples:"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"metadata": {
|
|
"hide-output": false
|
|
},
|
|
"outputs": [],
|
|
"source": [
|
|
">>> import stormpy.examples\n",
|
|
">>> import stormpy.examples.files"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"Storm supports the explicit DRN format.\n",
|
|
"From this, models can be built directly:"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"metadata": {
|
|
"hide-output": false
|
|
},
|
|
"outputs": [],
|
|
"source": [
|
|
">>> path = stormpy.examples.files.drn_ctmc_dft\n",
|
|
">>> model = stormpy.build_model_from_drn(path)\n",
|
|
">>> print(model.model_type)"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"And the same for parametric models:"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"metadata": {
|
|
"hide-output": false
|
|
},
|
|
"outputs": [],
|
|
"source": [
|
|
">>> path = stormpy.examples.files.drn_pdtmc_die\n",
|
|
">>> model = stormpy.build_parametric_model_from_drn(path)\n",
|
|
">>> print(model.model_type)"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"Another option are JANI descriptions. These are another high-level description format.\n",
|
|
"Building models from JANI is done in two steps. First the Jani-description is parsed, and then the model is built from this description:"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"metadata": {
|
|
"hide-output": false
|
|
},
|
|
"outputs": [],
|
|
"source": [
|
|
">>> path = stormpy.examples.files.jani_dtmc_die\n",
|
|
">>> jani_program, properties = stormpy.parse_jani_model(path)\n",
|
|
">>> model = stormpy.build_model(jani_program)\n",
|
|
">>> print(model.model_type)"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"Notice that parsing JANI files also returns properties. In JANI, properties can be embedded in the model file."
|
|
]
|
|
}
|
|
],
|
|
"metadata": {
|
|
"date": 1598188121.587518,
|
|
"filename": "building_models.rst",
|
|
"kernelspec": {
|
|
"display_name": "Python 3",
|
|
"language": "python",
|
|
"name": "python3"
|
|
},
|
|
"language_info": {
|
|
"codemirror_mode": {
|
|
"name": "ipython",
|
|
"version": 3
|
|
},
|
|
"file_extension": ".py",
|
|
"mimetype": "text/x-python",
|
|
"name": "python",
|
|
"nbconvert_exporter": "python",
|
|
"pygments_lexer": "ipython3",
|
|
"version": "3.8.2"
|
|
},
|
|
"title": "Building Models"
|
|
},
|
|
"nbformat": 4,
|
|
"nbformat_minor": 4
|
|
}
|