├── .dockerignore
├── .git-blame-ignore-revs
├── .github
├── dependabot.yml
└── workflows
│ ├── Dockerfile.stable
│ ├── buildtest.yml
│ ├── formatapply.yml
│ ├── formatcheck.yml
│ └── release_docker.yml
├── .gitignore
├── CHANGELOG.md
├── CMakeLists.txt
├── Dockerfile
├── LICENSE
├── MANIFEST.in
├── README.md
├── binder
└── Dockerfile
├── cmake
├── config.py.in
├── core_config.py.in
├── info_config.py.in
├── macros.cmake
└── pycarl_core_config.py.in
├── doc
├── Makefile
├── build_website.md
├── checklist_new_release.md
└── source
│ ├── advanced_topics.rst
│ ├── api.rst
│ ├── api
│ ├── core.rst
│ ├── dft.rst
│ ├── exceptions.rst
│ ├── gspn.rst
│ ├── info.rst
│ ├── logic.rst
│ ├── pars.rst
│ ├── pycarl
│ │ ├── convert.rst
│ │ ├── core.rst
│ │ ├── formula.rst
│ │ └── parse.rst
│ ├── storage.rst
│ └── utility.rst
│ ├── conf.py
│ ├── contributors.rst
│ ├── doc
│ ├── analysis.ipynb
│ ├── building_models.ipynb
│ ├── dfts.ipynb
│ ├── engines.ipynb
│ ├── exploration.ipynb
│ ├── gspns.ipynb
│ ├── models
│ │ ├── building_ctmcs.ipynb
│ │ ├── building_dtmcs.ipynb
│ │ ├── building_mas.ipynb
│ │ └── building_mdps.ipynb
│ ├── parametric_models.ipynb
│ ├── reward_models.ipynb
│ ├── schedulers.ipynb
│ ├── shortest_paths.ipynb
│ └── simulator.ipynb
│ ├── getting_started.ipynb
│ ├── index.rst
│ ├── installation.rst
│ ├── themes
│ └── fixedbootstrap
│ │ ├── layout.html
│ │ └── theme.conf
│ └── using_pycarl.rst
├── examples
├── 01-getting-started.py
├── 02-getting-started.py
├── 03-getting-started.py
├── 04-getting-started.py
├── analysis
│ ├── 01-analysis.py
│ ├── 02-analysis.py
│ ├── 03-analysis.py
│ └── 04-analysis.py
├── building_ctmcs
│ └── 01-building-ctmcs.py
├── building_dtmcs
│ └── 01-building-dtmcs.py
├── building_mas
│ └── 01-building-mas.py
├── building_mdps
│ └── 01-building-mdps.py
├── building_models
│ ├── 01-building-models.py
│ ├── 02-building-models.py
│ ├── 03-building-models.py
│ └── 04-building-models.py
├── dfts
│ ├── 01-dfts.py
│ ├── 02-dfts.py
│ └── interactive_simulator.py
├── exploration
│ ├── 01-exploration.py
│ ├── 02-exploration.py
│ └── 03-exploration.py
├── gspns
│ ├── 01-gspns.py
│ └── 02-gspns.py
├── highlevel_models
│ ├── 01-highlevel-models.py
│ └── 02-highlevel-models.py
├── parametric_models
│ ├── 01-parametric-models.py
│ ├── 02-parametric-models.py
│ ├── 03-parametric-models.py
│ └── 04-parametric-models.py
├── pomdp
│ ├── 01-pomdps.py
│ └── high-level-observations.py
├── pycarl
│ └── 01-pycarl-getting-started.py
├── reward_models
│ └── 01-reward-models.py
├── schedulers
│ ├── 01-schedulers.py
│ └── 02-schedulers.py
├── shortest_paths
│ └── 01-shortest-paths.py
└── simulator
│ ├── 01-simulator.py
│ ├── 02-simulator.py
│ ├── 03-simulator.py
│ └── 04-simulator.py
├── lib
└── stormpy
│ ├── __init__.py
│ ├── _version.py
│ ├── dft
│ ├── __init__.py
│ ├── modules.py
│ └── simulator.py
│ ├── examples
│ ├── __init__.py
│ ├── files.py
│ └── files
│ │ ├── ctmc
│ │ ├── cluster2.sm
│ │ ├── dft.drn
│ │ ├── embedded2.sm
│ │ ├── fms2.sm
│ │ ├── polling2.sm
│ │ ├── tandem5.sm
│ │ └── tiny.sm
│ │ ├── dft
│ │ ├── and.json
│ │ ├── fdep.dft
│ │ ├── hecs.dft
│ │ ├── rc.dft
│ │ ├── rc2.dft
│ │ └── symmetry_param.dft
│ │ ├── dtmc
│ │ ├── brp-16-2.pm
│ │ ├── brp.jani
│ │ ├── brp.pm
│ │ ├── crowds-5-5.pm
│ │ ├── crowds5_5.pm
│ │ ├── die.jani
│ │ ├── die.lab
│ │ ├── die.pm
│ │ ├── die.tra
│ │ ├── leader-3-5.pm
│ │ ├── leader3_5.pm
│ │ ├── nand-5-2.pm
│ │ ├── negativevals.pm
│ │ └── test_conditional.pm
│ │ ├── gspn
│ │ ├── gspn_simple.pnml
│ │ ├── gspn_simple.pnpro
│ │ └── philosophers_4.pnpro
│ │ ├── imdp
│ │ └── tiny-01.drn
│ │ ├── ipomdp
│ │ └── tiny-01.drn
│ │ ├── lab
│ │ ├── autoParser.lab
│ │ ├── crowds5_5.lab
│ │ ├── declarationMisspell.lab
│ │ ├── die.lab
│ │ ├── doubledLines.lab
│ │ ├── doubledLinesSkipped.lab
│ │ ├── dtmc_actionTest.lab
│ │ ├── dtmc_general.lab
│ │ ├── dtmc_mismatched.lab
│ │ ├── endMisspell.lab
│ │ ├── labelForNonexistentState.lab
│ │ ├── leader4.lab
│ │ ├── leader4_8.lab
│ │ ├── ma_cslFilterTest.lab
│ │ ├── ma_general.lab
│ │ ├── ma_mismatched.lab
│ │ ├── mdp_general.lab
│ │ ├── mdp_mismatched.lab
│ │ ├── noDeclarationTag.lab
│ │ ├── noEndTag.lab
│ │ ├── noLabelsDecNoneGiven.lab
│ │ ├── pctl_general.lab
│ │ ├── swappedStateAndProposition.lab
│ │ ├── tiny1.lab
│ │ ├── tiny2.lab
│ │ ├── two_dice.lab
│ │ ├── undeclaredLabelsGiven.lab
│ │ ├── withWhitespaces.lab
│ │ └── withoutWhitespaces.lab
│ │ ├── ma
│ │ ├── ctmc.ma
│ │ ├── hybrid_states.ma
│ │ ├── simple.ma
│ │ └── stream2.ma
│ │ ├── mdp
│ │ ├── SmallPrismTest.nm
│ │ ├── SmallPrismTest2.nm
│ │ ├── coin2-2-illegalSynchronizingWrite.nm
│ │ ├── coin2-2.nm
│ │ ├── coin2.nm
│ │ ├── csma2-2.nm
│ │ ├── csma2_2.nm
│ │ ├── die_c1.nm
│ │ ├── die_selection.nm
│ │ ├── firewire.nm
│ │ ├── firewire3-0.5.nm
│ │ ├── leader3.nm
│ │ ├── leader4.nm
│ │ ├── maze_2.nm
│ │ ├── multiobjective1.nm
│ │ ├── multiobjective2.nm
│ │ ├── scheduler_generation.nm
│ │ ├── slipgrid.nm
│ │ ├── slipgrid_sketch.nm
│ │ ├── system_composition.nm
│ │ ├── system_composition2.nm
│ │ ├── tiny_rewards.nm
│ │ ├── two_dice.lab
│ │ ├── two_dice.nm
│ │ ├── two_dice.tra
│ │ ├── wlan0-2-2.nm
│ │ └── wlan0_collide.nm
│ │ ├── pdtmc
│ │ ├── brp16_2.pm
│ │ ├── brp_rewards16_2.pm
│ │ ├── crowds3_5.pm
│ │ ├── die.drn
│ │ ├── herman5.pm
│ │ └── parametric_die.pm
│ │ ├── pmdp
│ │ ├── coin2_2.pm
│ │ └── two_dice.nm
│ │ ├── pomdp
│ │ ├── 3x3grid.prism
│ │ ├── maze-concise.prism
│ │ ├── maze.drn
│ │ ├── maze_2.prism
│ │ └── maze_2_par.prism
│ │ ├── prctl
│ │ ├── apOnly.prctl
│ │ ├── complexFormula.prctl
│ │ ├── probabilisticFormula.prctl
│ │ ├── probabilisticNoBoundFormula.prctl
│ │ ├── propositionalFormula.prctl
│ │ ├── rewardFormula.prctl
│ │ ├── rewardNoBoundFormula.prctl
│ │ └── two_dice.prctl
│ │ ├── rew
│ │ ├── autoParser.state.rew
│ │ ├── die.coin_flips.trans.rew
│ │ ├── dtmc_general.state.rew
│ │ ├── dtmc_general.trans.rew
│ │ ├── dtmc_mismatched.trans.rew
│ │ ├── dtmc_mixedStateOrder.trans.rew
│ │ ├── dtmc_mixedTransitionOrder.trans.rew
│ │ ├── dtmc_rewardForNonExTrans.trans.rew
│ │ ├── dtmc_whitespaces.trans.rew
│ │ ├── leader4.trans.rew
│ │ ├── leader4_8.pick.trans.rew
│ │ ├── ma_general.state.rew
│ │ ├── ma_mismatched.state.rew
│ │ ├── mdp_general.state.rew
│ │ ├── mdp_general.trans.rew
│ │ ├── mdp_mismatched.trans.rew
│ │ ├── mdp_mixedStateOrder.trans.rew
│ │ ├── mdp_mixedTransitionOrder.trans.rew
│ │ ├── mdp_rewardForNonExTrans.trans.rew
│ │ ├── mdp_whitespaces.trans.rew
│ │ ├── state_reward_parser_basic.state.rew
│ │ ├── state_reward_parser_doubledLines.state.rew
│ │ ├── state_reward_parser_doubledLinesSkipped.state.rew
│ │ ├── state_reward_parser_whitespaces.state.rew
│ │ ├── two_dice.flip.state.rew
│ │ └── two_dice.flip.trans.rew
│ │ ├── smg
│ │ └── example_smg.nm
│ │ ├── tra
│ │ ├── crowds5_5.tra
│ │ ├── csl_general.tra
│ │ ├── ctmc.tra
│ │ ├── ctmdp.tra
│ │ ├── die.tra
│ │ ├── dtmc.tra
│ │ ├── dtmcWhitespaces1.tra
│ │ ├── dtmcWhitespaces2.tra
│ │ ├── dtmc_actionTest.tra
│ │ ├── dtmc_deadlock.tra
│ │ ├── dtmc_doubledLines.tra
│ │ ├── dtmc_general.tra
│ │ ├── dtmc_mismatched.tra
│ │ ├── dtmc_mixedStateOrder.tra
│ │ ├── dtmc_mixedTransitionOrder.tra
│ │ ├── dtmc_whitespaces.tra
│ │ ├── leader4.tra
│ │ ├── leader4_8.tra
│ │ ├── ma.tra
│ │ ├── ma_cslFilterTest.tra
│ │ ├── ma_deadlock.tra
│ │ ├── ma_general.tra
│ │ ├── ma_whitespaces.tra
│ │ ├── mdp.tra
│ │ ├── mdp_deadlock.tra
│ │ ├── mdp_doubledLines.tra
│ │ ├── mdp_general.tra
│ │ ├── mdp_mismatched.tra
│ │ ├── mdp_mixedStateOrder.tra
│ │ ├── mdp_mixedTransitionOrder.tra
│ │ ├── mdp_whitespaces.tra
│ │ ├── noHint.tra
│ │ ├── pctl_general.tra
│ │ ├── readme.txt
│ │ ├── tiny1.tra
│ │ ├── tiny2.tra
│ │ ├── two_dice.tra
│ │ ├── wrongHint.tra
│ │ ├── wrong_format_header1.tra
│ │ ├── wrong_format_header2.tra
│ │ └── wrong_format_transition.tra
│ │ └── txt
│ │ └── testStringFile.txt
│ ├── exceptions
│ └── __init__.py
│ ├── gspn
│ └── __init__.py
│ ├── info
│ └── __init__.py
│ ├── logic
│ └── __init__.py
│ ├── pars
│ └── __init__.py
│ ├── pomdp
│ └── __init__.py
│ ├── pycarl
│ ├── __init__.py
│ ├── _version.py
│ ├── cln
│ │ ├── __init__.py
│ │ ├── formula
│ │ │ └── __init__.py
│ │ └── parse
│ │ │ └── __init__.py
│ ├── convert
│ │ ├── __init__.py
│ │ ├── cln_converter.py
│ │ └── gmp_converter.py
│ ├── formula
│ │ └── __init__.py
│ ├── gmp
│ │ ├── __init__.py
│ │ ├── formula
│ │ │ └── __init__.py
│ │ └── parse
│ │ │ └── __init__.py
│ ├── infinity.py
│ └── parse
│ │ └── __init__.py
│ ├── simulator.py
│ ├── storage
│ └── __init__.py
│ └── utility
│ ├── __init__.py
│ └── multiobjective_plotting.py
├── pyproject.toml
├── resources
├── include_pybind11.cmake
├── pybind11_2.10.0.patch
└── pybind11_2.11.1.patch
├── src
├── boost.h
├── common.h
├── config.h.in
├── core
│ ├── analysis.cpp
│ ├── analysis.h
│ ├── bisimulation.cpp
│ ├── bisimulation.h
│ ├── common.h
│ ├── core.cpp
│ ├── core.h
│ ├── counterexample.cpp
│ ├── counterexample.h
│ ├── environment.cpp
│ ├── environment.h
│ ├── input.cpp
│ ├── input.h
│ ├── modelchecking.cpp
│ ├── modelchecking.h
│ ├── result.cpp
│ ├── result.h
│ ├── simulator.cpp
│ ├── simulator.h
│ ├── transformation.cpp
│ └── transformation.h
├── dft
│ ├── analysis.cpp
│ ├── analysis.h
│ ├── common.h
│ ├── dft.cpp
│ ├── dft.h
│ ├── dft_elements.cpp
│ ├── dft_elements.h
│ ├── dft_state.cpp
│ ├── dft_state.h
│ ├── io.cpp
│ ├── io.h
│ ├── module.cpp
│ ├── module.h
│ ├── simulator.cpp
│ ├── simulator.h
│ ├── transformations.cpp
│ └── transformations.h
├── gspn
│ ├── common.h
│ ├── gspn.cpp
│ ├── gspn.h
│ ├── gspn_io.cpp
│ └── gspn_io.h
├── helpers.h
├── logic
│ ├── formulae.cpp
│ └── formulae.h
├── mod_core.cpp
├── mod_dft.cpp
├── mod_gspn.cpp
├── mod_info.cpp
├── mod_logic.cpp
├── mod_pars.cpp
├── mod_pomdp.cpp
├── mod_storage.cpp
├── mod_utility.cpp
├── pars
│ ├── common.h
│ ├── model_instantiator.cpp
│ ├── model_instantiator.h
│ ├── pars.cpp
│ ├── pars.h
│ ├── pla.cpp
│ └── pla.h
├── pomdp
│ ├── common.h
│ ├── memory.cpp
│ ├── memory.h
│ ├── qualitative_analysis.cpp
│ ├── qualitative_analysis.h
│ ├── quantitative_analysis.cpp
│ ├── quantitative_analysis.h
│ ├── tracker.cpp
│ ├── tracker.h
│ ├── transformations.cpp
│ └── transformations.h
├── pycarl
│ ├── common.h
│ ├── core
│ │ ├── bound_type.cpp
│ │ ├── bound_type.h
│ │ ├── monomial.cpp
│ │ ├── monomial.h
│ │ ├── variable.cpp
│ │ └── variable.h
│ ├── definitions.h.in
│ ├── formula
│ │ ├── formula_type.cpp
│ │ ├── formula_type.h
│ │ ├── relation.cpp
│ │ └── relation.h
│ ├── helpers.h
│ ├── mod_cln.cpp
│ ├── mod_core.cpp
│ ├── mod_formula.cpp
│ ├── mod_gmp.cpp
│ ├── mod_parse.cpp
│ ├── mod_typed_formula.cpp
│ ├── mod_typed_parse.cpp
│ ├── typed_core
│ │ ├── factorization.cpp
│ │ ├── factorization.h
│ │ ├── factorizedpolynomial.cpp
│ │ ├── factorizedpolynomial.h
│ │ ├── factorizedrationalfunction.cpp
│ │ ├── factorizedrationalfunction.h
│ │ ├── integer.cpp
│ │ ├── integer.h
│ │ ├── interval.h
│ │ ├── polynomial.cpp
│ │ ├── polynomial.h
│ │ ├── rational.cpp
│ │ ├── rational.h
│ │ ├── rationalfunction.cpp
│ │ ├── rationalfunction.h
│ │ ├── term.cpp
│ │ └── term.h
│ ├── typed_formula
│ │ ├── common.h
│ │ ├── constraint.cpp
│ │ ├── constraint.h
│ │ ├── formula.cpp
│ │ ├── formula.h
│ │ └── types.h
│ ├── typed_parse
│ │ ├── parser.cpp
│ │ └── parser.h
│ ├── types.h
│ └── types
│ │ ├── cln_types.h
│ │ └── gmp_types.h
├── storage
│ ├── bitvector.cpp
│ ├── bitvector.h
│ ├── choiceorigins.cpp
│ ├── choiceorigins.h
│ ├── common.h
│ ├── dd.cpp
│ ├── dd.h
│ ├── decomposition.cpp
│ ├── decomposition.h
│ ├── distribution.cpp
│ ├── distribution.h
│ ├── expressions.cpp
│ ├── expressions.h
│ ├── geometry.cpp
│ ├── geometry.h
│ ├── jani.cpp
│ ├── jani.h
│ ├── labeling.cpp
│ ├── labeling.h
│ ├── matrix.cpp
│ ├── matrix.h
│ ├── model.cpp
│ ├── model.h
│ ├── model_components.cpp
│ ├── model_components.h
│ ├── prism.cpp
│ ├── prism.h
│ ├── scheduler.cpp
│ ├── scheduler.h
│ ├── state.cpp
│ ├── state.h
│ ├── valuation.cpp
│ └── valuation.h
└── utility
│ ├── chrono.cpp
│ ├── chrono.h
│ ├── json.cpp
│ ├── json.h
│ ├── shortestPaths.cpp
│ ├── shortestPaths.h
│ ├── smtsolver.cpp
│ └── smtsolver.h
└── tests
├── configurations.py
├── conftest.py
├── core
├── test_bisimulation.py
├── test_building.py
├── test_core.py
├── test_environment.py
├── test_modelchecking.py
├── test_multiobjective.py
├── test_stormpy_parse.py
└── test_transformation.py
├── dft
├── conftest.py
├── test_analysis.py
├── test_dft.py
├── test_dft_simulator.py
├── test_io.py
├── test_module.py
└── test_transformations.py
├── gspn
├── conftest.py
├── test_gspn.py
└── test_gspn_io.py
├── helpers
└── helper.py
├── info
└── test_info.py
├── logic
└── test_formulas.py
├── pars
├── conftest.py
├── test_model_instantiator.py
├── test_parametric.py
├── test_parametric_model.py
└── test_pla.py
├── pomdp
├── conftest.py
└── test_pomdp_quantitative_analysis.py
├── pycarl
├── conftest.py
├── convert
│ ├── conftest.py
│ ├── test_cln_convert.py
│ ├── test_convert_explicit.py
│ ├── test_convert_python_types.py
│ └── test_gmp_convert.py
├── core
│ ├── test_factorized_polynomial.py
│ ├── test_factorized_rational_function.py
│ ├── test_infinity.py
│ ├── test_integer.py
│ ├── test_interval.py
│ ├── test_monomial.py
│ ├── test_monomial_pool.py
│ ├── test_polynomial.py
│ ├── test_rational.py
│ ├── test_rational_function.py
│ ├── test_stormpy_core.py
│ ├── test_term.py
│ └── test_variable.py
├── formula
│ ├── conftest.py
│ ├── test_constraint.py
│ ├── test_formula.py
│ └── test_relation.py
└── parse
│ ├── conftest.py
│ └── test_pycarl_parse.py
├── simulator
└── test_simulator.py
├── storage
├── test_bitvector.py
├── test_expressions.py
├── test_jani.py
├── test_labeling.py
├── test_matrix.py
├── test_matrix_builder.py
├── test_maximal_end_components.py
├── test_model.py
├── test_model_components.py
├── test_prism.py
├── test_scheduler.py
├── test_state.py
└── test_state_generation.py
└── utility
├── test_shortestpaths.py
└── test_smtsolver.py
/.dockerignore:
--------------------------------------------------------------------------------
1 | #Git files
2 | .git
3 | .github
4 | .gitignore
5 | #The remainder is based on .gitignore
6 | **/*.so
7 | **/*.py[cod]
8 | lib/**/_config.py
9 | **/.eggs/
10 | **/*.egg-info/
11 | **/build/
12 | **/dist/
13 | **/.idea/
14 | **/__pycache__/
15 | **/_build/
16 | **/.pytest_cache/
17 | **/.idea/
18 | **/cmake-build-debug/
19 |
20 | **/.DS_Store
21 |
--------------------------------------------------------------------------------
/.git-blame-ignore-revs:
--------------------------------------------------------------------------------
1 | 534f29c9e329007d67428da3ef7be84141140fe2
--------------------------------------------------------------------------------
/.github/dependabot.yml:
--------------------------------------------------------------------------------
1 | # Set update schedule for GitHub Actions and Python packages
2 |
3 | version: 2
4 | updates:
5 |
6 | # Check for updates to GitHub Actions every week
7 | - package-ecosystem: "github-actions"
8 | directory: "/"
9 | schedule:
10 | interval: "weekly"
11 |
12 | # Check for updates to pip packages every week
13 | - package-ecosystem: "pip"
14 | directory: "/"
15 | schedule:
16 | interval: "weekly"
17 |
--------------------------------------------------------------------------------
/.github/workflows/formatapply.yml:
--------------------------------------------------------------------------------
1 | name: Apply code format
2 |
3 | on:
4 | workflow_dispatch:
5 |
6 | jobs:
7 | build:
8 | runs-on: ubuntu-latest
9 |
10 | steps:
11 | - uses: actions/checkout@v4
12 | - uses: psf/black@stable
13 | with:
14 | options: ""
15 | src: "."
16 | jupyter: true
17 | - name: Commit Formatting
18 | run: |
19 | git config user.name 'Auto Format'
20 | git config user.email 'dev@stormchecker.org'
21 | if [ -z "$(git status --porcelain)" ]
22 | then
23 | echo "Code did not change"
24 | else
25 | git commit -am "Applied code formatting"
26 | git rev-parse HEAD >> .git-blame-ignore-revs
27 | git commit -am "Add code formatting commit to .git-blame-ignore-revs"
28 | fi
29 | - name: Create Pull Request
30 | id: cpr
31 | uses: peter-evans/create-pull-request@v6
32 | with:
33 | branch: ci/apply-code-format
34 | delete-branch: true
35 | title: 'Code formatting'
36 | body: |
37 | Auto-generated pull request triggered by the `apply-code-format` workflow.
38 | - Manually close and reopen this PR to trigger the CI.
39 | - Make sure to **merge** (and not rebase) this PR so that the added commit hash in `.git-blame-ignore-revs` remains valid.
40 |
--------------------------------------------------------------------------------
/.github/workflows/formatcheck.yml:
--------------------------------------------------------------------------------
1 | name: Check code format
2 |
3 | on:
4 | push:
5 | pull_request:
6 | workflow_dispatch:
7 |
8 | jobs:
9 | build:
10 | runs-on: ubuntu-latest
11 |
12 | steps:
13 | - uses: actions/checkout@v4
14 | - uses: psf/black@stable
15 | with:
16 | options: "--check --diff --color"
17 | src: "."
18 | jupyter: true
19 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | *.so
2 | *.py[cod]
3 | lib/**/_config.py
4 | .eggs/
5 | *.egg-info/
6 | build/
7 | dist/
8 | .idea/
9 | __pycache__/
10 | _build/
11 | .pytest_cache/
12 | .idea/
13 | cmake-build-debug/
14 |
15 | .DS_Store
16 |
--------------------------------------------------------------------------------
/MANIFEST.in:
--------------------------------------------------------------------------------
1 | include CMakeLists.txt
2 | recursive-include setup/ *.py
3 | recursive-include cmake/ *
4 | recursive-include src/ *
5 | recursive-include resources/ *
6 | recursive-include lib/stormpy/examples/files/ *
7 |
--------------------------------------------------------------------------------
/binder/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM movesrwth/stormpy:1.9.0
2 | LABEL org.opencontainers.image.authors="dev@stormchecker.org"
3 |
4 |
5 | ##########
6 | # Create user
7 | ##########
8 |
9 | # Ubuntu base image already uses UID/GID 1000
10 | # Change it so the Binder user can use 1000
11 | RUN usermod -u 1001 ubuntu
12 | RUN groupmod -g 1001 ubuntu
13 |
14 | ARG NB_USER=jovyan
15 | ARG NB_UID=1000
16 | ENV USER ${NB_USER}
17 | ENV NB_UID ${NB_UID}
18 | ENV HOME /home/${NB_USER}
19 |
20 | RUN adduser --disabled-password \
21 | --gecos "Default user" \
22 | --uid ${NB_UID} \
23 | ${NB_USER}
24 |
25 | # Change the owner of the virtual environment
26 | WORKDIR /opt
27 | USER root
28 | RUN chown -R ${NB_UID} venv
29 | USER ${NB_USER}
30 |
31 | ##########
32 | # Install dependencies
33 | ##########
34 |
35 | # Jupyter notebook and Jupyterlab
36 | RUN pip install --no-cache-dir notebook==6.5.7
37 | RUN pip install --no-cache-dir jupyterlab==4.1.8
38 | # Use older version of jupyter-server to avoid issue with token
39 | # see https://github.com/jupyter/notebook/issues/6702#issuecomment-1412832225
40 | RUN pip install --no-cache-dir jupyter-server==1.24.0
41 | # Dependencies for stormpy
42 | RUN pip install --no-cache-dir numpy==1.26.4
43 |
44 | ##########
45 | # Prepare files for notebooks
46 | ##########
47 |
48 | # Copy files
49 | WORKDIR ${HOME}
50 | COPY doc/source/*.ipynb notebooks/
51 | COPY doc/source/doc/ notebooks/doc/
52 | COPY examples/ examples/
53 |
54 | # Set owner of files to user
55 | USER root
56 | RUN chown -R ${NB_UID} ${HOME}
57 | USER ${NB_USER}
58 |
59 | # Add missing path
60 | ENV PATH="$HOME/.local/bin:$PATH"
61 |
62 | # Unset entrypoint
63 | ENTRYPOINT []
64 |
--------------------------------------------------------------------------------
/cmake/config.py.in:
--------------------------------------------------------------------------------
1 | # Auto-generated by CMake.
2 |
3 | STORM_DIR = "@STORM_DIR@"
4 | STORM_VERSION = "@STORM_VERSION@"
5 | STORM_CLN_EA = @STORM_CLN_EA_BOOL@
6 | STORM_CLN_RF = @STORM_CLN_RF_BOOL@
7 | STORM_XERCES = @STORM_XERCES_BOOL@
8 | STORM_SPOT = @STORM_SPOT_BOOL@
9 | HAVE_STORM_DFT = @HAVE_STORM_DFT_BOOL@
10 | HAVE_STORM_GSPN = @HAVE_STORM_GSPN_BOOL@
11 | HAVE_STORM_PARS = @HAVE_STORM_PARS_BOOL@
12 | HAVE_STORM_POMDP = @HAVE_STORM_POMDP_BOOL@
13 | CARL_DIR = "@CARL_DIR@"
14 | CARL_VERSION = "@CARL_VERSION@"
15 | CARL_PARSER_DIR = "@CARL_PARSER_DIR@"
16 | CARL_WITH_PARSER = @CARL_WITH_PARSER@
17 | CARL_WITH_CLN = @CARL_WITH_CLN@
18 |
--------------------------------------------------------------------------------
/cmake/core_config.py.in:
--------------------------------------------------------------------------------
1 | # Auto-generated by CMake.
2 |
3 | @PYCARL_IMPORTS@
4 |
5 | Rational = pycarl.@PYCARL_EA_PACKAGE@.Rational
6 | RationalRF = pycarl.@PYCARL_RF_PACKAGE@.Rational
7 | Polynomial = pycarl.@PYCARL_RF_PACKAGE@.Polynomial
8 | FactorizedPolynomial = pycarl.@PYCARL_RF_PACKAGE@.FactorizedPolynomial
9 | RationalFunction = pycarl.@PYCARL_RF_PACKAGE@.RationalFunction
10 | FactorizedRationalFunction = pycarl.@PYCARL_RF_PACKAGE@.FactorizedRationalFunction
11 |
12 | storm_with_dft = @STORM_WITH_DFT_BOOL@
13 | storm_with_gspn = @STORM_WITH_GSPN_BOOL@
14 | storm_with_pars = @STORM_WITH_PARS_BOOL@
15 | storm_with_pomdp = @STORM_WITH_POMDP_BOOL@
16 |
17 | storm_with_spot = @STORM_WITH_SPOT_BOOL@
18 | storm_with_xerces = @STORM_WITH_XERCES_BOOL@
19 |
20 |
--------------------------------------------------------------------------------
/cmake/info_config.py.in:
--------------------------------------------------------------------------------
1 | # Auto-generated by CMake.
2 |
3 | storm_version = "@STORM_VERSION@"
4 | storm_cln_ea = @STORM_USE_CLN_EA_BOOL@
5 | storm_cln_rf = @STORM_USE_CLN_RF_BOOL@
6 | stormpy_pybind_version = "@PYBIND_VERSION@"
7 |
--------------------------------------------------------------------------------
/cmake/pycarl_core_config.py.in:
--------------------------------------------------------------------------------
1 | # Auto-generated by CMake.
2 |
3 | CARL_VERSION = "@CARL_VERSION@"
4 | CARL_WITH_PARSER = @CARL_WITH_PARSER@
5 | CARL_WITH_CLN = @CARL_WITH_CLN@
6 |
--------------------------------------------------------------------------------
/doc/Makefile:
--------------------------------------------------------------------------------
1 | # Minimal makefile for Sphinx documentation
2 | #
3 |
4 | # You can set these variables from the command line.
5 | SPHINXOPTS =
6 | SPHINXBUILD = sphinx-build
7 | SPHINXPROJ = stormpy
8 | SOURCEDIR = source
9 | BUILDDIR = build
10 |
11 | # Put it first so that "make" without argument is like "make help".
12 | help:
13 | @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
14 |
15 | .PHONY: help Makefile
16 |
17 | # Catch-all target: route all unknown targets to Sphinx using the new
18 | # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
19 | %: Makefile
20 | @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
--------------------------------------------------------------------------------
/doc/build_website.md:
--------------------------------------------------------------------------------
1 | # Website
2 | The website is built using [Sphinx](https://www.sphinx-doc.org).
3 | The Markdown files in `doc/source` are used as base and can be modified.
4 |
5 | ## Generate documentation
6 | To generate the documentation, first install the required dependencies:
7 | ```console
8 | pip install .[doc]
9 | ```
10 | Then build the documentation:
11 | ```console
12 | cd doc
13 | make html
14 | ```
15 | Last, open the generated files [build/html/index.html](build/html/index.html) in a web-browser.
16 |
--------------------------------------------------------------------------------
/doc/source/advanced_topics.rst:
--------------------------------------------------------------------------------
1 | *****************
2 | Advanced Examples
3 | *****************
4 |
5 | This guide is a collection of examples meant to bridge the gap between the getting started guide and the API.
6 |
7 | .. toctree::
8 | :maxdepth: 2
9 | :caption: Contents:
10 |
11 | doc/analysis
12 | doc/building_models
13 | doc/models/building_dtmcs
14 | doc/models/building_mdps
15 | doc/models/building_ctmcs
16 | doc/models/building_mas
17 | doc/engines
18 | doc/exploration
19 | doc/simulator
20 | doc/reward_models
21 | doc/schedulers
22 | doc/shortest_paths
23 | doc/parametric_models
24 | doc/dfts
25 | doc/gspns
26 |
--------------------------------------------------------------------------------
/doc/source/api.rst:
--------------------------------------------------------------------------------
1 | Stormpy API Reference
2 | ====================================
3 | Work in progress!
4 |
5 | .. toctree::
6 | :maxdepth: 2
7 | :caption: Modules:
8 |
9 | api/core
10 | api/info
11 | api/exceptions
12 | api/logic
13 | api/storage
14 | api/utility
15 |
16 | api/dft
17 | api/gspn
18 | api/pars
19 |
20 | api/pycarl/core
21 | api/pycarl/convert
22 | api/pycarl/formula
23 | api/pycarl/parse
24 |
--------------------------------------------------------------------------------
/doc/source/api/core.rst:
--------------------------------------------------------------------------------
1 | Stormpy.core
2 | **************************
3 |
4 | .. automodule:: stormpy
5 | :members:
6 | :undoc-members:
7 | :imported-members:
8 |
--------------------------------------------------------------------------------
/doc/source/api/dft.rst:
--------------------------------------------------------------------------------
1 | Stormpy.dft
2 | **************************
3 |
4 | .. automodule:: stormpy.dft
5 | :members:
6 | :undoc-members:
7 | :imported-members:
8 |
--------------------------------------------------------------------------------
/doc/source/api/exceptions.rst:
--------------------------------------------------------------------------------
1 | Stormpy.exceptions
2 | **************************
3 |
4 | .. automodule:: stormpy.exceptions
5 | :members:
6 | :undoc-members:
7 | :imported-members:
8 |
--------------------------------------------------------------------------------
/doc/source/api/gspn.rst:
--------------------------------------------------------------------------------
1 | Stormpy.gspn
2 | **************************
3 |
4 | .. automodule:: stormpy.gspn
5 | :members:
6 | :undoc-members:
7 | :imported-members:
8 |
--------------------------------------------------------------------------------
/doc/source/api/info.rst:
--------------------------------------------------------------------------------
1 | Stormpy.info
2 | **************************
3 |
4 | .. automodule:: stormpy.info
5 | :members:
6 | :undoc-members:
7 | :imported-members:
8 |
--------------------------------------------------------------------------------
/doc/source/api/logic.rst:
--------------------------------------------------------------------------------
1 | Stormpy.logic
2 | **************************
3 |
4 | .. automodule:: stormpy.logic
5 | :members:
6 | :undoc-members:
7 | :imported-members:
8 |
--------------------------------------------------------------------------------
/doc/source/api/pars.rst:
--------------------------------------------------------------------------------
1 | Stormpy.pars
2 | **************************
3 |
4 | .. automodule:: stormpy.pars
5 | :members:
6 | :undoc-members:
7 | :imported-members:
8 |
--------------------------------------------------------------------------------
/doc/source/api/pycarl/convert.rst:
--------------------------------------------------------------------------------
1 | Pycarl convert
2 | ************************
3 |
4 |
5 | Number conversion
6 | ---------------------------
7 |
8 | .. automodule:: stormpy.pycarl.convert
9 | :members:
10 | :undoc-members:
11 | :imported-members:
12 |
--------------------------------------------------------------------------------
/doc/source/api/pycarl/core.rst:
--------------------------------------------------------------------------------
1 | Pycarl core
2 | ************************
3 |
4 |
5 | Number independent types
6 | ---------------------------
7 |
8 | .. automodule:: stormpy.pycarl
9 | :members:
10 | :undoc-members:
11 | :imported-members:
12 |
13 | Number dependent types (gmp)
14 | ------------------------------
15 |
16 | .. automodule:: stormpy.pycarl.gmp
17 | :members:
18 | :undoc-members:
19 | :imported-members:
20 |
21 | Number dependent types (cln)
22 | ------------------------------
23 |
24 | .. automodule:: stormpy.pycarl.cln
25 | :members:
26 | :undoc-members:
27 | :imported-members:
28 |
--------------------------------------------------------------------------------
/doc/source/api/pycarl/formula.rst:
--------------------------------------------------------------------------------
1 | Pycarl formula
2 | ************************
3 |
4 |
5 | Number independent types
6 | ---------------------------
7 |
8 | .. automodule:: stormpy.pycarl.formula
9 | :members:
10 | :undoc-members:
11 | :imported-members:
12 |
13 | Number dependent types (gmp)
14 | ------------------------------
15 |
16 | .. automodule:: stormpy.pycarl.gmp.formula
17 | :members:
18 | :undoc-members:
19 | :imported-members:
20 |
21 | Number dependent types (cln)
22 | ------------------------------
23 |
24 | .. automodule:: stormpy.pycarl.cln.formula
25 | :members:
26 | :undoc-members:
27 | :imported-members:
28 |
--------------------------------------------------------------------------------
/doc/source/api/pycarl/parse.rst:
--------------------------------------------------------------------------------
1 | Pycarl parse
2 | ************************
3 |
4 |
5 | Number independent types
6 | ---------------------------
7 |
8 | .. automodule:: stormpy.pycarl.parse
9 | :members:
10 | :undoc-members:
11 | :imported-members:
12 |
13 | Number dependent types (gmp)
14 | ------------------------------
15 |
16 | .. automodule:: stormpy.pycarl.gmp.parse
17 | :members:
18 | :undoc-members:
19 | :imported-members:
20 |
21 | Number dependent types (cln)
22 | ------------------------------
23 |
24 | .. automodule:: stormpy.pycarl.cln.parse
25 | :members:
26 | :undoc-members:
27 | :imported-members:
28 |
--------------------------------------------------------------------------------
/doc/source/api/storage.rst:
--------------------------------------------------------------------------------
1 | Stormpy.storage
2 | **************************
3 |
4 | .. automodule:: stormpy.storage
5 | :members:
6 | :undoc-members:
7 | :imported-members:
8 |
--------------------------------------------------------------------------------
/doc/source/api/utility.rst:
--------------------------------------------------------------------------------
1 | Stormpy.utility
2 | **************************
3 |
4 | .. automodule:: stormpy.utility
5 | :members:
6 | :undoc-members:
7 | :imported-members:
8 |
--------------------------------------------------------------------------------
/doc/source/contributors.rst:
--------------------------------------------------------------------------------
1 | **************
2 | Contributors
3 | **************
4 |
5 | Stormpy is an extension to `Storm `_.
6 | As a consequence, developers of Storm contributed significantly to the functionality offered by these Python bindings.
7 |
8 | The bindings themselves have been developed by (lexicographically ordered):
9 |
10 | * Sebastian Junges
11 | * Matthias Volk
12 |
13 | and received significant contributions by (lexicographically ordered):
14 |
15 | * Tom Janson
16 | * Hannah Mertens
17 |
18 | We would like to thank Harold Bruintjes for the initial development of the pycarl bindings.
19 |
20 | Furthermore, the following list of people helped us to develop stormpy (in chronological order):
21 |
22 | * Nils Jansen (early adoption, feedback)
23 | * Murat Cubuktepe (early adoption, feedback)
24 |
25 |
--------------------------------------------------------------------------------
/doc/source/index.rst:
--------------------------------------------------------------------------------
1 | .. stormpy documentation master file, created by
2 | sphinx-quickstart on Mon Dec 12 16:20:40 2016.
3 | You can adapt this file completely to your liking, but it should at least
4 | contain the root `toctree` directive.
5 |
6 | Stormpy Documentation
7 | ===================================
8 |
9 |
10 | Stormpy is a set of python bindings for the probabilistic model checker `Storm `_.
11 | Pycarl is bundled with stormpy. It is a set of python bindings for the computer arithmetic and logic library `carl `_.
12 |
13 |
14 | .. toctree::
15 | :maxdepth: 2
16 | :caption: Contents:
17 |
18 | installation
19 | getting_started
20 | advanced_topics
21 | contributors
22 |
23 |
24 | .. include:: api.rst
25 |
26 |
27 | Indices and tables
28 | ==================
29 |
30 | * :ref:`genindex`
31 | * :ref:`modindex`
32 | * :ref:`search`
33 |
--------------------------------------------------------------------------------
/doc/source/themes/fixedbootstrap/theme.conf:
--------------------------------------------------------------------------------
1 | # This theme inherits from the sphinx-bootstrap theme, but includes small CSS fixes
2 | # so the spacing in the generated documentation is a bit cleaner.
3 | [theme]
4 | inherit = bootstrap
5 |
--------------------------------------------------------------------------------
/doc/source/using_pycarl.rst:
--------------------------------------------------------------------------------
1 | ****************************
2 | Getting Started with Pycarl
3 | ****************************
4 |
5 | Before starting with this guide, one should follow the instructions for :doc:`installation`.
6 |
7 | A Quick Tour through pycarl
8 | ===========================
9 |
10 | We start by launching the python 3 interpreter::
11 |
12 | $ python3
13 |
14 | First we import pycarl::
15 |
16 | >>> from stormpy import pycarl
17 |
18 | Pycarl can use two different number types: ``gmp`` and ``cln``.
19 | In this example we will use ``gmp`` numbers and therefore import the corresponding module::
20 |
21 | >>> from stormpy.pycarl import gmp
22 |
23 |
24 | Simple arithmetic operations
25 | ----------------------------
26 | .. seealso:: `01-getting-started.py `_
27 |
28 | We start by doing some simple arithmetic operations.
29 | First we create two variables ``x`` and ``y``::
30 |
31 | >>> pycarl.clear_variable_pool()
32 | >>> x = pycarl.Variable("x")
33 | >>> y = pycarl.Variable("y")
34 |
35 | We perform some operations on polynomials by using the common arithmetic operations of python::
36 |
37 | >>> pol1 = x * x + pycarl.gmp.Integer(2)
38 | >>> pol2 = y + pycarl.gmp.Integer(1)
39 | >>> result = pol1 * pol2
40 | >>> print("({}) * ({}) = {}".format(pol1, pol2, result))
41 | (x^2+2) * (y+1) = x^2*y+2*y+x^2+2
42 |
--------------------------------------------------------------------------------
/examples/01-getting-started.py:
--------------------------------------------------------------------------------
1 | import stormpy
2 |
3 | import stormpy.examples
4 | import stormpy.examples.files
5 |
6 |
7 | def example_getting_started_01():
8 | path = stormpy.examples.files.prism_dtmc_die
9 | prism_program = stormpy.parse_prism_program(path)
10 |
11 | model = stormpy.build_model(prism_program)
12 | print("Number of states: {}".format(model.nr_states))
13 | print("Number of transitions: {}".format(model.nr_transitions))
14 | print("Labels: {}".format(model.labeling.get_labels()))
15 |
16 |
17 | if __name__ == "__main__":
18 | example_getting_started_01()
19 |
--------------------------------------------------------------------------------
/examples/02-getting-started.py:
--------------------------------------------------------------------------------
1 | import stormpy
2 |
3 | import stormpy.examples
4 | import stormpy.examples.files
5 |
6 |
7 | def example_getting_started_02():
8 | path = stormpy.examples.files.prism_dtmc_die
9 | prism_program = stormpy.parse_prism_program(path)
10 |
11 | model = stormpy.build_model(prism_program)
12 | print("Number of states: {}".format(model.nr_states))
13 | print("Number of transitions: {}".format(model.nr_transitions))
14 | print("Labels in the model: {}".format(model.labeling.get_labels()))
15 |
16 | formula_str = "P=? [F s=2]"
17 | properties = stormpy.parse_properties(formula_str, prism_program)
18 | model_for_formula = stormpy.build_model(prism_program, properties)
19 | print("Number of states: {}".format(model_for_formula.nr_states))
20 | print("Number of transitions: {}".format(model_for_formula.nr_transitions))
21 | print("Labels in the model: {}".format(model_for_formula.labeling.get_labels()))
22 |
23 | formula_str_2 = "P=? [F s=7 & d=2]"
24 | properties_2 = stormpy.parse_properties(formula_str_2, prism_program)
25 | model_for_formula_2 = stormpy.build_model(prism_program, properties_2)
26 | print("Number of states: {}".format(model_for_formula_2.nr_states))
27 | print("Number of transitions: {}".format(model_for_formula_2.nr_transitions))
28 | print("Labels in the model: {}".format(model_for_formula_2.labeling.get_labels()))
29 |
30 |
31 | if __name__ == "__main__":
32 | example_getting_started_02()
33 |
--------------------------------------------------------------------------------
/examples/03-getting-started.py:
--------------------------------------------------------------------------------
1 | import stormpy
2 |
3 | import stormpy.examples
4 | import stormpy.examples.files
5 |
6 |
7 | def example_getting_started_03():
8 | path = stormpy.examples.files.prism_dtmc_die
9 | prism_program = stormpy.parse_prism_program(path)
10 |
11 | formula_str = "P=? [F s=7 & d=2]"
12 | properties = stormpy.parse_properties(formula_str, prism_program)
13 | model = stormpy.build_model(prism_program, properties)
14 | result = stormpy.model_checking(model, properties[0])
15 | print(result)
16 | assert result.result_for_all_states
17 | for x in result.get_values():
18 | print(x)
19 | initial_state = model.initial_states[0]
20 | print(result.at(initial_state))
21 |
22 |
23 | if __name__ == "__main__":
24 | example_getting_started_03()
25 |
--------------------------------------------------------------------------------
/examples/04-getting-started.py:
--------------------------------------------------------------------------------
1 | import stormpy
2 |
3 | import stormpy.examples
4 | import stormpy.examples.files
5 |
6 |
7 | def example_getting_started_04():
8 | path = stormpy.examples.files.prism_dtmc_die
9 | prism_program = stormpy.parse_prism_program(path)
10 |
11 | formula_str = "P=? [F s=7 & d=2]"
12 | properties = stormpy.parse_properties(formula_str, prism_program)
13 | model = stormpy.build_model(prism_program, properties)
14 |
15 | print(model.model_type)
16 |
17 | for state in model.states:
18 | if state.id in model.initial_states:
19 | print(state)
20 | for action in state.actions:
21 | for transition in action.transitions:
22 | print("From state {}, with probability {}, go to state {}".format(state, transition.value(), transition.column))
23 |
24 |
25 | if __name__ == "__main__":
26 | example_getting_started_04()
27 |
--------------------------------------------------------------------------------
/examples/analysis/01-analysis.py:
--------------------------------------------------------------------------------
1 | import stormpy
2 |
3 | import stormpy.examples
4 | import stormpy.examples.files
5 |
6 |
7 | def example_analysis_01():
8 | path = stormpy.examples.files.prism_dtmc_die
9 | prism_program = stormpy.parse_prism_program(path)
10 |
11 | formula_str = "P=? [F s=7 & d=2]"
12 | properties = stormpy.parse_properties(formula_str, prism_program)
13 | model = stormpy.build_model(prism_program, properties)
14 | prob0E, prob1A = stormpy.prob01min_states(model, properties[0].raw_formula.subformula)
15 | print(prob0E)
16 | print(prob1A)
17 |
18 |
19 | if __name__ == "__main__":
20 | example_analysis_01()
21 |
--------------------------------------------------------------------------------
/examples/analysis/03-analysis.py:
--------------------------------------------------------------------------------
1 | import stormpy
2 |
3 | import stormpy.examples
4 | import stormpy.examples.files
5 |
6 |
7 | def example_analysis_03():
8 | path = stormpy.examples.files.prism_dtmc_die
9 | prism_program = stormpy.parse_prism_program(path)
10 |
11 | formula_str = "P=? [F s=7 & d=2]"
12 | properties = stormpy.parse_properties(formula_str, prism_program)
13 | model = stormpy.build_model(prism_program, properties)
14 | env = stormpy.Environment()
15 | env.solver_environment.set_linear_equation_solver_type(stormpy.EquationSolverType.native)
16 | env.solver_environment.native_solver_environment.method = stormpy.NativeLinearEquationSolverMethod.optimistic_value_iteration
17 | env.solver_environment.native_solver_environment.precision = stormpy.Rational("0.9")
18 | # env.solver_environment.native_solver_environment.maximum_iterations = 2
19 | result = stormpy.model_checking(model, properties[0], environment=env)
20 | print(result.at(model.initial_states[0]))
21 |
22 | dd_model = stormpy.build_symbolic_model(prism_program, properties)
23 | result = stormpy.model_checking(dd_model, properties[0], environment=env)
24 | filter = stormpy.create_filter_initial_states_symbolic(dd_model)
25 | result.filter(filter)
26 | assert result.min == result.max
27 | print(result.min)
28 |
29 |
30 | if __name__ == "__main__":
31 | example_analysis_03()
32 |
--------------------------------------------------------------------------------
/examples/analysis/04-analysis.py:
--------------------------------------------------------------------------------
1 | import stormpy
2 |
3 | import stormpy.examples
4 | import stormpy.examples.files
5 |
6 |
7 | def example_analysis_04():
8 | path = stormpy.examples.files.prism_dtmc_die
9 | prism_program = stormpy.parse_prism_program(path)
10 |
11 | formula_str = "P=? [F s=7 & d=2]"
12 | properties = stormpy.parse_properties(formula_str, prism_program)
13 |
14 | options = stormpy.BuilderOptions([p.raw_formula for p in properties])
15 | options.set_build_state_valuations()
16 | model = stormpy.build_sparse_model_with_options(prism_program, options)
17 |
18 | result = stormpy.model_checking(model, properties[0])
19 |
20 | # Print the model checking result for all states
21 |
22 | print("Model checking results:")
23 | for i in range(len(model.states)):
24 | print("\tstate #{}\t {}:\t {}".format(i, model.state_valuations.get_string(i), result.at(i)))
25 |
26 |
27 | if __name__ == "__main__":
28 | example_analysis_04()
29 |
--------------------------------------------------------------------------------
/examples/building_ctmcs/01-building-ctmcs.py:
--------------------------------------------------------------------------------
1 | import stormpy
2 |
3 | # Check if numpy is available
4 | try:
5 | import numpy as np
6 |
7 | numpy_found = True
8 | except ModuleNotFoundError:
9 | numpy_found = False
10 |
11 |
12 | def example_building_ctmcs_01():
13 | if not numpy_found:
14 | print("Numpy not available")
15 | return
16 |
17 | # Building the transition matrix using numpy
18 | transitions = np.array(
19 | [
20 | [0, 1.5, 0, 0],
21 | [3, 0, 1.5, 0],
22 | [0, 3, 0, 1.5],
23 | [0, 0, 3, 0],
24 | ],
25 | dtype="float64",
26 | )
27 |
28 | # Default row groups: [0,1,2,3]
29 | transition_matrix = stormpy.build_sparse_matrix(transitions)
30 | print(transition_matrix)
31 |
32 | # State labeling
33 | state_labeling = stormpy.storage.StateLabeling(4)
34 | state_labels = {"empty", "init", "deadlock", "full"}
35 | for label in state_labels:
36 | state_labeling.add_label(label)
37 |
38 | # Adding label to states
39 | state_labeling.add_label_to_state("init", 0)
40 | state_labeling.add_label_to_state("empty", 0)
41 | state_labeling.add_label_to_state("full", 3)
42 |
43 | # Collect components
44 | # rate_transitions = True, because the transition values are interpreted as rates
45 | components = stormpy.SparseModelComponents(transition_matrix=transition_matrix, state_labeling=state_labeling, rate_transitions=True)
46 |
47 | # Build the model
48 | ctmc = stormpy.storage.SparseCtmc(components)
49 |
50 | print(ctmc)
51 |
52 |
53 | if __name__ == "__main__":
54 | example_building_ctmcs_01()
55 |
--------------------------------------------------------------------------------
/examples/building_models/01-building-models.py:
--------------------------------------------------------------------------------
1 | import stormpy
2 |
3 | import stormpy.examples
4 | import stormpy.examples.files
5 | import stormpy.pomdp
6 |
7 |
8 | def example_building_models_01():
9 | path = stormpy.examples.files.drn_ctmc_dft
10 | model = stormpy.build_model_from_drn(path)
11 | print(model.model_type)
12 | print("Number of states: {}".format(model.nr_states))
13 |
14 | # And the parametric
15 | path = stormpy.examples.files.drn_pdtmc_die
16 | model = stormpy.build_parametric_model_from_drn(path)
17 | print(model.model_type)
18 | print("Number of states: {}".format(model.nr_states))
19 |
20 | path = stormpy.examples.files.jani_dtmc_die
21 | jani_program, properties = stormpy.parse_jani_model(path)
22 | model = stormpy.build_model(jani_program)
23 | print(model.model_type)
24 | print("Number of states: {}".format(model.nr_states))
25 |
26 | # POMDPs should be constructed with choice labels
27 | path = stormpy.examples.files.drn_pomdp_maze
28 | opts = stormpy.DirectEncodingParserOptions()
29 | opts.build_choice_labels = True
30 | pomdp = stormpy.build_model_from_drn(stormpy.examples.files.drn_pomdp_maze, opts)
31 | # POMDPs need to be in a canonic representation
32 | pomdp = stormpy.pomdp.make_canonic(pomdp)
33 |
34 |
35 | if __name__ == "__main__":
36 | example_building_models_01()
37 |
--------------------------------------------------------------------------------
/examples/building_models/03-building-models.py:
--------------------------------------------------------------------------------
1 | import stormpy
2 |
3 | import stormpy.examples
4 | import stormpy.examples.files
5 |
6 | import json
7 |
8 |
9 | def example_building_models_03():
10 | path = stormpy.examples.files.prism_pdtmc_brp
11 | prism_program = stormpy.parse_prism_program(path)
12 | formula_str = "P=? [F s=5]"
13 | properties = stormpy.parse_properties_for_prism_program(formula_str, prism_program)
14 |
15 | options = stormpy.BuilderOptions([p.raw_formula for p in properties])
16 | options.set_build_state_valuations()
17 | model = stormpy.build_sparse_parametric_model_with_options(prism_program, options)
18 |
19 | valuations = model.state_valuations
20 | values2 = json.loads(str(valuations.get_json(2)))
21 | print(values2)
22 |
23 | integer_variables = []
24 | for module in prism_program.modules:
25 | print("module {}".format(module.name))
26 | integer_variables += module.integer_variables
27 |
28 | print(", ".join(["{}: {}".format(str(iv.name), valuations.get_value(2, iv.expression_variable)) for iv in integer_variables]))
29 |
30 |
31 | if __name__ == "__main__":
32 | example_building_models_03()
33 |
--------------------------------------------------------------------------------
/examples/dfts/01-dfts.py:
--------------------------------------------------------------------------------
1 | import stormpy
2 | import stormpy.dft
3 |
4 | import stormpy.examples
5 | import stormpy.examples.files
6 |
7 |
8 | def example_dfts_01():
9 | # Load from JSON
10 | path_json = stormpy.examples.files.dft_json_and
11 | dft_small = stormpy.dft.load_dft_json_file(path_json)
12 | print(dft_small)
13 |
14 | # Load from Galileo
15 | path = stormpy.examples.files.dft_galileo_hecs
16 | dft = stormpy.dft.load_dft_galileo_file(path)
17 | print("DFT with {} elements.".format(dft.nr_elements()))
18 | print("DFT has {} BEs and {} dynamic elements.".format(dft.nr_be(), dft.nr_dynamic()))
19 |
20 | # Analyze
21 | formula_str = 'T=? [ F "failed" ]'
22 | formulas = stormpy.parse_properties(formula_str)
23 | results = stormpy.dft.analyze_dft(dft, [formulas[0].raw_formula])
24 | result = results[0]
25 | print(result)
26 |
27 |
28 | if __name__ == "__main__":
29 | example_dfts_01()
30 |
--------------------------------------------------------------------------------
/examples/dfts/02-dfts.py:
--------------------------------------------------------------------------------
1 | import stormpy
2 | import stormpy.dft
3 | import stormpy.examples
4 | import stormpy.examples.files
5 | from stormpy.dft.simulator import DftSimulator
6 |
7 |
8 | def print_status(simulator):
9 | dft_state, states = simulator.status()
10 | print(dft_state)
11 | for element, status in states.items():
12 | print("\t{} ({}): {}".format(element.name, element.type, status))
13 |
14 |
15 | def example_dft_simulator_02():
16 | # Load DFT from Galileo
17 | path = stormpy.examples.files.dft_galileo_hecs
18 | dft = stormpy.dft.load_dft_galileo_file(path)
19 | print("DFT with {} elements, {} BEs and {} dynamic elements.".format(dft.nr_elements(), dft.nr_be(), dft.nr_dynamic()))
20 |
21 | # Create simulator
22 | simulator = DftSimulator(dft, seed=42)
23 | print_status(simulator)
24 |
25 | choices = ["n15", "n118", "n134", "n23", "n7"]
26 |
27 | for choice in choices:
28 | candidates = simulator.next_failures()
29 | print("Failable BEs: {}".format(", ".join(candidates)))
30 | print("Let {} fail".format(choice))
31 | res = simulator.let_fail(choice)
32 | print("Simulation was {}".format(res))
33 | print_status(simulator)
34 |
35 | # Analyze DFT via simulation
36 | timebound = 5
37 | no_runs = 1000
38 | print("Perform {} simulation runs for timebound {}".format(no_runs, timebound))
39 | no_failed = simulator.simulate_traces(timebound, no_runs)
40 | print("Result for time bound {}: {}".format(timebound, no_failed / no_runs))
41 |
42 |
43 | if __name__ == "__main__":
44 | example_dft_simulator_02()
45 |
--------------------------------------------------------------------------------
/examples/exploration/01-exploration.py:
--------------------------------------------------------------------------------
1 | import stormpy
2 |
3 | import stormpy.examples
4 | import stormpy.examples.files
5 |
6 |
7 | def example_exploration_01():
8 | """
9 | Example to exploration of MDPs.
10 | :return:
11 | """
12 | program = stormpy.parse_prism_program(stormpy.examples.files.prism_pomdp_maze)
13 | prop = 'R=? [F "goal"]'
14 | properties = stormpy.parse_properties(prop, program)
15 | model = stormpy.build_model(program, properties)
16 | print(model.model_type)
17 |
18 | for state in model.states:
19 | if state.id in model.initial_states:
20 | print(state)
21 | for action in state.actions:
22 | for transition in action.transitions:
23 | print("From state {} by action {}, with probability {}, go to state {}".format(state, action, transition.value(), transition.column))
24 |
25 |
26 | if __name__ == "__main__":
27 | example_exploration_01()
28 |
--------------------------------------------------------------------------------
/examples/exploration/02-exploration.py:
--------------------------------------------------------------------------------
1 | import stormpy
2 |
3 | import stormpy.examples
4 | import stormpy.examples.files
5 |
6 |
7 | def example_exploration_02():
8 | """
9 | Example to exploration of POMDPs.
10 | :return:
11 | """
12 | program = stormpy.parse_prism_program(stormpy.examples.files.prism_pomdp_maze)
13 | prop = 'R=? [F "goal"]'
14 | properties = stormpy.parse_properties(prop, program)
15 | model = stormpy.build_model(program, properties)
16 | print(model.model_type)
17 | # Internally, POMDPs are just MDPs with additional observation information.
18 | # Thus, data structure exploration for MDPs can be applied as before.
19 | initial_state = model.initial_states[0]
20 |
21 | for state in model.states:
22 | if state.id in model.initial_states:
23 | print(state)
24 | for action in state.actions:
25 | for transition in action.transitions:
26 | print("From state {} by action {}, with probability {}, go to state {}".format(state, action, transition.value(), transition.column))
27 |
28 | print(model.nr_observations)
29 |
30 | for state in model.states:
31 | print("State {} has observation id {}".format(state.id, model.observations[state.id]))
32 |
33 |
34 | if __name__ == "__main__":
35 | example_exploration_02()
36 |
--------------------------------------------------------------------------------
/examples/exploration/03-exploration.py:
--------------------------------------------------------------------------------
1 | import stormpy
2 |
3 | import stormpy.examples
4 | import stormpy.examples.files
5 |
6 |
7 | def example_exploration_03():
8 | """
9 | Topological sort
10 |
11 | :return:
12 | """
13 | path = stormpy.examples.files.prism_dtmc_die
14 | prism_program = stormpy.parse_prism_program(path)
15 |
16 | formula_str = "P=? [F s=7 & d=2]"
17 | properties = stormpy.parse_properties_for_prism_program(formula_str, prism_program)
18 | model = stormpy.build_model(prism_program, properties)
19 |
20 | sorted = stormpy.topological_sort(model)
21 | print(sorted)
22 | sorted = stormpy.topological_sort(model, forward=False)
23 | print(sorted)
24 |
25 |
26 | if __name__ == "__main__":
27 | example_exploration_03()
28 |
--------------------------------------------------------------------------------
/examples/gspns/01-gspns.py:
--------------------------------------------------------------------------------
1 | import stormpy
2 | import stormpy.gspn
3 |
4 | import stormpy.examples
5 | import stormpy.examples.files
6 |
7 |
8 | def example_gspns_01():
9 | # Load a GSPN from file (PNML format)
10 | import_path = stormpy.examples.files.gspn_pnml_simple
11 | gspn_parser = stormpy.gspn.GSPNParser()
12 | gspn = gspn_parser.parse(import_path)
13 |
14 | print("Name of GSPN: {}.".format(gspn.get_name()))
15 | print("Number of places: {}.".format(gspn.get_number_of_places()))
16 | print("Number of immediate transitions: {}.".format(gspn.get_number_of_immediate_transitions()))
17 | print("Number of timed transitions: {}.".format(gspn.get_number_of_timed_transitions()))
18 |
19 |
20 | if __name__ == "__main__":
21 | example_gspns_01()
22 |
--------------------------------------------------------------------------------
/examples/highlevel_models/01-highlevel-models.py:
--------------------------------------------------------------------------------
1 | import stormpy
2 |
3 | import stormpy.examples
4 | import stormpy.examples.files
5 |
6 |
7 | def example_highlevel_models():
8 | path = stormpy.examples.files.prism_pdtmc_die
9 | prism_program = stormpy.parse_prism_program(path)
10 | for c in prism_program.constants:
11 | print("constant {} with type {} is {} defined".format(c.name, c.type, "" if c.defined else "not"))
12 |
13 | path = stormpy.examples.files.prism_dtmc_brp
14 | prism_program = stormpy.parse_prism_program(path)
15 | for module in prism_program.modules:
16 | for v in module.integer_variables:
17 | print(f"Variable {v.name} has bounds {v.lower_bound_expression} and {v.upper_bound_expression}")
18 | for v in module.boolean_variables:
19 | print(f"Variable {v.name} is Boolean")
20 |
21 |
22 | if __name__ == "__main__":
23 | example_highlevel_models()
24 |
--------------------------------------------------------------------------------
/examples/parametric_models/01-parametric-models.py:
--------------------------------------------------------------------------------
1 | import stormpy
2 |
3 | from stormpy import pycarl
4 |
5 | import stormpy.examples
6 | import stormpy.examples.files
7 |
8 | import stormpy._config as config
9 |
10 |
11 | def example_parametric_models_01():
12 | # Check support for parameters
13 | if not config.storm_with_pars:
14 | print("Support parameters is missing. Try building storm-pars.")
15 | return
16 |
17 | import stormpy.pars
18 |
19 | path = stormpy.examples.files.prism_pdtmc_die
20 | prism_program = stormpy.parse_prism_program(path)
21 |
22 | formula_str = "P=? [F s=7 & d=2]"
23 | properties = stormpy.parse_properties_for_prism_program(formula_str, prism_program)
24 | model = stormpy.build_parametric_model(prism_program, properties)
25 | print("Model supports parameters: {}".format(model.supports_parameters))
26 | parameters = model.collect_probability_parameters()
27 | assert len(parameters) == 2
28 |
29 | instantiator = stormpy.pars.PDtmcInstantiator(model)
30 | point = dict()
31 | for x in parameters:
32 | print(x.name)
33 | point[x] = stormpy.RationalRF(0.4)
34 | instantiated_model = instantiator.instantiate(point)
35 | result = stormpy.model_checking(instantiated_model, properties[0])
36 | print(result)
37 |
38 |
39 | if __name__ == "__main__":
40 | example_parametric_models_01()
41 |
--------------------------------------------------------------------------------
/examples/parametric_models/02-parametric-models.py:
--------------------------------------------------------------------------------
1 | import stormpy
2 | import stormpy.info
3 |
4 | from stormpy import pycarl
5 |
6 | import stormpy.examples
7 | import stormpy.examples.files
8 |
9 | import stormpy._config as config
10 |
11 |
12 | def example_parametric_models_02():
13 | # Check support for parameters
14 | if not config.storm_with_pars:
15 | print("Support parameters is missing. Try building storm-pars.")
16 | return
17 |
18 | import stormpy.pars
19 | from stormpy.pycarl.formula import FormulaType, Relation
20 |
21 | if stormpy.info.storm_ratfunc_use_cln():
22 | from stormpy.pycarl.cln import formula
23 | else:
24 | from stormpy.pycarl.gmp import formula
25 |
26 | path = stormpy.examples.files.prism_pdtmc_die
27 | prism_program = stormpy.parse_prism_program(path)
28 |
29 | formula_str = "P=? [F s=7 & d=2]"
30 | properties = stormpy.parse_properties_for_prism_program(formula_str, prism_program)
31 | model = stormpy.build_parametric_model(prism_program, properties)
32 |
33 | initial_state = model.initial_states[0]
34 | result = stormpy.model_checking(model, properties[0])
35 | print("Result: {}".format(result.at(initial_state)))
36 |
37 | collector = stormpy.ConstraintCollector(model)
38 | print("Well formed constraints:")
39 | for formula in collector.wellformed_constraints:
40 | print(formula.get_constraint())
41 | print("Graph preserving constraints:")
42 | for formula in collector.graph_preserving_constraints:
43 | print(formula.get_constraint())
44 |
45 |
46 | if __name__ == "__main__":
47 | example_parametric_models_02()
48 |
--------------------------------------------------------------------------------
/examples/pomdp/high-level-observations.py:
--------------------------------------------------------------------------------
1 | import stormpy
2 | import stormpy.info
3 |
4 | from stormpy import pycarl
5 |
6 | import stormpy.examples
7 | import stormpy.examples.files
8 |
9 | import stormpy.pomdp
10 |
11 | import stormpy._config as config
12 |
13 |
14 | def example_pomdp_highlevel_observations():
15 | # Check support for parameters
16 |
17 | path = stormpy.examples.files.prism_pomdp_maze
18 | prism_program = stormpy.parse_prism_program(path)
19 | formula_str = 'P=? [!"bad" U "goal"]'
20 | properties = stormpy.parse_properties_for_prism_program(formula_str, prism_program)
21 | # construct the POMDP
22 | options = stormpy.BuilderOptions([p.raw_formula for p in properties])
23 | options.set_build_observation_valuations()
24 | options.set_build_choice_labels()
25 | pomdp = stormpy.build_sparse_model_with_options(prism_program, options)
26 | # make its representation canonic.
27 | pomdp = stormpy.pomdp.make_canonic(pomdp)
28 |
29 | assert pomdp.has_observation_valuations
30 | assert pomdp.observation_valuations.get_json(0)["o"] == 5
31 |
32 |
33 | if __name__ == "__main__":
34 | example_pomdp_highlevel_observations()
35 |
--------------------------------------------------------------------------------
/examples/pycarl/01-pycarl-getting-started.py:
--------------------------------------------------------------------------------
1 | from stormpy import pycarl
2 | from stormpy.pycarl import gmp
3 |
4 |
5 | def pycarl_example_getting_started_01():
6 | pycarl.clear_variable_pool()
7 | x = pycarl.Variable("x")
8 | y = pycarl.Variable("y")
9 | pol1 = x * x + pycarl.gmp.Integer(2)
10 | pol2 = y + pycarl.gmp.Integer(1)
11 | result = pol1 * pol2
12 | print("({}) * ({}) = {}".format(pol1, pol2, result))
13 |
14 |
15 | if __name__ == "__main__":
16 | pycarl_example_getting_started_01()
17 |
--------------------------------------------------------------------------------
/examples/reward_models/01-reward-models.py:
--------------------------------------------------------------------------------
1 | import stormpy
2 |
3 | import stormpy.examples
4 | import stormpy.examples.files
5 |
6 |
7 | def example_reward_models_01():
8 | program = stormpy.parse_prism_program(stormpy.examples.files.prism_dtmc_die)
9 | prop = 'R=? [F "done"]'
10 | properties = stormpy.parse_properties_for_prism_program(prop, program, None)
11 | model = stormpy.build_model(program, properties)
12 | assert len(model.reward_models) == 1
13 | initial_state = model.initial_states[0]
14 | result = stormpy.model_checking(model, properties[0])
15 | print("Result: {}".format(round(result.at(initial_state), 6)))
16 |
17 | reward_model_name = list(model.reward_models.keys())[0]
18 | print(reward_model_name)
19 | assert reward_model_name == "coin_flips"
20 | assert not model.reward_models[reward_model_name].has_state_rewards
21 | assert model.reward_models[reward_model_name].has_state_action_rewards
22 | for reward in model.reward_models[reward_model_name].state_action_rewards:
23 | print(reward)
24 | assert not model.reward_models[reward_model_name].has_transition_rewards
25 |
26 | model = stormpy.build_parametric_model_from_drn(stormpy.examples.files.drn_pdtmc_die)
27 | assert len(model.reward_models) == 1
28 | assert reward_model_name == "coin_flips"
29 |
30 |
31 | if __name__ == "__main__":
32 | example_reward_models_01()
33 |
--------------------------------------------------------------------------------
/examples/schedulers/01-schedulers.py:
--------------------------------------------------------------------------------
1 | import stormpy
2 |
3 | import stormpy.examples
4 | import stormpy.examples.files
5 |
6 |
7 | def example_schedulers_01():
8 | path = stormpy.examples.files.prism_mdp_coin_2_2
9 | formula_str = 'Pmin=? [F "finished" & "all_coins_equal_1"]'
10 |
11 | program = stormpy.parse_prism_program(path)
12 | formulas = stormpy.parse_properties_for_prism_program(formula_str, program)
13 |
14 | options = stormpy.BuilderOptions(True, True)
15 | options.set_build_choice_labels()
16 | options.set_build_with_choice_origins()
17 | model = stormpy.build_sparse_model_with_options(program, options)
18 |
19 | initial_state = model.initial_states[0]
20 | assert initial_state == 0
21 | result = stormpy.model_checking(model, formulas[0], extract_scheduler=True)
22 | assert result.has_scheduler
23 | scheduler = result.scheduler
24 | print(scheduler)
25 | assert scheduler.memoryless
26 | assert scheduler.deterministic
27 |
28 | for state in model.states:
29 | choice = scheduler.get_choice(state)
30 | action_index = choice.get_deterministic_choice()
31 | action = state.actions[action_index]
32 | print("In state {} ({}) choose action {} ({})".format(state, ", ".join(state.labels), action, ", ".join(action.labels)))
33 |
34 | dtmc = model.apply_scheduler(scheduler)
35 | print(dtmc)
36 |
37 |
38 | if __name__ == "__main__":
39 | example_schedulers_01()
40 |
--------------------------------------------------------------------------------
/examples/schedulers/02-schedulers.py:
--------------------------------------------------------------------------------
1 | import stormpy
2 |
3 | import stormpy.examples
4 | import stormpy.examples.files
5 |
6 |
7 | def example_schedulers_02():
8 | path = stormpy.examples.files.prism_ma_simple
9 | formula_str = "Tmin=? [ F s=4 ]"
10 |
11 | program = stormpy.parse_prism_program(path, False, True)
12 | formulas = stormpy.parse_properties_for_prism_program(formula_str, program)
13 | options = stormpy.BuilderOptions([f.raw_formula for f in formulas])
14 | options.set_build_choice_labels()
15 | options.set_build_with_choice_origins()
16 | ma = stormpy.build_sparse_model_with_options(program, options)
17 | assert ma.model_type == stormpy.ModelType.MA
18 |
19 | # Convert MA to MDP
20 | mdp, mdp_formulas = stormpy.transform_to_discrete_time_model(ma, formulas)
21 | assert mdp.model_type == stormpy.ModelType.MDP
22 | initial_state = mdp.initial_states[0]
23 | assert initial_state == 0
24 |
25 | result = stormpy.model_checking(mdp, mdp_formulas[0], extract_scheduler=True)
26 | assert result.has_scheduler
27 | scheduler = result.scheduler
28 | print(scheduler)
29 | assert scheduler.memoryless
30 | assert scheduler.deterministic
31 |
32 | for state in mdp.states:
33 | choice = scheduler.get_choice(state)
34 | action_index = choice.get_deterministic_choice()
35 | action = state.actions[action_index]
36 | print("In state {} ({}) choose action {} ({})".format(state, ", ".join(state.labels), action, ", ".join(action.labels)))
37 |
38 |
39 | if __name__ == "__main__":
40 | example_schedulers_02()
41 |
--------------------------------------------------------------------------------
/examples/shortest_paths/01-shortest-paths.py:
--------------------------------------------------------------------------------
1 | import stormpy
2 |
3 | import stormpy.examples
4 | import stormpy.examples.files
5 |
6 | from stormpy.utility import ShortestPathsGenerator
7 |
8 |
9 | def example_shortest_paths():
10 | path = stormpy.examples.files.prism_dtmc_die
11 | prism_program = stormpy.parse_prism_program(path)
12 | model = stormpy.build_model(prism_program)
13 |
14 | state_id = 8
15 | spg = ShortestPathsGenerator(model, state_id)
16 |
17 | # TODO: it's unintuitive to return the paths reversed, change that
18 | # the reason for being reversed in the first place is that the algorithm traverses them in that order
19 | print("Note: Paths are traversed in reverse (from target back to the initial state).")
20 |
21 | for k in range(1, 4):
22 | path = spg.get_path_as_list(k)
23 | distance = spg.get_distance(k)
24 | print("{}-shortest path to state #{}: {}, with distance {}".format(k, state_id, path, distance))
25 |
26 |
27 | if __name__ == "__main__":
28 | example_shortest_paths()
29 |
--------------------------------------------------------------------------------
/examples/simulator/03-simulator.py:
--------------------------------------------------------------------------------
1 | import stormpy
2 | import stormpy.simulator
3 |
4 | import stormpy.examples
5 | import stormpy.examples.files
6 |
7 | """
8 | Simulator for programs
9 | """
10 |
11 |
12 | def example_simulator_03():
13 | path = stormpy.examples.files.prism_mdp_firewire
14 | prism_program = stormpy.parse_prism_program(path)
15 | prism_program = stormpy.preprocess_symbolic_input(prism_program, [], "delay=10,fast=0.8")[0].as_prism_program()
16 |
17 | simulator = stormpy.simulator.create_simulator(prism_program, seed=42)
18 | simulator.set_action_mode(stormpy.simulator.SimulatorActionMode.GLOBAL_NAMES)
19 | final_outcomes = dict()
20 | for n in range(5):
21 | while not simulator.is_done():
22 | actions = simulator.available_actions()
23 | observation, reward, labels = simulator.step(actions[0])
24 | if observation not in final_outcomes:
25 | final_outcomes[observation] = 1
26 | else:
27 | final_outcomes[observation] += 1
28 | simulator.restart()
29 |
30 |
31 | if __name__ == "__main__":
32 | example_simulator_03()
33 |
--------------------------------------------------------------------------------
/lib/stormpy/_version.py:
--------------------------------------------------------------------------------
1 | __version__ = "1.10.0"
2 |
--------------------------------------------------------------------------------
/lib/stormpy/dft/modules.py:
--------------------------------------------------------------------------------
1 | import stormpy.dft
2 |
3 |
4 | def _get_tuple(dft, index):
5 | """
6 | Get json representation of element.
7 |
8 | :param dft: DFT.
9 | :param index: Index (Id).
10 | :return: Dict with 'name' and 'index'.
11 | """
12 | return {"id": str(index), "name": dft.get_element(index).name}
13 |
14 |
15 | def _modules_json(dft, module):
16 | """
17 | Create JSON representation of DFT modules.
18 |
19 | :param dft: DFT.
20 | :param module: Module.
21 | :return: JSON object containing all modules in a recursive hierarchy.
22 | """
23 | data = dict()
24 | data["representative"] = _get_tuple(dft, module.representative())
25 | data["elements"] = [_get_tuple(dft, elem) for elem in module.elements()]
26 | submodules = []
27 | for submodule in module.submodules():
28 | submodules.append(_modules_json(dft, submodule))
29 | data["submodules"] = submodules
30 | return data
31 |
32 |
33 | def modules_json(dft):
34 | """
35 | Create JSON representation of DFT modules.
36 |
37 | :param dft: DFT.
38 | :return: JSON object containing all modules in a recursive hierarchy.
39 | """
40 | return _modules_json(dft, dft.modules())
41 |
--------------------------------------------------------------------------------
/lib/stormpy/examples/__init__.py:
--------------------------------------------------------------------------------
1 | # intentionally left blank
2 |
--------------------------------------------------------------------------------
/lib/stormpy/examples/files/ctmc/dft.drn:
--------------------------------------------------------------------------------
1 | // Exported by storm
2 | // Original model type: CTMC
3 | @type: CTMC
4 | @parameters
5 |
6 | @reward_models
7 |
8 | @nr_states
9 | 16
10 | @model
11 | state 0 !1 failed
12 | action 0
13 | 0 : 1
14 | state 1 !2 init
15 | action 0
16 | 2 : 0.5
17 | 9 : 0.5
18 | 13 : 0.5
19 | 15 : 0.5
20 | state 2 !1.5
21 | action 0
22 | 3 : 0.5
23 | 6 : 0.5
24 | 8 : 0.5
25 | state 3 !1
26 | action 0
27 | 4 : 0.5
28 | 5 : 0.5
29 | state 4 !0.5
30 | action 0
31 | 0 : 0.5
32 | state 5 !0.5
33 | action 0
34 | 0 : 0.5
35 | state 6 !1
36 | action 0
37 | 4 : 0.5
38 | 7 : 0.5
39 | state 7 !0.5
40 | action 0
41 | 0 : 0.5
42 | state 8 !1
43 | action 0
44 | 5 : 0.5
45 | 7 : 0.5
46 | state 9 !1.5
47 | action 0
48 | 3 : 0.5
49 | 10 : 0.5
50 | 12 : 0.5
51 | state 10 !1
52 | action 0
53 | 4 : 0.5
54 | 11 : 0.5
55 | state 11 !0.5
56 | action 0
57 | 0 : 0.5
58 | state 12 !1
59 | action 0
60 | 5 : 0.5
61 | 11 : 0.5
62 | state 13 !1.5
63 | action 0
64 | 8 : 0.5
65 | 12 : 0.5
66 | 14 : 0.5
67 | state 14 !1
68 | action 0
69 | 7 : 0.5
70 | 11 : 0.5
71 | state 15 !1.5
72 | action 0
73 | 6 : 0.5
74 | 10 : 0.5
75 | 14 : 0.5
76 |
--------------------------------------------------------------------------------
/lib/stormpy/examples/files/ctmc/polling2.sm:
--------------------------------------------------------------------------------
1 | // polling example [IT90]
2 | // gxn/dxp 26/01/00
3 |
4 | ctmc
5 |
6 | const int N = 2;
7 |
8 | const double mu = 1;
9 | const double gamma = 200;
10 | const double lambda = mu/N;
11 |
12 | module server
13 |
14 | s : [1..2]; // station
15 | a : [0..1]; // action: 0=polling, 1=serving
16 |
17 | [loop1a] (s=1)&(a=0) -> gamma : (s'=s+1);
18 | [loop1b] (s=1)&(a=0) -> gamma : (a'=1);
19 | [serve1] (s=1)&(a=1) -> mu : (s'=s+1)&(a'=0);
20 |
21 | [loop2a] (s=2)&(a=0) -> gamma : (s'=1);
22 | [loop2b] (s=2)&(a=0) -> gamma : (a'=1);
23 | [serve2] (s=2)&(a=1) -> mu : (s'=1)&(a'=0);
24 |
25 | endmodule
26 |
27 | module station1
28 |
29 | s1 : [0..1]; // state of station: 0=empty, 1=full
30 |
31 | [loop1a] (s1=0) -> 1 : (s1'=0);
32 | [] (s1=0) -> lambda : (s1'=1);
33 | [loop1b] (s1=1) -> 1 : (s1'=1);
34 | [serve1] (s1=1) -> 1 : (s1'=0);
35 |
36 | endmodule
37 |
38 | // construct further stations through renaming
39 |
40 | module station2 = station1 [ s1=s2, loop1a=loop2a, loop1b=loop2b, serve1=serve2 ] endmodule
41 | // (cumulative) rewards
42 |
43 | // expected time station 1 is waiting to be served
44 | rewards "waiting"
45 | s1=1 & !(s=1 & a=1) : 1;
46 | endrewards
47 |
48 | // expected number of times station 1 is served
49 | rewards "served"
50 | [serve1] true : 1;
51 | endrewards
52 |
53 | label "target" = s=1&a=1;
54 |
--------------------------------------------------------------------------------
/lib/stormpy/examples/files/ctmc/tandem5.sm:
--------------------------------------------------------------------------------
1 | // tandem queueing network [HKMKS99]
2 | // gxn/dxp 25/01/00
3 |
4 | ctmc
5 |
6 | const int c = 5; // queue capacity
7 |
8 | const double lambda = 4*c;
9 | const double mu1a = 0.1*2;
10 | const double mu1b = 0.9*2;
11 | const double mu2 = 2;
12 | const double kappa = 4;
13 |
14 | module serverC
15 |
16 | sc : [0..c];
17 | ph : [1..2];
18 |
19 | [] (sc lambda: (sc'=sc+1);
20 | [route] (sc>0) & (ph=1) -> mu1b: (sc'=sc-1);
21 | [] (sc>0) & (ph=1) -> mu1a: (ph'=2);
22 | [route] (sc>0) & (ph=2) -> mu2: (ph'=1) & (sc'=sc-1);
23 |
24 | endmodule
25 |
26 | module serverM
27 |
28 | sm : [0..c];
29 |
30 | [route] (sm 1: (sm'=sm+1);
31 | [] (sm>0) -> kappa: (sm'=sm-1);
32 |
33 | endmodule
34 |
35 | // reward - number of customers in network
36 | rewards "customers"
37 | true : sc + sm;
38 | endrewards
39 |
40 | label "network_full" = sc=c&sm=c&ph=2;
41 | label "first_queue_full" = sc=c;
42 | label "second_queue_full" = sm=c;
43 |
--------------------------------------------------------------------------------
/lib/stormpy/examples/files/ctmc/tiny.sm:
--------------------------------------------------------------------------------
1 | ctmc
2 |
3 | module one
4 | s : [0 .. 3] init 0;
5 |
6 | [] s<3 -> 3/2 : (s'=s+1);
7 | [] s>0 -> 3 : (s'=s-1);
8 | endmodule
9 |
10 | label "empty" = s=0;
11 | label "full" = s=3;
12 |
--------------------------------------------------------------------------------
/lib/stormpy/examples/files/dft/fdep.dft:
--------------------------------------------------------------------------------
1 | toplevel "System";
2 | "System" or "Power" "Machine";
3 | "Power" fdep "B_Power" "P" "B";
4 | "Machine" or "P" "B";
5 |
6 | "B_Power" lambda=0.5 dorm=0;
7 | "P" lambda=0.5 dorm=0;
8 | "B" lambda=0.5 dorm=0.5;
9 |
--------------------------------------------------------------------------------
/lib/stormpy/examples/files/dft/hecs.dft:
--------------------------------------------------------------------------------
1 | toplevel "n0";
2 | "n0" or "n116" "n137" "n120" "n21";
3 | "n137" wsp "n139" "n9";
4 | "n120" wsp "n118" "n134" "n10";
5 | "n21" 3of5 "n111" "n109" "n117" "n110" "n112";
6 | "n110" or "n18" "n7";
7 | "n117" or "n17" "n7";
8 | "n109" or "n15" "n23";
9 | "n112" or "n19" "n13";
10 | "n13" and "n23" "n7";
11 | "n111" or "n14" "n23";
12 | "n116" lambda=0.0018 dorm=0.0;
13 | "n139" lambda=2.0E-5 dorm=0.0;
14 | "n10" lambda=0.001 dorm=0.0;
15 | "n118" lambda=0.002 dorm=0.0;
16 | "n18" lambda=6.0E-4 dorm=0.0;
17 | "n17" lambda=6.0E-4 dorm=0.0;
18 | "n15" lambda=6.0E-4 dorm=0.0;
19 | "n19" lambda=6.0E-4 dorm=0.0;
20 | "n7" lambda=5.0E-4 dorm=0.0;
21 | "n23" lambda=5.0E-4 dorm=0.0;
22 | "n14" lambda=6.0E-4 dorm=0.0;
23 | "n134" lambda=0.002 dorm=0.0;
24 | "n9" lambda=1.0E-5 dorm=0.0;
25 |
--------------------------------------------------------------------------------
/lib/stormpy/examples/files/dft/rc.dft:
--------------------------------------------------------------------------------
1 | toplevel "n21";
2 | "n21" or "n198" "n210" "n160" "n165" "n235" "n199" "n217";
3 | "n199" wsp "n202" "n206" "n209";
4 | "n235" wsp "n238" "n17";
5 | "n210" wsp "n213" "n216";
6 | "n160" wsp "n163" "n162";
7 | "n165" wsp "n168" "n167";
8 | "n217" wsp "n219" "n233" "n35";
9 | "n202" lambda=0.0029999999999999996 dorm=0.0;
10 | "n206" lambda=0.0024 dorm=0.0;
11 | "n17" lambda=1.0E-5 dorm=0.0;
12 | "n198" lambda=0.3016 dorm=0.0;
13 | "n209" lambda=0.0018 dorm=0.0;
14 | "n216" lambda=1.5 dorm=0.0;
15 | "n213" lambda=2.0 dorm=0.0;
16 | "n163" lambda=1.35 dorm=0.0;
17 | "n238" lambda=2.0E-5 dorm=0.0;
18 | "n167" lambda=0.8 dorm=0.0;
19 | "n168" lambda=1.35 dorm=0.0;
20 | "n162" lambda=0.8 dorm=0.0;
21 | "n35" lambda=0.001 dorm=0.0;
22 | "n233" lambda=0.002 dorm=0.0;
23 | "n219" lambda=0.002 dorm=0.0;
24 |
--------------------------------------------------------------------------------
/lib/stormpy/examples/files/dft/rc2.dft:
--------------------------------------------------------------------------------
1 | toplevel "System";
2 | "System" or "controller" "sensor_1" "barrier_1";
3 | "sensor_1" 2of4 "sA_1" "sB_1" "sC_1" "sD_1";
4 | "network_1_f" fdep "network_1" "sA_1" "sB_1" "sC_1" "sD_1";
5 | "barrier_1" or "switch_1" "motors_1";
6 | "motors_1" wsp "mP_1" "mS_1";
7 | "switch_1" pand "sw_1" "mP_1";
8 | "network_1" lambda=0.03 dorm=0;
9 | "sA_1" lambda=0.05 dorm=0;
10 | "sB_1" lambda=0.05 dorm=0;
11 | "sC_1" lambda=0.05 dorm=0;
12 | "sD_1" lambda=0.05 dorm=0;
13 | "sw_1" lambda=0.015 dorm=0;
14 | "mP_1" lambda=0.08 dorm=0;
15 | "mS_1" lambda=0.08 dorm=0.5;
16 | "controller" lambda=0.03 dorm=0;
17 |
--------------------------------------------------------------------------------
/lib/stormpy/examples/files/dft/symmetry_param.dft:
--------------------------------------------------------------------------------
1 | param x;
2 | param y;
3 | toplevel "A";
4 | "A" and "B" "B'";
5 | "B" and "C" "D";
6 | "B'" and "C'" "D'";
7 | "C" lambda=x dorm=y;
8 | "D" lambda=y dorm=0;
9 | "C'" lambda=x dorm=y;
10 | "D'" lambda=y dorm=0;
11 |
--------------------------------------------------------------------------------
/lib/stormpy/examples/files/dtmc/die.lab:
--------------------------------------------------------------------------------
1 | #DECLARATION
2 | init deadlock one two three four five six done
3 | #END
4 | 0 init
5 | 7 one done
6 | 8 two done
7 | 9 three done
8 | 10 four done
9 | 11 five done
10 | 12 six done
11 |
--------------------------------------------------------------------------------
/lib/stormpy/examples/files/dtmc/die.pm:
--------------------------------------------------------------------------------
1 | // Knuth's model of a fair die using only fair coins
2 | dtmc
3 |
4 | module die
5 |
6 | // local state
7 | s : [0..7] init 0;
8 | // value of the dice
9 | d : [0..6] init 0;
10 |
11 | [] s=0 -> 0.5 : (s'=1) + 0.5 : (s'=2);
12 | [] s=1 -> 0.5 : (s'=3) + 0.5 : (s'=4);
13 | [] s=2 -> 0.5 : (s'=5) + 0.5 : (s'=6);
14 | [] s=3 -> 0.5 : (s'=1) + 0.5 : (s'=7) & (d'=1);
15 | [] s=4 -> 0.5 : (s'=7) & (d'=2) + 0.5 : (s'=7) & (d'=3);
16 | [] s=5 -> 0.5 : (s'=7) & (d'=4) + 0.5 : (s'=7) & (d'=5);
17 | [] s=6 -> 0.5 : (s'=2) + 0.5 : (s'=7) & (d'=6);
18 | [] s=7 -> 1: (s'=7);
19 |
20 | endmodule
21 |
22 | rewards "coin_flips"
23 | [] s<7 : 1;
24 | endrewards
25 |
26 | label "one" = s=7&d=1;
27 | label "two" = s=7&d=2;
28 | label "three" = s=7&d=3;
29 | label "four" = s=7&d=4;
30 | label "five" = s=7&d=5;
31 | label "six" = s=7&d=6;
32 | label "done" = s=7;
33 |
--------------------------------------------------------------------------------
/lib/stormpy/examples/files/dtmc/die.tra:
--------------------------------------------------------------------------------
1 | dtmc
2 | 0 1 0.5
3 | 0 2 0.5
4 | 1 3 0.5
5 | 1 4 0.5
6 | 2 5 0.5
7 | 2 6 0.5
8 | 3 1 0.5
9 | 3 7 0.5
10 | 4 8 0.5
11 | 4 9 0.5
12 | 5 10 0.5
13 | 5 11 0.5
14 | 6 2 0.5
15 | 6 12 0.5
16 | 7 7 1
17 | 8 8 1
18 | 9 9 1
19 | 10 10 1
20 | 11 11 1
21 | 12 12 1
22 |
--------------------------------------------------------------------------------
/lib/stormpy/examples/files/dtmc/negativevals.pm:
--------------------------------------------------------------------------------
1 | dtmc
2 |
3 | module main
4 | s : [-1..3] init -1;
5 | [] true -> 0.5:(s'=max(-1,s-1)) + 0.5:(s'=min(3,s+1));
6 | endmodule
7 |
8 |
--------------------------------------------------------------------------------
/lib/stormpy/examples/files/dtmc/test_conditional.pm:
--------------------------------------------------------------------------------
1 | dtmc
2 |
3 | module test
4 | s : [0 .. 3] init 0;
5 |
6 | [] s=0 -> 0.5 : (s'=1) + 0.5 : (s'=2);
7 | [] s=1 -> 1 : true;
8 | [] s=2 -> 1 : (s'=3);
9 | [] s=3 -> 1 : true;
10 |
11 | endmodule
12 |
13 | rewards
14 | s=2 : 1;
15 | endrewards
16 |
17 | label "condition" = s=2;
18 | label "target" = s=3;
19 |
--------------------------------------------------------------------------------
/lib/stormpy/examples/files/gspn/gspn_simple.pnpro:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/lib/stormpy/examples/files/imdp/tiny-01.drn:
--------------------------------------------------------------------------------
1 | @type: MDP
2 | @parameters
3 |
4 | @reward_models
5 |
6 | @nr_states
7 | 3
8 | @nr_choices
9 | 3
10 | @model
11 | state 0 init
12 | action 0
13 | 1 : [0.4, 0.9]
14 | 2 : [0.5, 0.8]
15 | state 1 target
16 | action 0
17 | 1 : [1, 1]
18 | state 2
19 | action 0
20 | 2 : [1, 1]
--------------------------------------------------------------------------------
/lib/stormpy/examples/files/ipomdp/tiny-01.drn:
--------------------------------------------------------------------------------
1 | @type: POMDP
2 | @parameters
3 |
4 | @reward_models
5 |
6 | @nr_states
7 | 4
8 | @nr_choices
9 | 5
10 | @model
11 | state 0 {0} init
12 | action 0
13 | 1 : [0.2, 0.7]
14 | 2 : [0.3, 0.8]
15 | action 1
16 | 0 : [0.4, 0.9]
17 | 3 : [0.5, 0.8]
18 | state 1 {1} target
19 | action 0
20 | 1 : [1, 1]
21 | state 2 {2}
22 | action 0
23 | 2 : [1, 1]
24 | state 3 {2}
25 | action 0
26 | 0 : [0.5, 1]
27 | 3 : [0.1, 0.5]
28 |
--------------------------------------------------------------------------------
/lib/stormpy/examples/files/lab/autoParser.lab:
--------------------------------------------------------------------------------
1 | #DECLARATION
2 | init one two three four
3 | #END
4 | 0 init one two three four
5 | 1 one
6 | 2 two
7 | 3 three
8 | 4 four
9 | 5 one
10 | 6 one
11 | 7 two
12 | 8 two
13 | 9 three four
14 | 10 three
15 | 11 four
16 |
--------------------------------------------------------------------------------
/lib/stormpy/examples/files/lab/declarationMisspell.lab:
--------------------------------------------------------------------------------
1 | #DECLAATION
2 | phi
3 | #END
4 | 1 phi
5 | 2 phi
6 | 3 phi
7 |
8 |
--------------------------------------------------------------------------------
/lib/stormpy/examples/files/lab/die.lab:
--------------------------------------------------------------------------------
1 | #DECLARATION
2 | init deadlock one two three four five six done
3 | #END
4 | 0 init
5 | 7 one done
6 | 8 two done
7 | 9 three done
8 | 10 four done
9 | 11 five done
10 | 12 six done
11 |
--------------------------------------------------------------------------------
/lib/stormpy/examples/files/lab/doubledLines.lab:
--------------------------------------------------------------------------------
1 | #DECLARATION
2 | one two three
3 | #END
4 | 1 one
5 | 1 two
6 | 2 two
7 | 3 one
8 | 4 three
9 | 2 two
10 | 5 two three
11 | 2 three
12 | 5 two
13 | 4 one
14 | 1 three
15 |
--------------------------------------------------------------------------------
/lib/stormpy/examples/files/lab/doubledLinesSkipped.lab:
--------------------------------------------------------------------------------
1 | #DECLARATION
2 | one two three
3 | #END
4 | 1 one
5 | 0 two
6 | 2 two
7 | 3 one
8 | 4 three
9 | 5 two three
10 |
--------------------------------------------------------------------------------
/lib/stormpy/examples/files/lab/dtmc_actionTest.lab:
--------------------------------------------------------------------------------
1 | #DECLARATION
2 | init a b c d
3 | #END
4 | 0 init c
5 | 1 c
6 | 2 c d
7 | 3 c
8 | 4 c
9 | 5 a
10 | 6 b
11 | 7 b
12 |
--------------------------------------------------------------------------------
/lib/stormpy/examples/files/lab/dtmc_general.lab:
--------------------------------------------------------------------------------
1 | #DECLARATION
2 | init one two three four
3 | #END
4 | 0 init one two three four
5 | 1 one
6 | 2 two
7 | 3 three
8 | 4 four
9 | 5 one
10 | 6 one two
11 | 7 init one four
12 |
--------------------------------------------------------------------------------
/lib/stormpy/examples/files/lab/dtmc_mismatched.lab:
--------------------------------------------------------------------------------
1 | #DECLARATION
2 | init one two three four
3 | #END
4 | 0 init one two three four
5 | 1 one
6 | 2 two
7 | 3 three
8 | 4 four
9 | 5 one
10 | 6 one two
11 | 7 init one four
12 |
--------------------------------------------------------------------------------
/lib/stormpy/examples/files/lab/endMisspell.lab:
--------------------------------------------------------------------------------
1 | #DECLARATION
2 | phi
3 | #EDN
4 | 1 phi
5 | 2 phi
6 | 3 phi
7 |
--------------------------------------------------------------------------------
/lib/stormpy/examples/files/lab/labelForNonexistentState.lab:
--------------------------------------------------------------------------------
1 | #DECLARATION
2 | one two
3 | #END
4 | 1 one
5 | 2 two
6 | 354 one
7 |
--------------------------------------------------------------------------------
/lib/stormpy/examples/files/lab/leader4.lab:
--------------------------------------------------------------------------------
1 | #DECLARATION
2 | init deadlock elected
3 | #END
4 | 0 init
5 | 2595 elected
6 | 2596 elected
7 | 2599 elected
8 | 2969 elected
9 |
--------------------------------------------------------------------------------
/lib/stormpy/examples/files/lab/leader4_8.lab:
--------------------------------------------------------------------------------
1 | #DECLARATION
2 | init deadlock elected
3 | #END
4 | 0 init
5 | 12399 elected
6 |
--------------------------------------------------------------------------------
/lib/stormpy/examples/files/lab/ma_cslFilterTest.lab:
--------------------------------------------------------------------------------
1 | #DECLARATION
2 | init r1 r2 err
3 | #END
4 | 0 init
5 | 2 err
6 | 6 r1
7 | 7 r2
8 |
--------------------------------------------------------------------------------
/lib/stormpy/examples/files/lab/ma_general.lab:
--------------------------------------------------------------------------------
1 | #DECLARATION
2 | init goal err
3 | #END
4 | 0 init
5 | 3 err
6 | 5 goal
7 |
--------------------------------------------------------------------------------
/lib/stormpy/examples/files/lab/ma_mismatched.lab:
--------------------------------------------------------------------------------
1 | #DECLARATION
2 | init goal err
3 | #END
4 | 0 init
5 | 3 err
6 | 5 goal
7 | 9 err
8 |
--------------------------------------------------------------------------------
/lib/stormpy/examples/files/lab/mdp_general.lab:
--------------------------------------------------------------------------------
1 | #DECLARATION
2 | init one two three
3 | #END
4 | 0 init one three
5 | 2 two three
6 | 3 one
7 | 4 init
8 | 5 two
9 |
--------------------------------------------------------------------------------
/lib/stormpy/examples/files/lab/mdp_mismatched.lab:
--------------------------------------------------------------------------------
1 | #DECLARATION
2 | init one two three
3 | #END
4 | 0 init one three
5 | 2 two three
6 | 3 one
7 | 4 init
8 |
--------------------------------------------------------------------------------
/lib/stormpy/examples/files/lab/noDeclarationTag.lab:
--------------------------------------------------------------------------------
1 | phi
2 | #END
3 | 1 phi
4 | 2 phi
5 | 3 phi
6 |
7 |
--------------------------------------------------------------------------------
/lib/stormpy/examples/files/lab/noEndTag.lab:
--------------------------------------------------------------------------------
1 | #DECLARATION
2 | phi
3 | 1 phi
4 | 2 phi
5 | 3 phi
6 |
--------------------------------------------------------------------------------
/lib/stormpy/examples/files/lab/noLabelsDecNoneGiven.lab:
--------------------------------------------------------------------------------
1 | #DECLARATION
2 | #END
3 |
--------------------------------------------------------------------------------
/lib/stormpy/examples/files/lab/pctl_general.lab:
--------------------------------------------------------------------------------
1 | #DECLARATION
2 | phi psi smth
3 | #END
4 | 0 phi
5 | 1 phi
6 | 2 smth phi
--------------------------------------------------------------------------------
/lib/stormpy/examples/files/lab/swappedStateAndProposition.lab:
--------------------------------------------------------------------------------
1 | #DECLARATION
2 | phi
3 | #END
4 | 1 phi
5 | phi 2
6 | 3 phi
7 |
--------------------------------------------------------------------------------
/lib/stormpy/examples/files/lab/tiny1.lab:
--------------------------------------------------------------------------------
1 | #DECLARATION
2 | init goal
3 | #END
4 | 0 init
5 | 7 goal
6 | 8 goal
7 |
8 |
--------------------------------------------------------------------------------
/lib/stormpy/examples/files/lab/tiny2.lab:
--------------------------------------------------------------------------------
1 | #DECLARATION
2 | init goal
3 | #END
4 | 0 init
5 | 7 goal
6 | 8 goal
7 |
8 |
--------------------------------------------------------------------------------
/lib/stormpy/examples/files/lab/two_dice.lab:
--------------------------------------------------------------------------------
1 | #DECLARATION
2 | init deadlock done two three four five six seven eight nine ten eleven twelve
3 | #END
4 | 0 init
5 | 98 done two
6 | 99 done three
7 | 100 done four
8 | 101 done five
9 | 102 done six
10 | 103 done seven
11 | 111 done three
12 | 112 done four
13 | 113 done five
14 | 114 done six
15 | 115 done seven
16 | 116 done eight
17 | 124 done four
18 | 125 done five
19 | 126 done six
20 | 127 done seven
21 | 128 done eight
22 | 129 done nine
23 | 137 done five
24 | 138 done six
25 | 139 done seven
26 | 140 done eight
27 | 141 done nine
28 | 142 done ten
29 | 150 done six
30 | 151 done seven
31 | 152 done eight
32 | 153 done nine
33 | 154 done ten
34 | 155 done eleven
35 | 163 done seven
36 | 164 done eight
37 | 165 done nine
38 | 166 done ten
39 | 167 done eleven
40 | 168 done twelve
41 |
--------------------------------------------------------------------------------
/lib/stormpy/examples/files/lab/undeclaredLabelsGiven.lab:
--------------------------------------------------------------------------------
1 | #DECLARATION
2 | psi
3 | #END
4 | 1 phi
5 | 2 phi
6 | 3 phi
7 |
--------------------------------------------------------------------------------
/lib/stormpy/examples/files/lab/withWhitespaces.lab:
--------------------------------------------------------------------------------
1 | #DECLARATION
2 | one 9 & two " three
3 | #END
4 | 1 one three
5 | 2 two "
6 | 3 three two
7 | 4 one one
8 | 5 two three one two three three two one
9 | 7 one 9 two
10 | 11 two &
11 | 12 one
12 |
--------------------------------------------------------------------------------
/lib/stormpy/examples/files/lab/withoutWhitespaces.lab:
--------------------------------------------------------------------------------
1 | #DECLARATION
2 | one 9 & two " three
3 | #END
4 | 1 one three
5 | 2 two "
6 | 3 three two
7 | 4 one
8 | 5 two three one
9 | 7 one 9 two
10 | 11 two &
11 | 12 one
12 |
--------------------------------------------------------------------------------
/lib/stormpy/examples/files/ma/ctmc.ma:
--------------------------------------------------------------------------------
1 |
2 | ma
3 |
4 | module simple
5 |
6 | s : [0..4];
7 |
8 |
9 | <> (s=0) -> 0.8 : (s'=1) + 0.2 : (s'=2);
10 | <> (s=1) -> 9 : (s'=0) + 1 : (s'=3);
11 | <> (s=2) -> 12 : (s'=4);
12 | <> (s>2) -> 1 : true;
13 |
14 | endmodule
15 |
--------------------------------------------------------------------------------
/lib/stormpy/examples/files/ma/hybrid_states.ma:
--------------------------------------------------------------------------------
1 |
2 | ma
3 |
4 | module hybrid_states
5 |
6 | s : [0..4];
7 |
8 | [] (s=0) -> 0.8 : (s'=0) + 0.2 : (s'=2);
9 | [] (s=0) -> 1 : (s' = 1);
10 | <> (s=0) -> 3 : (s' = 1);
11 | <> (s=1) -> 9 : (s'=0) + 1 : (s'=3);
12 | <> (s=2) -> 12 : (s'=4);
13 | [] (s=3) -> 1 : true;
14 | [] (s=3) -> 1 : (s'=4);
15 | <> (s=3) -> 2 : (s'=3) + 2 : (s'=4);
16 | [] (s=4) -> 1 : true;
17 | <> (s=4) -> 3 : (s'=3);
18 |
19 | endmodule
20 |
--------------------------------------------------------------------------------
/lib/stormpy/examples/files/ma/simple.ma:
--------------------------------------------------------------------------------
1 |
2 | ma
3 |
4 | module simple
5 |
6 | s : [0..4];
7 |
8 |
9 | [alpha] (s=0) -> 1 : (s' = 1);
10 | [beta] (s=0) -> 0.8 : (s'=0) + 0.2 : (s'=2);
11 | <> (s=1) -> 9 : (s'=0) + 1 : (s'=3);
12 | <> (s=2) -> 12 : (s'=4);
13 | <> (s>2) -> 1 : true;
14 |
15 | endmodule
--------------------------------------------------------------------------------
/lib/stormpy/examples/files/ma/stream2.ma:
--------------------------------------------------------------------------------
1 |
2 | ma
3 |
4 | const int N = 2; // num packages
5 |
6 | const double inRate = 4;
7 | const double processingRate = 5;
8 |
9 | module streamingclient
10 |
11 | s : [0..3]; // current state:
12 | // 0: decide whether to start
13 | // 1: buffering
14 | // 2: running
15 | // 3: done
16 |
17 | n : [0..N]; // number of received packages
18 | k : [0..N]; // number of processed packages
19 |
20 | [buffer] s=0 & n 1 : (s'=1);
21 | [start] s=0 & k 1 : (s'=2) & (k'=k+1);
22 |
23 | <> s=1 -> inRate : (n'=n+1) & (s'=0);
24 |
25 | <> s=2 & n inRate : (n'=n+1) + processingRate : (k'=k+1);
26 | <> s=2 & n inRate : (n'=n+1) + processingRate : (s'=0);
27 | <> s=2 & n=N & k processingRate : (k'=k+1);
28 | <> s=2 & n=N & k=N -> processingRate : (s'=3);
29 |
30 | <> s=3 -> 1 : true;
31 | endmodule
32 |
33 | // All packages received and buffer empty
34 | label "done" = (s=3);
35 |
36 | rewards "buffering"
37 | s=1 : 1;
38 | endrewards
39 |
40 | rewards "initialbuffering"
41 | s=1 & k = 0: 1;
42 | endrewards
43 |
44 | rewards "intermediatebuffering"
45 | s=1 & k > 0: 1;
46 | endrewards
47 |
48 | rewards "numRestarts"
49 | [start] k > 0 : 1;
50 | endrewards
51 |
--------------------------------------------------------------------------------
/lib/stormpy/examples/files/mdp/SmallPrismTest.nm:
--------------------------------------------------------------------------------
1 | mdp
2 |
3 | module one
4 | s1 : [0 .. 3];
5 |
6 | [a] s1=0 -> (s1'=1);
7 |
8 | [c] s1=1 -> (s1'=2);
9 |
10 | [d] s1=1 -> (s1'=3);
11 | endmodule
12 |
13 | module two
14 | s2 : [0 .. 2];
15 |
16 | [b] s2=0 -> (s2'=1);
17 |
18 | [c] s2=1 -> (s2'=2);
19 | endmodule
20 |
21 | module three
22 | s3 : [0 .. 2];
23 |
24 | [c] s3=0 -> (s3'=1);
25 | endmodule
26 |
27 |
--------------------------------------------------------------------------------
/lib/stormpy/examples/files/mdp/SmallPrismTest2.nm:
--------------------------------------------------------------------------------
1 | mdp
2 |
3 | module one
4 | s1 : [0 .. 3];
5 |
6 | [a] s1=0 -> (s1'=1);
7 |
8 | [c] s1=1 -> (s1'=2);
9 |
10 | [d] s1=1 -> (s1'=3);
11 | endmodule
12 |
13 | module two
14 | s2 : [0 .. 2];
15 |
16 | [b] s2=0 -> (s2'=1);
17 |
18 | [c] s2=1 -> (s2'=2);
19 | endmodule
20 |
21 | module three
22 | s3 : [0 .. 2];
23 |
24 | [c] s3=0 -> (s3'=1);
25 |
26 | [a] s3=2 -> (s3'=2);
27 | endmodule
28 |
29 |
--------------------------------------------------------------------------------
/lib/stormpy/examples/files/mdp/die_c1.nm:
--------------------------------------------------------------------------------
1 | // Knuth's model of a fair die using only fair coins
2 | mdp
3 |
4 | module die
5 |
6 | // local state
7 | s : [0..7] init 0;
8 | // value of the dice
9 | d : [0..6] init 0;
10 |
11 | [a] s=0 -> 0.5 : (s'=1) + 0.5 : (s'=2);
12 | [b] s=0 -> 0.2 : (s'=1) + 0.8 : (s'=2);
13 | [] s=1 -> 0.5 : (s'=3) + 0.5 : (s'=4);
14 | [] s=2 -> 0.5 : (s'=5) + 0.5 : (s'=6);
15 | [] s=3 -> 0.5 : (s'=1) + 0.5 : (s'=7) & (d'=1);
16 | [] s=4 -> 0.5 : (s'=7) & (d'=2) + 0.5 : (s'=7) & (d'=3);
17 | [] s=5 -> 0.5 : (s'=7) & (d'=4) + 0.5 : (s'=7) & (d'=5);
18 | [] s=6 -> 0.5 : (s'=2) + 0.5 : (s'=7) & (d'=6);
19 | [] s=7 -> 1: (s'=7);
20 |
21 | endmodule
22 |
23 | rewards "coin_flips"
24 | [] s<7 : 1;
25 | endrewards
26 |
27 | label "one" = s=7&d=1;
28 | label "two" = s=7&d=2;
29 | label "three" = s=7&d=3;
30 | label "four" = s=7&d=4;
31 | label "five" = s=7&d=5;
32 | label "six" = s=7&d=6;
33 | label "done" = s=7;
--------------------------------------------------------------------------------
/lib/stormpy/examples/files/mdp/die_selection.nm:
--------------------------------------------------------------------------------
1 | // Knuth's model of a fair die using only fair coins
2 | mdp
3 |
4 | module die
5 |
6 | // local state
7 | s : [0..7] init 0;
8 | // value of the dice
9 | d : [0..6] init 0;
10 |
11 | [fair] s=0 -> 0.5 : (s'=1) + 0.5 : (s'=2);
12 | [ufair1] s=0 -> 0.6 : (s'=1) + 0.4 : (s'=2);
13 | [ufair2] s=0 -> 0.7 : (s'=1) + 0.3 : (s'=2);
14 | [fair] s=1 -> 0.5 : (s'=3) + 0.5 : (s'=4);
15 | [ufair1] s=1 -> 0.6 : (s'=3) + 0.4 : (s'=4);
16 | [ufair2] s=1 -> 0.7 : (s'=3) + 0.3 : (s'=4);
17 | [fair] s=2 -> 0.5 : (s'=5) + 0.5 : (s'=6);
18 | [ufair1] s=2 -> 0.6 : (s'=5) + 0.4 : (s'=6);
19 | [ufair2] s=2 -> 0.7 : (s'=5) + 0.3 : (s'=6);
20 | [fair] s=3 -> 0.5 : (s'=1) + 0.5 : (s'=7) & (d'=1);
21 | [ufair1] s=3 -> 0.6 : (s'=1) + 0.4 : (s'=7) & (d'=1);
22 | [ufair2] s=3 -> 0.7 : (s'=1) + 0.3 : (s'=7) & (d'=1);
23 | [fair] s=4 -> 0.5 : (s'=7) & (d'=2) + 0.5 : (s'=7) & (d'=3);
24 | [ufair1] s=4 -> 0.6 : (s'=7) & (d'=2) + 0.4 : (s'=7) & (d'=3);
25 | [ufair2] s=4 -> 0.7 : (s'=7) & (d'=2) + 0.3 : (s'=7) & (d'=3);
26 | [fair] s=5 -> 0.5 : (s'=7) & (d'=4) + 0.5 : (s'=7) & (d'=5);
27 | [ufair1] s=5 -> 0.6 : (s'=2) + 0.4 : (s'=7) & (d'=6);
28 | [ufair2] s=5 -> 0.7 : (s'=2) + 0.3 : (s'=7) & (d'=6);
29 | [] s=7 -> 1: (s'=7);
30 |
31 | endmodule
32 |
33 | rewards "coin_flips"
34 | [fair] s<7 : 1;
35 | [ufair1] s<7 : 1;
36 | [ufair2] s<7 : 1;
37 | endrewards
38 |
39 | label "one" = s=7&d=1;
40 | label "two" = s=7&d=2;
41 | label "three" = s=7&d=3;
42 | label "four" = s=7&d=4;
43 | label "five" = s=7&d=5;
44 | label "six" = s=7&d=6;
45 | label "done" = s=7;
46 |
--------------------------------------------------------------------------------
/lib/stormpy/examples/files/mdp/multiobjective1.nm:
--------------------------------------------------------------------------------
1 |
2 | mdp
3 |
4 | module module1
5 |
6 | // local state
7 | s : [0..2] init 0;
8 |
9 | [A] s=0 -> 0.6 : (s'=1) + 0.4 : (s'=2);
10 | [B] s=0 -> 0.3 : (s'=0) + 0.7 : (s'=1);
11 | [C] s=0 -> 0.2 : (s'=0) + 0.8 : (s'=2);
12 | [D] s=1 -> 0.25 : (s'=0) + 0.75 : (s'=2);
13 | [] s=2 -> 1 : (s'=s);
14 | endmodule
15 |
16 | rewards "rew"
17 | [A] true : 10;
18 | [D] true : 4;
19 | endrewards
20 |
21 |
--------------------------------------------------------------------------------
/lib/stormpy/examples/files/mdp/multiobjective2.nm:
--------------------------------------------------------------------------------
1 |
2 | mdp
3 |
4 | module module1
5 |
6 | s : [0..2] init 0;
7 |
8 | [A] s=0 -> 1 : (s'=1);
9 | [B] s=0 -> 1 : (s'=2);
10 | [C] s=1 -> 1 : true;
11 | [D] s=1 -> 1 : (s'=2);
12 | [E] s=2 -> 1 : true;
13 | endmodule
14 |
15 | rewards "rew"
16 | [A] true : 10;
17 | [C] true : 3;
18 | [E] true : 1;
19 | endrewards
20 |
21 |
--------------------------------------------------------------------------------
/lib/stormpy/examples/files/mdp/scheduler_generation.nm:
--------------------------------------------------------------------------------
1 | mdp
2 |
3 | module one
4 |
5 | s : [0 .. 5] init 0;
6 |
7 | [] s=0 -> 0.5: (s'=1) + 0.5: (s'=3);
8 | [] s=1 -> 0.4 : (s'=4) + 0.6: (s'=3);
9 | [] s=1 -> 1: (s'=4);
10 | [] s=1 -> 0.8: (s'=3) + 0.2: (s'=4);
11 | [] s=0 | s = 2 -> 0.9: (s'=s) + 0.1 : (s'=3);
12 | [] 3 <= s & s <= 4 -> 1: true;
13 |
14 | endmodule
15 |
16 | label "target" = s=3;
17 |
--------------------------------------------------------------------------------
/lib/stormpy/examples/files/mdp/slipgrid.nm:
--------------------------------------------------------------------------------
1 | mdp
2 |
3 | const double p = 0.4;
4 | const int N = 4;
5 | const int M = 4;
6 |
7 | module grid
8 | x : [1..N] init 1;
9 | y : [1..M] init 1;
10 | [north] x > 1 -> 1-p: (x'=x-1) + p: (x'=x);
11 | [south] x < N -> 1-p: (x'=x+1) + p: (x'=x);
12 | [east] y > 1 -> 1-p: (y'=y-1) + p: (x'=x);
13 | [west] y < M -> 1-p: (y'=y+1) + p: (x'=x);
14 | endmodule
15 |
16 | // reward structure (number of steps to reach the target)
17 | rewards
18 |
19 | [east] true : 1;
20 | [west] true : 1;
21 | [north] true : 1;
22 | [south] true : 1;
23 |
24 | endrewards
25 |
26 | // target observation
27 | label "target" = x=3 & y=3;
28 | label "goal" = x=N & y=M;
29 |
30 |
31 |
--------------------------------------------------------------------------------
/lib/stormpy/examples/files/mdp/slipgrid_sketch.nm:
--------------------------------------------------------------------------------
1 | mdp
2 |
3 | const double p = 0.4;
4 | const int N = 10;
5 | const int M = 10;
6 | const int V;
7 |
8 | module grid
9 | x : [1..N] init 1;
10 | y : [1..M] init 1;
11 | [north] x > 1 -> 1-p: (x'=x-1) + p: (x'=x);
12 | [south] x < V -> 1-p: (x'=x+1) + p: (x'=x);
13 | [east] y > 1 -> 1-p: (y'=y-1) + p: (x'=x);
14 | [west] y < M -> 1-p: (y'=y+1) + p: (x'=x);
15 | endmodule
16 |
17 | // reward structure (number of steps to reach the target)
18 | rewards
19 |
20 | [east] true : 1;
21 | [west] true : 1;
22 | [north] true : 1;
23 | [south] true : V;
24 |
25 | endrewards
26 |
27 | // target observation
28 | label "target" = x=3 & y=3;
29 | label "goal" = x=N & y=M;
30 |
31 |
32 |
--------------------------------------------------------------------------------
/lib/stormpy/examples/files/mdp/system_composition.nm:
--------------------------------------------------------------------------------
1 | mdp
2 |
3 | module one
4 | x : [0 .. 2] init 0;
5 |
6 | [a] x=0 -> (x'=1);
7 | [] x>=0 -> (x'=2);
8 | [done] x>=1 -> true;
9 | endmodule
10 |
11 | module two
12 | y : [0 .. 2] init 0;
13 |
14 | [b] y=0 -> (y'=1);
15 | [] y>=0 -> (y'=2);
16 | [done] y>=1 -> true;
17 | endmodule
18 |
19 | module three
20 | z : [0 .. 2] init 0;
21 |
22 | [a] z=0 -> (z'=1);
23 | [] x=0&y=0&z=1 -> (z'=2);
24 | [loop] z>=1 -> true;
25 | endmodule
26 |
27 | system
28 | ((one || two {b <- a}) / {a}) {done <- loop} || three
29 | endsystem
30 |
31 |
--------------------------------------------------------------------------------
/lib/stormpy/examples/files/mdp/system_composition2.nm:
--------------------------------------------------------------------------------
1 | mdp
2 |
3 | module one
4 | x : [0 .. 2] init 0;
5 |
6 | [a] x=0 -> (x'=1);
7 | [] x>=0 -> (x'=2);
8 | [done] x>=1 -> true;
9 | endmodule
10 |
11 | module two
12 | y : [0 .. 2] init 0;
13 |
14 | [b] y=0 -> (y'=1);
15 | [] y>=0 -> (y'=2);
16 | [done] y>=1 -> true;
17 | endmodule
18 |
19 | module three
20 | z : [0 .. 2] init 0;
21 |
22 | [a] z=0 -> (z'=1);
23 | [] x=0&y=0&z=1 -> (z'=2);
24 | [loop] z>=1 -> true;
25 | endmodule
26 |
27 | system
28 | ((one || two {b <- a})) {done <- loop} || three
29 | endsystem
30 |
31 |
--------------------------------------------------------------------------------
/lib/stormpy/examples/files/mdp/tiny_rewards.nm:
--------------------------------------------------------------------------------
1 | mdp
2 |
3 | module mod1
4 |
5 | s : [0..2] init 0;
6 | [] s=0 -> true;
7 | [] s=0 -> (s'=1);
8 | [] s=1 -> (s'=2);
9 | [] s=2 -> (s'=2);
10 |
11 | endmodule
12 |
13 | rewards
14 | [] s=1 : 1;
15 | endrewards
16 |
17 | label "target" = s=2;
18 |
--------------------------------------------------------------------------------
/lib/stormpy/examples/files/mdp/two_dice.lab:
--------------------------------------------------------------------------------
1 | #DECLARATION
2 | init deadlock done two three four five six seven eight nine ten eleven twelve
3 | #END
4 | 0 init
5 | 98 done two
6 | 99 done three
7 | 100 done four
8 | 101 done five
9 | 102 done six
10 | 103 done seven
11 | 111 done three
12 | 112 done four
13 | 113 done five
14 | 114 done six
15 | 115 done seven
16 | 116 done eight
17 | 124 done four
18 | 125 done five
19 | 126 done six
20 | 127 done seven
21 | 128 done eight
22 | 129 done nine
23 | 137 done five
24 | 138 done six
25 | 139 done seven
26 | 140 done eight
27 | 141 done nine
28 | 142 done ten
29 | 150 done six
30 | 151 done seven
31 | 152 done eight
32 | 153 done nine
33 | 154 done ten
34 | 155 done eleven
35 | 163 done seven
36 | 164 done eight
37 | 165 done nine
38 | 166 done ten
39 | 167 done eleven
40 | 168 done twelve
41 |
--------------------------------------------------------------------------------
/lib/stormpy/examples/files/mdp/two_dice.nm:
--------------------------------------------------------------------------------
1 | // sum of two dice as the asynchronous parallel composition of
2 | // two copies of Knuth's model of a fair die using only fair coins
3 |
4 | mdp
5 |
6 | module die1
7 |
8 | // local state
9 | s1 : [0..7] init 0;
10 | // value of the dice
11 | d1 : [0..6] init 0;
12 |
13 | [] s1=0 -> 0.5 : (s1'=1) + 0.5 : (s1'=2);
14 | [] s1=1 -> 0.5 : (s1'=3) + 0.5 : (s1'=4);
15 | [] s1=2 -> 0.5 : (s1'=5) + 0.5 : (s1'=6);
16 | [] s1=3 -> 0.5 : (s1'=1) + 0.5 : (s1'=7) & (d1'=1);
17 | [] s1=4 -> 0.5 : (s1'=7) & (d1'=2) + 0.5 : (s1'=7) & (d1'=3);
18 | [] s1=5 -> 0.5 : (s1'=7) & (d1'=4) + 0.5 : (s1'=7) & (d1'=5);
19 | [] s1=6 -> 0.5 : (s1'=2) + 0.5 : (s1'=7) & (d1'=6);
20 | [] s1=7 & s2=7 -> 1: (s1'=7);
21 | endmodule
22 |
23 | module die2 = die1 [ s1=s2, s2=s1, d1=d2 ] endmodule
24 |
25 | rewards "coinflips"
26 | [] s1<7 | s2<7 : 1;
27 | endrewards
28 |
29 | label "done" = s1=7 & s2=7;
30 | label "two" = s1=7 & s2=7 & d1+d2=2;
31 | label "three" = s1=7 & s2=7 & d1+d2=3;
32 | label "four" = s1=7 & s2=7 & d1+d2=4;
33 | label "five" = s1=7 & s2=7 & d1+d2=5;
34 | label "six" = s1=7 & s2=7 & d1+d2=6;
35 | label "seven" = s1=7 & s2=7 & d1+d2=7;
36 | label "eight" = s1=7 & s2=7 & d1+d2=8;
37 | label "nine" = s1=7 & s2=7 & d1+d2=9;
38 | label "ten" = s1=7 & s2=7 & d1+d2=10;
39 | label "eleven" = s1=7 & s2=7 & d1+d2=11;
40 | label "twelve" = s1=7 & s2=7 & d1+d2=12;
41 |
--------------------------------------------------------------------------------
/lib/stormpy/examples/files/pdtmc/die.drn:
--------------------------------------------------------------------------------
1 | // Exported by storm
2 | // Original model type: DTMC
3 | @type: DTMC
4 | @parameters
5 | p q
6 | @reward_models
7 | coin_flips
8 | @nr_states
9 | 13
10 | @model
11 | state 0 init [1]
12 | action 0
13 | 1 : p
14 | 2 : (-1)*p+1
15 | state 1 [1]
16 | action 0
17 | 3 : q
18 | 4 : (-1)*q+1
19 | state 2 [1]
20 | action 0
21 | 5 : q
22 | 6 : (-1)*q+1
23 | state 3 [1]
24 | action 0
25 | 1 : p
26 | 7 : (-1)*p+1
27 | state 4 [1]
28 | action 0
29 | 8 : p
30 | 9 : (-1)*p+1
31 | state 5 [1]
32 | action 0
33 | 2 : p
34 | 10 : (-1)*p+1
35 | state 6 [1]
36 | action 0
37 | 11 : p
38 | 12 : (-1)*p+1
39 | state 7
40 | action 0
41 | 7 : 1
42 | state 8
43 | action 0
44 | 8 : 1
45 | state 9
46 | action 0
47 | 9 : 1
48 | state 10
49 | action 0
50 | 10 : 1
51 | state 11
52 | action 0
53 | 11 : 1
54 | state 12
55 | action 0
56 | 12 : 1
57 |
--------------------------------------------------------------------------------
/lib/stormpy/examples/files/pdtmc/herman5.pm:
--------------------------------------------------------------------------------
1 | // herman's self stabilising algorithm [Her90]
2 | // gxn/dxp 13/07/02
3 |
4 | // the procotol is synchronous with no nondeterminism (a DTMC)
5 | dtmc
6 |
7 | // coin
8 | const double p;
9 |
10 | // module for process 1
11 | module process1
12 |
13 | // Boolean variable for process 1
14 | x1 : [0..1];
15 | i1 : bool init false;
16 |
17 | [initial] (!i1) -> 0.5 : (x1'=0) & (i1'=true) + 0.5 : (x1'=1) & (i1'=true);
18 | [step] (i1 & x1=x0) -> p : (x1'=0) + 1-p : (x1'=1);
19 | [step] (i1 & x1!=x0) -> (x1'=x0);
20 |
21 | endmodule
22 |
23 | // add further processes through renaming
24 | module process2 = process1 [ x1=x2, x0=x1, i1=i2 ] endmodule
25 | module process3 = process1 [ x1=x3, x0=x2, i1=i3 ] endmodule
26 | module process4 = process1 [ x1=x4, x0=x3, i1=i4 ] endmodule
27 | module process5 = process1 [ x1=x0, x0=x4, i1=i5 ] endmodule
28 |
29 | formula initialized = i1 & i2 & i3 & i4 & i5;
30 |
31 | // cost - 1 in each state (expected number of steps)
32 | rewards "steps"
33 | initialized : 1;
34 | endrewards
35 |
36 | // formula, for use in properties: number of tokens
37 | // (i.e. number of processes that have the same value as the process to their left)
38 | formula num_tokens = (x1=x0?1:0)
39 | +(x2=x1?1:0)
40 | +(x3=x2?1:0)
41 | +(x4=x3?1:0)
42 | +(x0=x4?1:0);
43 |
44 | // label - stable configurations (1 token)
45 | label "stable" = num_tokens=1 & initialized;
46 |
47 |
--------------------------------------------------------------------------------
/lib/stormpy/examples/files/pdtmc/parametric_die.pm:
--------------------------------------------------------------------------------
1 | // Knuth's model of a fair die using only fair coins
2 | dtmc
3 |
4 | const double p;
5 | const double q;
6 |
7 | module die
8 |
9 | // local state
10 | s : [0..7] init 0;
11 | // value of the dice
12 | d : [0..6] init 0;
13 |
14 | [] s=0 -> p : (s'=1) + (1-p) : (s'=2);
15 | [] s=1 -> q : (s'=3) + (1-q) : (s'=4);
16 | [] s=2 -> q : (s'=5) + (1-q) : (s'=6);
17 | [] s=3 -> p : (s'=1) + (1-p) : (s'=7) & (d'=1);
18 | [] s=4 -> p : (s'=7) & (d'=2) + (1-p) : (s'=7) & (d'=3);
19 | [] s=5 -> p : (s'=7) & (d'=4) + (1-p) : (s'=7) & (d'=5);
20 | [] s=6 -> p : (s'=2) + (1-p) : (s'=7) & (d'=6);
21 | [] s=7 -> 1: (s'=7);
22 |
23 | endmodule
24 |
25 | rewards "coin_flips"
26 | [] s<7 : 1;
27 | endrewards
28 |
29 | label "one" = s=7&d=1;
30 | label "two" = s=7&d=2;
31 | label "three" = s=7&d=3;
32 | label "four" = s=7&d=4;
33 | label "five" = s=7&d=5;
34 | label "six" = s=7&d=6;
35 | label "done" = s=7;
36 |
--------------------------------------------------------------------------------
/lib/stormpy/examples/files/pmdp/coin2_2.pm:
--------------------------------------------------------------------------------
1 | //Randomised Consensus Protocol
2 |
3 | mdp
4 | const double p1; // in [0.2 , 0.8]
5 | const double p2; // in [0.2 , 0.8]
6 |
7 |
8 | const int N=2;
9 | const int K=2;
10 | const int range = 2*(K+1)*N;
11 | const int counter_init = (K+1)*N;
12 | const int left = N;
13 | const int right = 2*(K+1)*N - N;
14 |
15 | // shared coin
16 | global counter : [0..range] init counter_init;
17 |
18 | module process1
19 |
20 | // program counter
21 | pc1 : [0..3];
22 | // 0 - flip
23 | // 1 - write
24 | // 2 - check
25 | // 3 - finished
26 |
27 | // local coin
28 | coin1 : [0..1];
29 |
30 | // flip coin
31 | [] (pc1=0) -> p1 : (coin1'=0) & (pc1'=1) + 1 - p1 : (coin1'=1) & (pc1'=1);
32 | // write tails -1 (reset coin to add regularity)
33 | [] (pc1=1) & (coin1=0) & (counter>0) -> (counter'=counter-1) & (pc1'=2) & (coin1'=0);
34 | // write heads +1 (reset coin to add regularity)
35 | [] (pc1=1) & (coin1=1) & (counter (counter'=counter+1) & (pc1'=2) & (coin1'=0);
36 | // check
37 | // decide tails
38 | [] (pc1=2) & (counter<=left) -> (pc1'=3) & (coin1'=0);
39 | // decide heads
40 | [] (pc1=2) & (counter>=right) -> (pc1'=3) & (coin1'=1);
41 | // flip again
42 | [] (pc1=2) & (counter>left) & (counter (pc1'=0);
43 | // loop (all loop together when done)
44 | [done] (pc1=3) -> (pc1'=3);
45 |
46 | endmodule
47 |
48 | module process2 = process1[pc1=pc2,coin1=coin2,p1=p2] endmodule
49 | label "finished" = pc1=3 &pc2=3 ;
50 | label "all_coins_equal_1" = coin1=1 &coin2=1 ;
51 | rewards "steps"
52 | true : 1;
53 | endrewards
54 |
55 |
56 |
57 |
--------------------------------------------------------------------------------
/lib/stormpy/examples/files/pmdp/two_dice.nm:
--------------------------------------------------------------------------------
1 | // sum of two dice as the asynchronous parallel composition of
2 | // two copies of Knuth's model of a fair die using only fair coins
3 |
4 | mdp
5 |
6 | //Coin Probabilities
7 | const double p1;
8 | const double p2;
9 |
10 | module die1
11 |
12 | // local state
13 | s1 : [0..7] init 0;
14 | // value of the dice
15 | d1 : [0..6] init 0;
16 |
17 | [] s1=0 -> p1 : (s1'=1) + 1-p1 : (s1'=2);
18 | [] s1=1 -> p1 : (s1'=3) + 1-p1 : (s1'=4);
19 | [] s1=2 -> p1 : (s1'=5) + 1-p1 : (s1'=6);
20 | [] s1=3 -> p1 : (s1'=1) + 1-p1 : (s1'=7) & (d1'=1);
21 | [] s1=4 -> p1 : (s1'=7) & (d1'=2) + 1-p1 : (s1'=7) & (d1'=3);
22 | [] s1=5 -> p1 : (s1'=7) & (d1'=4) + 1-p1 : (s1'=7) & (d1'=5);
23 | [] s1=6 -> p1 : (s1'=2) + 1-p1 : (s1'=7) & (d1'=6);
24 | [] s1=7 & s2=7 -> 1: (s1'=7);
25 | endmodule
26 |
27 | module die2 = die1 [ s1=s2, s2=s1, d1=d2, p1=p2 ] endmodule
28 |
29 | rewards "coinflips"
30 | [] s1<7 | s2<7 : 1;
31 | endrewards
32 |
33 | label "done" = s1=7 & s2=7;
34 | label "two" = s1=7 & s2=7 & d1+d2=2;
35 | label "three" = s1=7 & s2=7 & d1+d2=3;
36 | label "four" = s1=7 & s2=7 & d1+d2=4;
37 | label "five" = s1=7 & s2=7 & d1+d2=5;
38 | label "six" = s1=7 & s2=7 & d1+d2=6;
39 | label "seven" = s1=7 & s2=7 & d1+d2=7;
40 | label "eight" = s1=7 & s2=7 & d1+d2=8;
41 | label "nine" = s1=7 & s2=7 & d1+d2=9;
42 | label "ten" = s1=7 & s2=7 & d1+d2=10;
43 | label "eleven" = s1=7 & s2=7 & d1+d2=11;
44 | label "twelve" = s1=7 & s2=7 & d1+d2=12;
45 | label "doubles" = s1=7 & s2=7 & d1=d2;
46 |
--------------------------------------------------------------------------------
/lib/stormpy/examples/files/prctl/apOnly.prctl:
--------------------------------------------------------------------------------
1 | P
--------------------------------------------------------------------------------
/lib/stormpy/examples/files/prctl/complexFormula.prctl:
--------------------------------------------------------------------------------
1 | P<=0.5 [ F a ] & (R > 15 [ G P>0.9 [F<=7 a & b] ] | !P < 0.4 [ G !b ])
--------------------------------------------------------------------------------
/lib/stormpy/examples/files/prctl/probabilisticFormula.prctl:
--------------------------------------------------------------------------------
1 | P > 0.5 [ F a ]
--------------------------------------------------------------------------------
/lib/stormpy/examples/files/prctl/probabilisticNoBoundFormula.prctl:
--------------------------------------------------------------------------------
1 | P = ? [ F <= 42 !a ]
--------------------------------------------------------------------------------
/lib/stormpy/examples/files/prctl/propositionalFormula.prctl:
--------------------------------------------------------------------------------
1 | !(a & b) | a & ! c
--------------------------------------------------------------------------------
/lib/stormpy/examples/files/prctl/rewardFormula.prctl:
--------------------------------------------------------------------------------
1 | R >= 15 [ a U !b ]
--------------------------------------------------------------------------------
/lib/stormpy/examples/files/prctl/rewardNoBoundFormula.prctl:
--------------------------------------------------------------------------------
1 | R = ? [ a U <= 4 b & (!c) ]
--------------------------------------------------------------------------------
/lib/stormpy/examples/files/prctl/two_dice.prctl:
--------------------------------------------------------------------------------
1 | P<=0.17 [ F "doubles" ]
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/lib/stormpy/examples/files/rew/autoParser.state.rew:
--------------------------------------------------------------------------------
1 | 0 0
2 | 1 1
3 | 2 2
4 | 3 3
5 | 4 4
6 | 5 10
7 | 6 10
8 | 7 5
9 | 8 20
10 | 9 0
11 | 10 0
12 | 11 1000
13 |
--------------------------------------------------------------------------------
/lib/stormpy/examples/files/rew/die.coin_flips.trans.rew:
--------------------------------------------------------------------------------
1 | 0 1 1
2 | 0 2 1
3 | 1 3 1
4 | 1 4 1
5 | 2 5 1
6 | 2 6 1
7 | 3 1 1
8 | 3 7 1
9 | 4 8 1
10 | 4 9 1
11 | 5 10 1
12 | 5 11 1
13 | 6 2 1
14 | 6 12 1
15 |
--------------------------------------------------------------------------------
/lib/stormpy/examples/files/rew/dtmc_general.state.rew:
--------------------------------------------------------------------------------
1 | 0 0
2 | 1 1
3 | 2 2
4 | 3 3.32
5 | 4 4
6 | 5 110
7 | 6 101
8 | 7 42
9 |
--------------------------------------------------------------------------------
/lib/stormpy/examples/files/rew/dtmc_general.trans.rew:
--------------------------------------------------------------------------------
1 | 0 1 10
2 | 1 2 5
3 | 1 3 5.5
4 | 2 3 21.4
5 | 2 4 4
6 | 2 5 2
7 | 3 3 1
8 | 4 3 1
9 | 5 3 0.1
10 | 5 4 1.1
11 | 5 5 9.5
12 | 5 6 6.7
13 | 6 0 1
14 | 6 5 0
15 | 6 6 12
16 | 7 6 35.224653
17 | 7 7 9.875347
18 |
--------------------------------------------------------------------------------
/lib/stormpy/examples/files/rew/dtmc_mismatched.trans.rew:
--------------------------------------------------------------------------------
1 | 0 1 10
2 | 0 5 13
3 | 1 2 5
4 | 1 3 5.5
5 | 2 3 21.4
6 | 2 4 4
7 | 2 5 2
8 | 3 3 1
9 | 4 3 1
10 | 5 3 0.1
11 | 5 4 1.1
12 | 5 5 9.5
13 | 5 6 6.7
14 | 6 0 1
15 | 6 5 0
16 | 6 6 12
17 |
--------------------------------------------------------------------------------
/lib/stormpy/examples/files/rew/dtmc_mixedStateOrder.trans.rew:
--------------------------------------------------------------------------------
1 | 0 1 10
2 | 1 2 5
3 | 1 3 5.5
4 | 2 3 21.4
5 | 2 4 4
6 | 2 5 2
7 | 3 3 1
8 | 5 3 0.1
9 | 5 4 1.1
10 | 5 5 9.5
11 | 5 6 6.7
12 | 4 3 1
13 | 6 0 1
14 | 6 5 0
15 | 6 6 12
16 | 7 6 35.224653
17 | 7 7 9.875347
18 |
--------------------------------------------------------------------------------
/lib/stormpy/examples/files/rew/dtmc_mixedTransitionOrder.trans.rew:
--------------------------------------------------------------------------------
1 | 0 1 10
2 | 1 3 5.5
3 | 1 2 5
4 | 2 5 2
5 | 2 3 21.4
6 | 2 4 4
7 | 3 3 1
8 | 4 3 1
9 | 5 3 0.1
10 | 5 5 9.5
11 | 5 6 6.7
12 | 5 4 1.1
13 | 6 0 1
14 | 6 5 0
15 | 6 6 12
16 | 7 7 9.875347
17 | 7 6 35.224653
18 |
--------------------------------------------------------------------------------
/lib/stormpy/examples/files/rew/dtmc_rewardForNonExTrans.trans.rew:
--------------------------------------------------------------------------------
1 | 0 1 10
2 | 1 2 5
3 | 1 3 5.5
4 | 2 3 21.4
5 | 2 4 4
6 | 2 5 2
7 | 3 3 1
8 | 4 3 1
9 | 5 3 0.1
10 | 5 4 1.1
11 | 5 5 9.5
12 | 5 6 6.7
13 | 6 0 1
14 | 6 4 42
15 | 6 5 0
16 | 6 6 12
17 | 7 6 35.224653
18 | 7 7 9.875347
19 |
--------------------------------------------------------------------------------
/lib/stormpy/examples/files/rew/dtmc_whitespaces.trans.rew:
--------------------------------------------------------------------------------
1 |
2 |
3 | 0 1 10
4 | 1 2 5
5 | 1 3 5.5
6 | 2 3 21.4
7 | 2 4 4
8 | 2 5 2
9 | 3 3 1
10 | 4 3 1
11 | 5 3 0.1
12 |
13 |
14 | 5 4 1.1
15 | 5 5 9.5
16 | 5 6 6.7
17 | 6 0 1
18 | 6 5 0
19 | 6 6 12
20 | 7 6 35.224653
21 | 7 7 9.875347
22 |
23 |
24 |
--------------------------------------------------------------------------------
/lib/stormpy/examples/files/rew/ma_general.state.rew:
--------------------------------------------------------------------------------
1 | 0 0
2 | 1 1.75774
3 | 2 5.436563657
4 | 3 1.570796327
5 | 4 1000
6 | 5 7
7 |
--------------------------------------------------------------------------------
/lib/stormpy/examples/files/rew/ma_mismatched.state.rew:
--------------------------------------------------------------------------------
1 | 0 0
2 | 1 1.75774
3 | 2 5.436563657
4 | 3 1.570796327
5 | 4 1000
6 | 5 7
7 | 9 42
8 |
--------------------------------------------------------------------------------
/lib/stormpy/examples/files/rew/mdp_general.state.rew:
--------------------------------------------------------------------------------
1 | 0 0
2 | 1 1
3 | 2 2
4 | 3 3.32
5 | 4 42
6 | 5 110
7 |
--------------------------------------------------------------------------------
/lib/stormpy/examples/files/rew/mdp_general.trans.rew:
--------------------------------------------------------------------------------
1 | 0 0 0 1
2 | 0 0 1 30
3 | 0 1 1 15.2
4 | 0 1 2 75
5 | 0 1 5 2.45
6 | 0 2 5 1
7 | 0 3 0 0.114
8 | 0 3 4 90
9 | 1 0 2 1
10 | 2 0 2 55
11 | 2 0 3 87
12 | 3 0 2 13
13 | 3 0 3 999
14 | 4 0 1 0.7
15 | 4 0 4 0.3
16 | 5 0 1 0.1
17 | 5 0 5 6
18 |
--------------------------------------------------------------------------------
/lib/stormpy/examples/files/rew/mdp_mismatched.trans.rew:
--------------------------------------------------------------------------------
1 | 0 0 0 0.9
2 | 0 0 1 0.1
3 | 0 1 1 0.2
4 | 0 1 2 0.2
5 | 0 1 3 0.2
6 | 0 1 4 22
7 | 0 2 4 1
8 | 0 3 0 0.1
9 | 0 3 4 0.9
10 | 1 0 2 1
11 | 2 0 2 55
12 | 2 0 3 0.5
13 | 2 1 2 10
14 | 3 0 2 0.001
15 | 3 0 3 0.999
16 | 4 0 1 0.7
17 | 4 0 3 42
18 | 4 0 4 0.3
19 |
--------------------------------------------------------------------------------
/lib/stormpy/examples/files/rew/mdp_mixedStateOrder.trans.rew:
--------------------------------------------------------------------------------
1 | 0 0 0 1
2 | 0 0 1 30
3 | 0 1 1 15.2
4 | 0 1 2 75
5 | 0 1 5 2.45
6 | 0 2 5 1
7 | 0 3 0 0.114
8 | 0 3 4 90
9 | 2 0 2 55
10 | 2 0 3 87
11 | 1 0 2 1
12 | 3 0 2 13
13 | 3 0 3 999
14 | 4 0 1 0.7
15 | 4 0 4 0.3
16 | 5 0 1 0.1
17 | 5 0 5 6
18 |
--------------------------------------------------------------------------------
/lib/stormpy/examples/files/rew/mdp_mixedTransitionOrder.trans.rew:
--------------------------------------------------------------------------------
1 | 0 0 0 1
2 | 0 0 1 30
3 | 0 1 1 15.2
4 | 0 1 5 2.45
5 | 0 1 2 75
6 | 0 2 5 1
7 | 0 3 0 0.114
8 | 0 3 4 90
9 | 1 0 2 1
10 | 2 0 2 55
11 | 2 0 3 87
12 | 3 0 2 13
13 | 3 0 3 999
14 | 4 0 1 0.7
15 | 4 0 4 0.3
16 | 5 0 1 0.1
17 | 5 0 5 6
18 |
--------------------------------------------------------------------------------
/lib/stormpy/examples/files/rew/mdp_rewardForNonExTrans.trans.rew:
--------------------------------------------------------------------------------
1 | 0 0 0 1
2 | 0 0 1 30
3 | 0 1 1 15.2
4 | 0 1 2 75
5 | 0 1 5 2.45
6 | 0 2 5 1
7 | 0 3 0 0.114
8 | 0 3 4 90
9 | 1 0 2 1
10 | 2 0 2 55
11 | 2 0 3 87
12 | 3 0 2 13
13 | 3 0 3 999
14 | 4 0 1 0.7
15 | 4 0 3 42
16 | 4 0 4 0.3
17 | 5 0 1 0.1
18 | 5 0 5 6
19 |
--------------------------------------------------------------------------------
/lib/stormpy/examples/files/rew/mdp_whitespaces.trans.rew:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 0 0 0 1
5 | 0 0 1 30
6 | 0 1 1 15.2
7 | 0 1 2 75
8 | 0 1 5 2.45
9 | 0 2 5 1
10 | 0 3 0 0.114
11 | 0 3 4 90
12 |
13 |
14 |
15 | 1 0 2 1
16 | 2 0 2 55
17 | 2 0 3 87
18 | 3 0 2 13
19 | 3 0 3 999
20 | 4 0 1 0.7
21 | 4 0 4 0.3
22 | 5 0 1 0.1
23 | 5 0 5 6
24 |
--------------------------------------------------------------------------------
/lib/stormpy/examples/files/rew/state_reward_parser_basic.state.rew:
--------------------------------------------------------------------------------
1 | 0 0.7
2 | 1 17.3364
3 | 2 22.9857
4 | 3 30.2161
5 | 4 39.3341
6 | 5 50.4059
7 | 6 63.4541
8 | 7 78.4887
9 | 8 95.5148
10 | 9 114.535
11 | 10 135.551
12 | 11 158.565
13 | 12 183.576
14 | 13 210.585
15 | 14 239.594
16 | 15 270.601
17 | 16 303.607
18 | 17 338.612
19 | 18 375.617
20 | 19 414.621
21 | 20 455.625
22 | 21 498.629
23 | 22 543.632
24 | 23 590.635
25 | 24 639.638
26 | 25 690.64
27 | 26 743.643
28 | 27 798.645
29 | 28 855.647
30 | 29 914.648
31 | 30 975.65
32 | 31 1038.65
33 | 32 1103.65
34 | 33 1170.65
35 | 34 1239.66
36 | 35 1310.66
37 | 36 1383.66
38 | 37 1458.66
39 | 38 1535.66
40 | 39 1614.66
41 | 40 1695.66
42 | 41 1778.66
43 | 42 1863.66
44 | 43 1950.67
45 | 44 2039.67
46 | 45 2130.67
47 | 46 2223.67
48 | 47 2318.67
49 | 48 2415.67
50 | 49 2514.67
51 | 50 2615.67
52 | 51 2718.67
53 | 52 2823.67
54 | 53 2930.67
55 | 54 3039.67
56 | 55 3150.67
57 | 56 3263.67
58 | 57 3378.67
59 | 58 3495.67
60 | 59 3614.67
61 | 60 3735.68
62 | 61 3858.68
63 | 62 3983.68
64 | 63 4110.68
65 | 64 4239.68
66 | 65 4370.68
67 | 66 4503.68
68 | 67 4638.68
69 | 68 4775.68
70 | 69 4914.68
71 | 70 5055.68
72 | 71 5198.68
73 | 72 5343.68
74 | 73 5490.68
75 | 74 5639.68
76 | 75 5790.68
77 | 76 5943.68
78 | 77 6098.68
79 | 78 6255.68
80 | 79 6414.68
81 | 80 6575.68
82 | 81 6738.68
83 | 82 6903.68
84 | 83 7070.68
85 | 84 7239.68
86 | 85 7410.68
87 | 86 7583.68
88 | 87 7758.68
89 | 88 7935.68
90 | 89 8114.68
91 | 90 8295.68
92 | 91 8478.68
93 | 92 8663.68
94 | 93 8850.68
95 | 94 9039.68
96 | 95 9230.68
97 | 96 9423.68
98 | 97 9618.68
99 | 98 9815.68
100 | 99 10014.7
101 |
--------------------------------------------------------------------------------
/lib/stormpy/examples/files/rew/state_reward_parser_doubledLines.state.rew:
--------------------------------------------------------------------------------
1 | 0 0.7
2 | 1 17.3364
3 | 2 22.9857
4 | 2 587.998
5 | 3 30.2161
6 | 4 39.3341
7 | 5 50.4059
8 | 6 63.4541
9 | 7 78.4887
10 | 8 95.5148
11 | 9 114.535
12 | 10 135.551
13 |
--------------------------------------------------------------------------------
/lib/stormpy/examples/files/rew/state_reward_parser_doubledLinesSkipped.state.rew:
--------------------------------------------------------------------------------
1 | 0 0.7
2 | 1 17.3364
3 | 2 22.9857
4 | 4 39.3341
5 | 3 30.2161
6 | 5 50.4059
7 | 6 63.4541
8 | 7 78.4887
9 | 8 95.5148
10 | 9 114.535
11 | 10 135.551
12 |
--------------------------------------------------------------------------------
/lib/stormpy/examples/files/rew/two_dice.flip.state.rew:
--------------------------------------------------------------------------------
1 | 0 1
2 | 1 1
3 | 2 1
4 | 3 1
5 | 4 1
6 | 5 1
7 | 6 1
8 | 7 1
9 | 8 1
10 | 9 1
11 | 10 1
12 | 11 1
13 | 12 1
14 | 13 1
15 | 14 1
16 | 15 1
17 | 16 1
18 | 17 1
19 | 18 1
20 | 19 1
21 | 20 1
22 | 21 1
23 | 22 1
24 | 23 1
25 | 24 1
26 | 25 1
27 | 26 1
28 | 27 1
29 | 28 1
30 | 29 1
31 | 30 1
32 | 31 1
33 | 32 1
34 | 33 1
35 | 34 1
36 | 35 1
37 | 36 1
38 | 37 1
39 | 38 1
40 | 39 1
41 | 40 1
42 | 41 1
43 | 42 1
44 | 43 1
45 | 44 1
46 | 45 1
47 | 46 1
48 | 47 1
49 | 48 1
50 | 49 1
51 | 50 1
52 | 51 1
53 | 52 1
54 | 53 1
55 | 54 1
56 | 55 1
57 | 56 1
58 | 57 1
59 | 58 1
60 | 59 1
61 | 60 1
62 | 61 1
63 | 62 1
64 | 63 1
65 | 64 1
66 | 65 1
67 | 66 1
68 | 67 1
69 | 68 1
70 | 69 1
71 | 70 1
72 | 71 1
73 | 72 1
74 | 73 1
75 | 74 1
76 | 75 1
77 | 76 1
78 | 77 1
79 | 78 1
80 | 79 1
81 | 80 1
82 | 81 1
83 | 82 1
84 | 83 1
85 | 84 1
86 | 85 1
87 | 86 1
88 | 87 1
89 | 88 1
90 | 89 1
91 | 90 1
92 | 91 1
93 | 92 1
94 | 93 1
95 | 94 1
96 | 95 1
97 | 96 1
98 | 97 1
99 | 104 1
100 | 105 1
101 | 106 1
102 | 107 1
103 | 108 1
104 | 109 1
105 | 110 1
106 | 117 1
107 | 118 1
108 | 119 1
109 | 120 1
110 | 121 1
111 | 122 1
112 | 123 1
113 | 130 1
114 | 131 1
115 | 132 1
116 | 133 1
117 | 134 1
118 | 135 1
119 | 136 1
120 | 143 1
121 | 144 1
122 | 145 1
123 | 146 1
124 | 147 1
125 | 148 1
126 | 149 1
127 | 156 1
128 | 157 1
129 | 158 1
130 | 159 1
131 | 160 1
132 | 161 1
133 | 162 1
134 |
--------------------------------------------------------------------------------
/lib/stormpy/examples/files/smg/example_smg.nm:
--------------------------------------------------------------------------------
1 | // taken from Julia Eisentraut "Value iteration for simple stochastic games: Stopping criterion
2 | // and learning algorithm" - Fig. 1
3 |
4 |
5 | smg
6 |
7 | const double p = 2/3;
8 |
9 | player maxP
10 | [q_action1], [q_action2], [loop]
11 | endplayer
12 |
13 | player minP
14 | [p_action1]
15 | endplayer
16 |
17 | player sinkstates
18 | state_space
19 | endplayer
20 |
21 |
22 | module state_space
23 | s : [0..3];
24 |
25 | [p_action1] s=0 -> (s'=1);
26 |
27 | [q_action1] s=1 -> (s'=0);
28 | [q_action2] s=1 -> (1-p) : (s'=1) + (p/2) : (s'=2) + (p/2) : (s'=3);
29 |
30 | [loop] s=2 -> true;
31 | [loop] s=3 -> true;
32 | endmodule
33 |
34 | label "goal" = s=2;
35 |
--------------------------------------------------------------------------------
/lib/stormpy/examples/files/tra/csl_general.tra:
--------------------------------------------------------------------------------
1 | dtmc
2 | 0 1 1.0
3 | 1 1 0.080645161290322580645161290322581
4 | 1 2 0.080645161290322580645161290322581
5 | 2 1 0.04032258064516129032258064516129
6 | 2 2 0.04032258064516129032258064516129
7 | 2 3 0.04032258064516129032258064516129
8 | 2 4 0.04032258064516129032258064516129
9 | 3 2 0.080645161290322580645161290322581
10 | 3 4 0.080645161290322580645161290322581
11 | 4 0 1.0
--------------------------------------------------------------------------------
/lib/stormpy/examples/files/tra/ctmc.tra:
--------------------------------------------------------------------------------
1 | cTmC
2 | 0 0 10
3 | 0 1 13
4 | 0 2 42
5 | 0 3 11
6 | 0 4 19.6
7 | 1 1 32.8
8 | 1 2 0.5
9 | 1 5 0.5
10 | 2 1 0.5
11 | 2 2 0.0
12 | 2 7 0.5
13 | 3 3 0.2
14 | 3 4 0.4
15 | 3 9 0.4
16 | 4 3 0.4
17 | 4 4 0.2
18 | 4 9 0.4
19 | 5 5 0.0
20 | 5 6 1.0
21 | 6 6 0.0
22 | 6 9 1.0
23 | 7 7 0.0
24 | 7 8 1000.0
25 | 8 8 0.0
26 | 9 9 0.8
27 | 9 10 0.1
28 | 9 11 0.1
29 | 10 10 0.9
30 | 10 11 0.1
31 | 11 10 0.1
32 | 11 11 0.9
33 |
--------------------------------------------------------------------------------
/lib/stormpy/examples/files/tra/ctmdp.tra:
--------------------------------------------------------------------------------
1 | cTMdP
2 | 0 0 0 0.6
3 | 0 0 1 0.1
4 | 0 0 2 0.1
5 | 0 0 3 0.1
6 | 0 0 4 0.1
7 | 0 1 0 0.0
8 | 0 1 6 1.0
9 | 1 0 1 0.0
10 | 1 0 2 0.5
11 | 1 0 5 0.5
12 | 1 1 1 0.0
13 | 1 1 8 1.0
14 | 2 0 1 0.5
15 | 2 0 2 0.0
16 | 2 0 7 0.5
17 | 3 0 3 0.2
18 | 3 0 4 0.4
19 | 3 0 9 0.4
20 | 4 0 3 0.4
21 | 4 0 4 0.2
22 | 4 0 9 0.4
23 | 5 0 5 0.0
24 | 5 0 6 1.0
25 | 6 0 6 0.0
26 | 6 0 9 1.0
27 | 7 0 7 0.0
28 | 7 0 8 1.0
29 | 8 0 8 0.0
30 | 8 0 9 1.0
31 | 9 0 9 1.0
32 | 9 1 10 1.0
33 | 9 2 11 1.0
34 | 10 0 10 0.9
35 | 10 0 11 0.1
36 | 11 0 10 0.1
37 | 11 0 11 0.9
38 |
--------------------------------------------------------------------------------
/lib/stormpy/examples/files/tra/die.tra:
--------------------------------------------------------------------------------
1 | dtmc
2 | 0 1 0.5
3 | 0 2 0.5
4 | 1 3 0.5
5 | 1 4 0.5
6 | 2 5 0.5
7 | 2 6 0.5
8 | 3 1 0.5
9 | 3 7 0.5
10 | 4 8 0.5
11 | 4 9 0.5
12 | 5 10 0.5
13 | 5 11 0.5
14 | 6 2 0.5
15 | 6 12 0.5
16 | 7 7 1
17 | 8 8 1
18 | 9 9 1
19 | 10 10 1
20 | 11 11 1
21 | 12 12 1
22 |
--------------------------------------------------------------------------------
/lib/stormpy/examples/files/tra/dtmc.tra:
--------------------------------------------------------------------------------
1 | dTmC
2 | 0 0 0.6
3 | 0 1 0.1
4 | 0 2 0.1
5 | 0 3 0.1
6 | 0 4 0.1
7 | 1 1 0.0
8 | 1 2 0.5
9 | 1 5 0.5
10 | 2 1 0.5
11 | 2 2 0.0
12 | 2 7 0.5
13 | 3 3 0.2
14 | 3 4 0.4
15 | 3 9 0.4
16 | 4 3 0.4
17 | 4 4 0.2
18 | 4 9 0.4
19 | 5 5 0.0
20 | 5 6 1.0
21 | 6 6 0.0
22 | 6 9 1.0
23 | 7 7 0.0
24 | 7 8 1.0
25 | 8 8 0.0
26 | 8 9 1.0
27 | 9 9 0.8
28 | 9 10 0.1
29 | 9 11 0.1
30 | 10 10 0.9
31 | 10 11 0.1
32 | 11 10 0.1
33 | 11 11 0.9
34 |
--------------------------------------------------------------------------------
/lib/stormpy/examples/files/tra/dtmcWhitespaces1.tra:
--------------------------------------------------------------------------------
1 | dtmc
2 | 0 0 0.6
3 | 0 1 0.1
4 | 0 2 0.1
5 | 0 3 0.1
6 | 0 4 0.1
7 | 1 1 0.0
8 | 1 2 0.5
9 | 1 5 0.5
10 | 2 1 0.5
11 | 2 2 0.0
12 | 2 7 0.5
13 | 3 3 0.2
14 | 3 4 0.4
15 | 3 9 0.4
16 | 4 3 0.4
17 | 4 4 0.2
18 | 4 9 0.4
19 | 5 5 0.0
20 | 5 6 1.0
21 | 6 6 0.0
22 | 6 9 1.0
23 | 7 7 0.0
24 | 7 8 1.0
25 | 8 8 0.0
26 | 8 9 1.0
27 | 9 9 0.8
28 | 9 10 0.1
29 | 9 11 0.1
30 | 10 10 0.9
31 | 10 11 0.1
32 | 11 10 0.1
33 | 11 11 0.9
34 |
--------------------------------------------------------------------------------
/lib/stormpy/examples/files/tra/dtmcWhitespaces2.tra:
--------------------------------------------------------------------------------
1 | dtmc
2 |
3 |
4 |
5 | 0 0 0.6
6 | 0 1 0.1
7 | 0 2 0.1
8 | 0 3 0.1
9 | 0 4 0.1
10 | 1 1 0.0
11 | 1 2 0.5
12 | 1 5 0.5
13 | 2 1 0.5
14 | 2 2 0.0
15 | 2 7 0.5
16 | 3 3 0.2
17 | 3 4 0.4
18 | 3 9 0.4
19 | 4 3 0.4
20 | 4 4 0.2
21 | 4 9 0.4
22 | 5 5 0.0
23 | 5 6 1.0
24 | 6 6 0.0
25 | 6 9 1.0
26 | 7 7 0.0
27 | 7 8 1.0
28 | 8 8 0.0
29 | 8 9 1.0
30 | 9 9 0.8
31 | 9 10 0.1
32 | 9 11 0.1
33 | 10 10 0.9
34 | 10 11 0.1
35 | 11 10 0.1
36 | 11 11 0.9
37 |
--------------------------------------------------------------------------------
/lib/stormpy/examples/files/tra/dtmc_actionTest.tra:
--------------------------------------------------------------------------------
1 | dtmc
2 | 0 0 0
3 | 0 1 0.5
4 | 0 2 0.5
5 | 1 1 0
6 | 1 2 0.5
7 | 1 3 0.5
8 | 2 2 0
9 | 2 3 0.4
10 | 2 5 0.6
11 | 3 3 0.7
12 | 3 4 0.2
13 | 3 6 0.1
14 | 4 2 0.4
15 | 4 3 0.5
16 | 4 4 0
17 | 4 7 0.1
18 | 5 5 1
19 | 6 6 0.8
20 | 6 7 0.2
21 | 7 6 0.1
22 | 7 7 0.9
23 |
--------------------------------------------------------------------------------
/lib/stormpy/examples/files/tra/dtmc_deadlock.tra:
--------------------------------------------------------------------------------
1 | 0 1 1
2 | 1 2 0.5
3 | 1 3 0.5
4 | 2 3 0.4
5 | 2 4 0.4
6 | 2 5 0.2
7 | 3 3 1
8 | 4 3 1
9 | 5 3 0.1
10 | 5 4 0.1
11 | 5 5 0.1
12 | 5 6 0.7
13 | 6 0 0.9
14 | 6 5 0
15 | 6 6 0.1
16 | 8 6 0.224653
17 | 8 7 0.775347
18 |
--------------------------------------------------------------------------------
/lib/stormpy/examples/files/tra/dtmc_doubledLines.tra:
--------------------------------------------------------------------------------
1 | dTmC
2 | 0 1 1
3 | 1 2 0.5
4 | 1 3 0.5
5 | 2 3 0.4
6 | 2 4 0.4
7 | 2 5 0.2
8 | 3 3 1
9 | 4 3 1
10 | 4 3 1
11 | 5 3 0.1
12 | 5 4 0.1
13 | 5 5 0.1
14 | 5 6 0.7
15 | 5 3 0.1
16 | 6 0 0.9
17 | 6 5 0
18 | 6 6 0.1
19 | 7 6 0.224653
20 | 7 7 0.775347
21 |
--------------------------------------------------------------------------------
/lib/stormpy/examples/files/tra/dtmc_general.tra:
--------------------------------------------------------------------------------
1 | dTmC
2 | 0 1 1
3 | 1 2 0.5
4 | 1 3 0.5
5 | 2 3 0.4
6 | 2 4 0.4
7 | 2 5 0.2
8 | 3 3 1
9 | 4 3 1
10 | 5 3 0.1
11 | 5 4 0.1
12 | 5 5 0.1
13 | 5 6 0.7
14 | 6 0 0.9
15 | 6 5 0
16 | 6 6 0.1
17 | 7 6 0.224653
18 | 7 7 0.775347
19 |
--------------------------------------------------------------------------------
/lib/stormpy/examples/files/tra/dtmc_mismatched.tra:
--------------------------------------------------------------------------------
1 | dTmC
2 | 0 1 1
3 | 1 2 0.5
4 | 1 3 0.5
5 | 2 3 0.4
6 | 2 4 0.4
7 | 2 5 0.2
8 | 3 3 1
9 | 4 3 1
10 | 5 3 0.1
11 | 5 4 0.1
12 | 5 5 0.1
13 | 5 6 0.7
14 | 6 0 0.9
15 | 6 5 0
16 | 6 6 0.1
17 |
--------------------------------------------------------------------------------
/lib/stormpy/examples/files/tra/dtmc_mixedStateOrder.tra:
--------------------------------------------------------------------------------
1 | dTmC
2 | 0 1 1
3 | 1 2 0.5
4 | 1 3 0.5
5 | 2 3 0.4
6 | 2 4 0.4
7 | 2 5 0.2
8 | 3 3 1
9 | 5 3 0.1
10 | 5 4 0.1
11 | 5 5 0.1
12 | 5 6 0.7
13 | 4 3 1
14 | 6 0 0.9
15 | 6 5 0
16 | 6 6 0.1
17 | 7 6 0.224653
18 | 7 7 0.775347
19 |
--------------------------------------------------------------------------------
/lib/stormpy/examples/files/tra/dtmc_mixedTransitionOrder.tra:
--------------------------------------------------------------------------------
1 | dTmC
2 | 0 1 1
3 | 1 3 0.5
4 | 1 2 0.5
5 | 2 5 0.2
6 | 2 3 0.4
7 | 2 4 0.4
8 | 3 3 1
9 | 4 3 1
10 | 5 6 0.7
11 | 5 3 0.1
12 | 5 5 0.1
13 | 5 4 0.1
14 | 6 0 0.9
15 | 6 5 0
16 | 6 6 0.1
17 | 7 7 0.775347
18 | 7 6 0.224653
19 |
--------------------------------------------------------------------------------
/lib/stormpy/examples/files/tra/dtmc_whitespaces.tra:
--------------------------------------------------------------------------------
1 | dTmC
2 |
3 |
4 |
5 |
6 | 0 1 1
7 | 1 2 0.5
8 | 1 3 0.5
9 | 2 3 0.4
10 | 2 4 0.4
11 | 2 5 0.2
12 | 3 3 1
13 | 4 3 1
14 | 5 3 0.1
15 | 5 4 0.1
16 | 5 5 0.1
17 | 5 6 0.7
18 |
19 |
20 | 6 0 0.9
21 | 6 5 0
22 | 6 6 0.1
23 | 7 6 0.224653
24 | 7 7 0.775347
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/lib/stormpy/examples/files/tra/ma.tra:
--------------------------------------------------------------------------------
1 | mA
2 | 0 !
3 | * 0 0
4 | * 1 12
5 | * 2 12
6 | * 3 10
7 | * 4 10
8 | 1 d1
9 | * 1 0.0
10 | * 2 0.5
11 | * 5 0.5
12 | 2 d2
13 | * 1 0.5
14 | * 2 0.0
15 | * 7 0.5
16 | 2 !!
17 | * 0 0.1
18 | * 1 0.9
19 | * 2 0.0
20 | 3 !
21 | * 3 2
22 | * 4 4
23 | * 9 4
24 | 4 !
25 | * 3 4
26 | * 4 2
27 | * 9 4
28 | 5 d3
29 | * 5 0.0
30 | * 6 1.0
31 | 6 d4
32 | * 6 0.0
33 | * 9 1.0
34 | 7 d5
35 | * 7 0.0
36 | * 8 1.0
37 | 8 d6
38 | * 8 0.0
39 | * 9 1.0
40 | 9 !
41 | * 9 8
42 | * 10 1
43 | * 11 1
44 | 10 !
45 | * 10 9
46 | * 11 1
47 | 11 !
48 | * 10 1
49 | * 11 9
50 |
--------------------------------------------------------------------------------
/lib/stormpy/examples/files/tra/ma_cslFilterTest.tra:
--------------------------------------------------------------------------------
1 | ma
2 | 0 a
3 | * 1 0.5
4 | * 2 0.5
5 | 0 b
6 | * 0 0.5
7 | * 3 0.5
8 | 1 !
9 | * 2 1
10 | * 4 5
11 | * 7 2
12 | 2 a
13 | * 2 1
14 | 2 b
15 | * 5 1
16 | 3 a
17 | * 2 0.1
18 | * 3 0.9
19 | 4 !
20 | * 2 1
21 | * 3 0.1
22 | * 6 5
23 | * 7 10
24 | 5 !
25 | * 4 1
26 | * 6 5
27 | 6 tau
28 | * 6 1
29 | 7 !
30 | * 7 10
31 |
--------------------------------------------------------------------------------
/lib/stormpy/examples/files/tra/ma_deadlock.tra:
--------------------------------------------------------------------------------
1 | ma
2 | 0 !
3 | * 1 2
4 | 1 aBBa
5 | * 2 1
6 | 2 !
7 | * 0 1
8 | * 1 2
9 | * 3 4
10 | * 4 8
11 | 3 2a
12 | * 2 0.5
13 | * 3 0.5
14 | 4 2
15 | * 3 1
16 | 4 !3
17 | * 5 0.5
18 | * 6 0.5
19 | 6 &a3_
20 | * 5 1
21 |
--------------------------------------------------------------------------------
/lib/stormpy/examples/files/tra/ma_general.tra:
--------------------------------------------------------------------------------
1 | ma
2 | 0 !
3 | * 1 2
4 | 1 aBBa
5 | * 2 1
6 | 2 !
7 | * 0 1
8 | * 1 2
9 | * 3 4
10 | * 4 8
11 | 3 2a
12 | * 2 0.5
13 | * 3 0.5
14 | 4 2
15 | * 3 1
16 | 4 !3
17 | * 1 0.5
18 | * 5 0.5
19 | 5 &a3_
20 | * 5 1
21 |
--------------------------------------------------------------------------------
/lib/stormpy/examples/files/tra/ma_whitespaces.tra:
--------------------------------------------------------------------------------
1 | ma
2 | 0 !
3 | * 1 2
4 | 1 a
5 | * 2 1
6 | 2 !
7 | * 0 1
8 | * 1 2
9 | * 3 4
10 | * 4 8
11 |
12 | 3 a
13 | * 2 0.5
14 | * 3 0.5
15 | 4 a
16 | * 3 1
17 | 4 b
18 |
19 | * 1 0.5
20 | * 5 0.5
21 | 5 a
22 | * 5 1
23 |
24 |
--------------------------------------------------------------------------------
/lib/stormpy/examples/files/tra/mdp.tra:
--------------------------------------------------------------------------------
1 | MdP
2 | 0 0 0 0.6
3 | 0 0 1 0.1
4 | 0 0 2 0.1
5 | 0 0 3 0.1
6 | 0 0 4 0.1
7 | 0 1 0 0.0
8 | 0 1 6 1.0
9 | 1 0 1 0.0
10 | 1 0 2 0.5
11 | 1 0 5 0.5
12 | 1 1 1 0.0
13 | 1 1 8 1.0
14 | 2 0 1 0.5
15 | 2 0 2 0.0
16 | 2 0 7 0.5
17 | 3 0 3 0.2
18 | 3 0 4 0.4
19 | 3 0 9 0.4
20 | 4 0 3 0.4
21 | 4 0 4 0.2
22 | 4 0 9 0.4
23 | 5 0 5 0.0
24 | 5 0 6 1.0
25 | 6 0 6 0.0
26 | 6 0 9 1.0
27 | 7 0 7 0.0
28 | 7 0 8 1.0
29 | 8 0 8 0.0
30 | 8 0 9 1.0
31 | 9 0 9 1.0
32 | 9 1 10 1.0
33 | 9 2 11 1.0
34 | 10 0 10 0.9
35 | 10 0 11 0.1
36 | 11 0 10 0.1
37 | 11 0 11 0.9
38 |
--------------------------------------------------------------------------------
/lib/stormpy/examples/files/tra/mdp_deadlock.tra:
--------------------------------------------------------------------------------
1 | mdp
2 | 0 0 0 0.9
3 | 0 0 1 0.1
4 | 0 1 1 0.2
5 | 0 1 2 0.2
6 | 0 1 3 0.2
7 | 0 1 4 0.2
8 | 0 1 5 0.2
9 | 0 2 5 1
10 | 0 3 0 0.1
11 | 0 3 4 0.9
12 | 1 0 2 1
13 | 2 0 2 0.5
14 | 2 0 3 0.5
15 | 2 1 2 1
16 | 3 0 2 0.001
17 | 3 0 3 0.999
18 | 4 0 1 0.7
19 | 4 0 4 0.3
20 | 6 0 1 0.2
21 | 6 0 4 0.2
22 | 6 0 5 0.6
23 | 6 1 5 1
24 |
--------------------------------------------------------------------------------
/lib/stormpy/examples/files/tra/mdp_doubledLines.tra:
--------------------------------------------------------------------------------
1 | mdp
2 | 0 0 0 0.9
3 | 0 0 1 0.1
4 | 0 1 1 0.2
5 | 0 1 2 0.2
6 | 0 1 3 0.2
7 | 0 1 4 0.2
8 | 0 1 4 0.2
9 | 0 1 5 0.2
10 | 0 2 5 1
11 | 0 3 0 0.1
12 | 0 3 4 0.9
13 | 1 0 2 1
14 | 0 1 4 0.2
15 | 2 0 2 0.5
16 | 2 0 3 0.5
17 | 2 1 2 1
18 | 3 0 2 0.001
19 | 3 0 3 0.999
20 | 4 0 1 0.7
21 | 4 0 4 0.3
22 | 5 0 1 0.2
23 | 5 0 4 0.2
24 | 5 0 5 0.6
25 | 5 1 5 1
26 |
--------------------------------------------------------------------------------
/lib/stormpy/examples/files/tra/mdp_general.tra:
--------------------------------------------------------------------------------
1 | mdp
2 | 0 0 0 0.9
3 | 0 0 1 0.1
4 | 0 1 1 0.2
5 | 0 1 2 0.2
6 | 0 1 3 0.2
7 | 0 1 4 0.2
8 | 0 1 5 0.2
9 | 0 2 5 1
10 | 0 3 0 0.1
11 | 0 3 4 0.9
12 | 1 0 2 1
13 | 2 0 2 0.5
14 | 2 0 3 0.5
15 | 2 1 2 1
16 | 3 0 2 0.001
17 | 3 0 3 0.999
18 | 4 0 1 0.7
19 | 4 0 4 0.3
20 | 5 0 1 0.2
21 | 5 0 4 0.2
22 | 5 0 5 0.6
23 | 5 1 5 1
24 |
--------------------------------------------------------------------------------
/lib/stormpy/examples/files/tra/mdp_mismatched.tra:
--------------------------------------------------------------------------------
1 | mdp
2 | 0 0 0 0.9
3 | 0 0 1 0.1
4 | 0 1 1 0.2
5 | 0 1 2 0.2
6 | 0 1 3 0.2
7 | 0 1 4 0.2
8 | 0 2 4 1
9 | 0 3 0 0.1
10 | 0 3 4 0.9
11 | 1 0 2 1
12 | 2 0 2 0.5
13 | 2 0 3 0.5
14 | 2 1 2 1
15 | 3 0 2 0.001
16 | 3 0 3 0.999
17 | 4 0 1 0.7
18 | 4 0 4 0.3
19 |
--------------------------------------------------------------------------------
/lib/stormpy/examples/files/tra/mdp_mixedStateOrder.tra:
--------------------------------------------------------------------------------
1 | mdp
2 | 0 0 0 0.9
3 | 0 0 1 0.1
4 | 0 1 1 0.2
5 | 0 1 2 0.2
6 | 0 1 3 0.2
7 | 0 1 4 0.2
8 | 0 1 5 0.2
9 | 0 2 5 1
10 | 0 3 0 0.1
11 | 0 3 4 0.9
12 | 2 0 2 0.5
13 | 2 0 3 0.5
14 | 2 1 2 1
15 | 1 0 2 1
16 | 3 0 2 0.001
17 | 3 0 3 0.999
18 | 4 0 1 0.7
19 | 4 0 4 0.3
20 | 5 0 1 0.2
21 | 5 0 4 0.2
22 | 5 0 5 0.6
23 | 5 1 5 1
24 |
--------------------------------------------------------------------------------
/lib/stormpy/examples/files/tra/mdp_mixedTransitionOrder.tra:
--------------------------------------------------------------------------------
1 | mdp
2 | 0 0 0 0.9
3 | 0 0 1 0.1
4 | 0 1 1 0.2
5 | 0 1 3 0.2
6 | 0 1 2 0.2
7 | 0 1 4 0.2
8 | 0 1 5 0.2
9 | 0 2 5 1
10 | 0 3 0 0.1
11 | 0 3 4 0.9
12 | 1 0 2 1
13 | 2 0 2 0.5
14 | 2 0 3 0.5
15 | 2 1 2 1
16 | 3 0 2 0.001
17 | 3 0 3 0.999
18 | 4 0 1 0.7
19 | 4 0 4 0.3
20 | 5 0 1 0.2
21 | 5 0 4 0.2
22 | 5 0 5 0.6
23 | 5 1 5 1
24 |
--------------------------------------------------------------------------------
/lib/stormpy/examples/files/tra/mdp_whitespaces.tra:
--------------------------------------------------------------------------------
1 | mdp
2 |
3 |
4 | 0 0 0 0.9
5 |
6 |
7 | 0 0 1 0.1
8 | 0 1 1 0.2
9 | 0 1 2 0.2
10 | 0 1 3 0.2
11 | 0 1 4 0.2
12 | 0 1 5 0.2
13 | 0 2 5 1
14 | 0 3 0 0.1
15 | 0 3 4 0.9
16 | 1 0 2 1
17 | 2 0 2 0.5
18 | 2 0 3 0.5
19 | 2 1 2 1
20 |
21 | 3 0 2 0.001
22 | 3 0 3 0.999
23 | 4 0 1 0.7
24 | 4 0 4 0.3
25 | 5 0 1 0.2
26 | 5 0 4 0.2
27 | 5 0 5 0.6
28 | 5 1 5 1
29 |
--------------------------------------------------------------------------------
/lib/stormpy/examples/files/tra/noHint.tra:
--------------------------------------------------------------------------------
1 | 0 0 0.6
2 | 0 1 0.1
3 | 0 2 0.1
4 | 0 3 0.1
5 | 0 4 0.1
6 | 1 1 0.0
7 | 1 2 0.5
8 | 1 5 0.5
9 | 2 1 0.5
10 | 2 2 0.0
11 | 2 7 0.5
12 | 3 3 0.2
13 | 3 4 0.4
14 | 3 9 0.4
15 | 4 3 0.4
16 | 4 4 0.2
17 | 4 9 0.4
18 | 5 5 0.0
19 | 5 6 1.0
20 | 6 6 0.0
21 | 6 9 1.0
22 | 7 7 0.0
23 | 7 8 1.0
24 | 8 8 0.0
25 | 8 9 1.0
26 | 9 9 0.8
27 | 9 10 0.1
28 | 9 11 0.1
29 | 10 10 0.9
30 | 10 11 0.1
31 | 11 10 0.1
32 | 11 11 0.9
33 |
--------------------------------------------------------------------------------
/lib/stormpy/examples/files/tra/pctl_general.tra:
--------------------------------------------------------------------------------
1 | dtmc
2 | 0 1 1.0
3 | 1 1 0.0
4 | 1 3 0.5
5 | 1 4 0.5
6 | 2 1 0.3
7 | 2 2 0.0
8 | 2 7 0.7
9 | 3 2 0.05
10 | 3 3 0.7
11 | 3 6 0.05
12 | 3 8 0.2
13 | 4 1 0.3
14 | 4 4 0.0
15 | 4 5 0.3
16 | 4 6 0.4
17 | 5 4 1.0
18 | 5 5 0.0
19 | 6 6 0.0
20 | 6 7 1.0
21 | 7 2 0.2
22 | 7 6 0.8
23 | 8 9 1
24 | 9 8 0.3
25 | 9 9 0.7
26 | 10 4 1.0
27 | 11 5 0.7
28 | 11 9 0.3
--------------------------------------------------------------------------------
/lib/stormpy/examples/files/tra/readme.txt:
--------------------------------------------------------------------------------
1 | Note: *.tra-Files starting with "wrong_format" are to produce an error when
2 | being parsed. Hence, spelling errors and wrong formats are on purpose.
3 | DO NOT CORRECT THEM!
--------------------------------------------------------------------------------
/lib/stormpy/examples/files/tra/tiny1.tra:
--------------------------------------------------------------------------------
1 | ma
2 | 0 a
3 | * 1 1
4 | 0 b
5 | * 2 1
6 | 1 !
7 | * 3 4
8 | * 4 4
9 | 2 a
10 | * 3 0.5
11 | * 8 0.5
12 | 3 !
13 | * 8 6
14 | * 9 3
15 | 4 b
16 | * 5 1
17 | 4 c
18 | * 7 1
19 | 5 !
20 | * 7 20
21 | 6 a
22 | * 5 1
23 | 7 !
24 | * 4 5
25 | * 6 5
26 | 8 !
27 | * 9 4
28 | 9 a
29 | * 8 0.5
30 | * 10 0.5
31 | 9 b
32 | * 3 0.5
33 | * 8 0.5
34 | 10 !
35 | * 8 2
36 |
--------------------------------------------------------------------------------
/lib/stormpy/examples/files/tra/tiny2.tra:
--------------------------------------------------------------------------------
1 | ma
2 | 0 a
3 | * 1 1
4 | 0 b
5 | * 2 1
6 | 1 !
7 | * 3 4
8 | * 4 4
9 | 2 a
10 | * 3 0.5
11 | * 8 0.5
12 | 3 !
13 | * 8 6
14 | * 9 3
15 | 4 b
16 | * 5 1
17 | 4 c
18 | * 7 1
19 | 5 !
20 | * 7 20
21 | 6 a
22 | * 5 1
23 | 7 !
24 | * 4 5
25 | * 6 5
26 | 8 !
27 | * 9 4
28 | 9 a
29 | * 1 0.5
30 | * 10 0.5
31 | 9 b
32 | * 1 0.5
33 | * 8 0.5
34 | 10 !
35 | * 8 2
36 |
--------------------------------------------------------------------------------
/lib/stormpy/examples/files/tra/wrongHint.tra:
--------------------------------------------------------------------------------
1 | DiscreteTimeMarkovChain
2 | 0 0 0.6
3 | 0 1 0.1
4 | 0 2 0.1
5 | 0 3 0.1
6 | 0 4 0.1
7 | 1 1 0.0
8 | 1 2 0.5
9 | 1 5 0.5
10 | 2 1 0.5
11 | 2 2 0.0
12 | 2 7 0.5
13 | 3 3 0.2
14 | 3 4 0.4
15 | 3 9 0.4
16 | 4 3 0.4
17 | 4 4 0.2
18 | 4 9 0.4
19 | 5 5 0.0
20 | 5 6 1.0
21 | 6 6 0.0
22 | 6 9 1.0
23 | 7 7 0.0
24 | 7 8 1.0
25 | 8 8 0.0
26 | 8 9 1.0
27 | 9 9 0.8
28 | 9 10 0.1
29 | 9 11 0.1
30 | 10 10 0.9
31 | 10 11 0.1
32 | 11 10 0.1
33 | 11 11 0.9
34 |
--------------------------------------------------------------------------------
/lib/stormpy/examples/files/tra/wrong_format_header1.tra:
--------------------------------------------------------------------------------
1 | dtmc
2 | STATSE 2
3 | TRANSITOINS 1
4 | 1 2 0.5
5 |
--------------------------------------------------------------------------------
/lib/stormpy/examples/files/tra/wrong_format_header2.tra:
--------------------------------------------------------------------------------
1 | dtmc
2 | STATES 0.2
3 | TRANSITOINS 1
4 | 1 2 0.5
5 |
--------------------------------------------------------------------------------
/lib/stormpy/examples/files/tra/wrong_format_transition.tra:
--------------------------------------------------------------------------------
1 | dtmc
2 | STATES 5
3 | TRANSITIONS 5
4 | 0.5 1 2
5 | 2 1 0.9
6 | 2 3 0.2
7 | 3 4 0.5
8 | 4 3 0.1
--------------------------------------------------------------------------------
/lib/stormpy/examples/files/txt/testStringFile.txt:
--------------------------------------------------------------------------------
1 | This is a test string.
2 |
--------------------------------------------------------------------------------
/lib/stormpy/exceptions/__init__.py:
--------------------------------------------------------------------------------
1 | class StormError(Exception):
2 | """
3 | Base class for exceptions in Storm.
4 | """
5 |
6 | def __init__(self, message):
7 | """
8 | Constructor.
9 | :param message: Error message.
10 | """
11 | self.message = "Storm: " + message
12 |
--------------------------------------------------------------------------------
/lib/stormpy/gspn/__init__.py:
--------------------------------------------------------------------------------
1 | from stormpy import _config
2 |
3 | if not _config.storm_with_gspn:
4 | raise ImportError("No support for GSPNs was built in Storm.")
5 |
6 | from . import gspn
7 | from .gspn import *
8 |
--------------------------------------------------------------------------------
/lib/stormpy/info/__init__.py:
--------------------------------------------------------------------------------
1 | from . import info
2 | from .info import *
3 |
4 | from . import _config
5 |
6 |
7 | def storm_version():
8 | """
9 | Get storm version.
10 | :return: Storm version
11 | """
12 | return _config.storm_version
13 |
14 |
15 | def storm_exact_use_cln():
16 | """
17 | Check if exact arithmetic in Storm uses CLN.
18 | :return: True if exact arithmetic uses CLN.
19 | """
20 | return _config.storm_cln_ea
21 |
22 |
23 | def storm_ratfunc_use_cln():
24 | """
25 | Check if rational functions in Storm use CLN.
26 | :return: True iff rational functions use CLN.
27 | """
28 | return _config.storm_cln_rf
29 |
--------------------------------------------------------------------------------
/lib/stormpy/logic/__init__.py:
--------------------------------------------------------------------------------
1 | from . import logic
2 | from .logic import *
3 |
--------------------------------------------------------------------------------
/lib/stormpy/pycarl/__init__.py:
--------------------------------------------------------------------------------
1 | import sys
2 |
3 | if sys.version_info[0] == 2:
4 | raise ImportError("Python 2.x is not supported for pycarl.")
5 |
6 | from . import pycarl_core
7 | from .pycarl_core import *
8 | from . import infinity
9 | from stormpy.pycarl import _config
10 |
11 | __version__ = "unknown"
12 | try:
13 | from ._version import __version__
14 | except ImportError:
15 | # We're running in a tree that doesn't have a _version.py, so we don't know what our version is.
16 | pass
17 |
18 | inf = infinity.Infinity()
19 |
20 |
21 | def carl_version():
22 | """
23 | Get Carl version.
24 | :return: Version of Carl.
25 | """
26 | return _config.CARL_VERSION
27 |
28 |
29 | def has_cln():
30 | """
31 | Check if pycarl has support for CLN.
32 | :return: True iff CLN is supported.
33 | """
34 | return _config.CARL_WITH_CLN
35 |
36 |
37 | def has_parser():
38 | """
39 | Check if pycarl has parsing support.
40 | :return: True iff parsing is supported.
41 | """
42 | return _config.CARL_WITH_PARSER
43 |
44 |
45 | def print_info():
46 | """
47 | Print information about pycarl.
48 | """
49 | print("Pycarl version {}".format(__version__))
50 | print("Using carl in version {}".format(carl_version()))
51 | print("Support for CLN: {}".format(has_cln()))
52 | print("Support for parsing: {}".format(has_parser()))
53 |
54 |
55 | def clear_pools():
56 | """
57 | Clear all pools.
58 | """
59 | # clear_monomial_pool()
60 | clear_variable_pool()
61 |
--------------------------------------------------------------------------------
/lib/stormpy/pycarl/_version.py:
--------------------------------------------------------------------------------
1 | __version__ = "2.3.0"
2 |
--------------------------------------------------------------------------------
/lib/stormpy/pycarl/cln/__init__.py:
--------------------------------------------------------------------------------
1 | from stormpy.pycarl import _config
2 |
3 | if not _config.CARL_WITH_CLN:
4 | raise ImportError("CLN is not available in the configured carl library! Did you configure carl with -DUSE_CLN_NUMBERS=ON?")
5 | from . import cln
6 | from .cln import *
7 |
8 |
9 | def numerator(x):
10 | if type(x) == cln.RationalFunction or type(x) == cln.Rational or type(x) == cln.FactorizedRationalFunction:
11 | return x.numerator
12 | else:
13 | return x
14 |
15 |
16 | def denominator(x):
17 | if type(x) == cln.RationalFunction or type(x) == cln.Rational or type(x) == cln.FactorizedRationalFunction:
18 | return x.denominator
19 | else:
20 | return 1
21 |
22 |
23 | def expand(x):
24 | if type(x) == cln.FactorizedRationalFunction:
25 | return x.rational_function()
26 | if type(x) == cln.FactorizedPolynomial:
27 | return x.polynomial()
28 | return x
29 |
30 |
31 | factorization_cache = cln._FactorizationCache()
32 |
33 |
34 | def create_factorized_polynomial(polynomial):
35 | return cln.FactorizedPolynomial(polynomial, factorization_cache)
36 |
--------------------------------------------------------------------------------
/lib/stormpy/pycarl/cln/formula/__init__.py:
--------------------------------------------------------------------------------
1 | from . import formula
2 | from .formula import *
3 |
--------------------------------------------------------------------------------
/lib/stormpy/pycarl/cln/parse/__init__.py:
--------------------------------------------------------------------------------
1 | from stormpy.pycarl import _config
2 |
3 | if not _config.CARL_WITH_PARSER:
4 | raise ImportError("Parser is not available!")
5 |
6 | from . import parse
7 | from .parse import *
8 |
--------------------------------------------------------------------------------
/lib/stormpy/pycarl/convert/__init__.py:
--------------------------------------------------------------------------------
1 | from . import gmp_converter
2 |
3 | from stormpy.pycarl._config import CARL_WITH_CLN as has_cln
4 |
5 |
6 | def convert_to_gmp(data):
7 | """
8 | Convert data type to gmp.
9 | :param data: data structure.
10 | :return: gmp data structure.
11 | """
12 | return gmp_converter.convert(data)
13 |
14 |
15 | if has_cln:
16 | from . import cln_converter
17 |
18 | def convert_to_cln(data):
19 | """
20 | Convert data type to cln.
21 | :param data: data structure.
22 | :return: cln data structure.
23 | """
24 | return cln_converter.convert(data)
25 |
--------------------------------------------------------------------------------
/lib/stormpy/pycarl/formula/__init__.py:
--------------------------------------------------------------------------------
1 | from stormpy.pycarl.formula import *
2 | from .formula import *
3 |
--------------------------------------------------------------------------------
/lib/stormpy/pycarl/gmp/__init__.py:
--------------------------------------------------------------------------------
1 | from . import gmp
2 | from .gmp import *
3 |
4 |
5 | def numerator(x):
6 | if type(x) == gmp.RationalFunction or type(x) == gmp.Rational or type(x) == gmp.FactorizedRationalFunction:
7 | return x.numerator
8 | else:
9 | return x
10 |
11 |
12 | def denominator(x):
13 | if type(x) == gmp.RationalFunction or type(x) == gmp.Rational or type(x) == gmp.FactorizedRationalFunction:
14 | return x.denominator
15 | else:
16 | return 1
17 |
18 |
19 | def expand(x):
20 | if type(x) == gmp.FactorizedRationalFunction:
21 | return x.rational_function()
22 | if type(x) == gmp.FactorizedPolynomial:
23 | return x.polynomial()
24 | return x
25 |
26 |
27 | factorization_cache = gmp._FactorizationCache()
28 |
29 |
30 | def create_factorized_polynomial(polynomial):
31 | return gmp.FactorizedPolynomial(polynomial, factorization_cache)
32 |
--------------------------------------------------------------------------------
/lib/stormpy/pycarl/gmp/formula/__init__.py:
--------------------------------------------------------------------------------
1 | from . import formula
2 | from .formula import *
3 |
--------------------------------------------------------------------------------
/lib/stormpy/pycarl/gmp/parse/__init__.py:
--------------------------------------------------------------------------------
1 | from stormpy.pycarl import _config
2 |
3 | if not _config.CARL_WITH_PARSER:
4 | raise ImportError("Parser is not available!")
5 |
6 | from . import parse
7 | from .parse import *
8 |
--------------------------------------------------------------------------------
/lib/stormpy/utility/__init__.py:
--------------------------------------------------------------------------------
1 | from . import utility
2 | from .utility import *
3 |
4 | # Extend JSON container for simplified access
5 | utility.JsonContainerDouble.__eq__ = lambda s, o: str(s) == str(o)
6 | utility.JsonContainerDouble.__int__ = lambda s: int(str(s))
7 | utility.JsonContainerDouble.__hash__ = lambda s: str(s).__hash__()
8 |
9 |
10 | utility.JsonContainerRational.__eq__ = lambda s, o: str(s) == str(o)
11 | utility.JsonContainerRational.__int__ = lambda s: int(str(s))
12 | utility.JsonContainerRational.__hash__ = lambda s: str(s).__hash__()
13 |
--------------------------------------------------------------------------------
/resources/include_pybind11.cmake:
--------------------------------------------------------------------------------
1 | #find_package(pybind11 ${PYBIND_VERSION} CONFIG QUIET)
2 | #if(pybind11_FOUND)
3 | # message(STATUS "Stormpy - Using system version of pybind11 (version ${PYBIND_VERSION}).")
4 | #else()
5 | message(STATUS "Stormpy - Using shipped version of pybind11 (version ${PYBIND_VERSION}).")
6 |
7 | include(FetchContent)
8 | FetchContent_Declare(
9 | pybind11
10 | GIT_REPOSITORY https://github.com/pybind/pybind11
11 | GIT_TAG "v${PYBIND_VERSION}"
12 | PATCH_COMMAND git apply ${CMAKE_CURRENT_SOURCE_DIR}/resources/pybind11_${PYBIND_VERSION}.patch || git apply ${CMAKE_CURRENT_SOURCE_DIR}/resources/pybind11_${PYBIND_VERSION}.patch --reverse --check
13 | )
14 |
15 | FetchContent_MakeAvailable(pybind11)
16 | #endif()
17 |
--------------------------------------------------------------------------------
/resources/pybind11_2.10.0.patch:
--------------------------------------------------------------------------------
1 | diff --git a/include/pybind11/cast.h b/include/pybind11/cast.h
2 | index a0e32281..f132d096 100644
3 | --- a/include/pybind11/cast.h
4 | +++ b/include/pybind11/cast.h
5 | @@ -657,7 +657,7 @@ public:
6 | }
7 |
8 | static constexpr auto name
9 | - = const_name("Tuple[") + concat(make_caster::name...) + const_name("]");
10 | + = const_name("Tuple[") + pybind11::detail::concat(make_caster::name...) + const_name("]");
11 |
12 | template
13 | using cast_op_type = type;
14 | @@ -1399,7 +1399,7 @@ public:
15 | static_assert(args_pos == -1 || args_pos == constexpr_first(),
16 | "py::args cannot be specified more than once");
17 |
18 | - static constexpr auto arg_names = concat(type_descr(make_caster::name)...);
19 | + static constexpr auto arg_names = pybind11::detail::concat(type_descr(make_caster::name)...);
20 |
21 | bool load_args(function_call &call) { return load_impl_sequence(call, indices{}); }
22 |
23 |
--------------------------------------------------------------------------------
/resources/pybind11_2.11.1.patch:
--------------------------------------------------------------------------------
1 | diff --git a/include/pybind11/cast.h b/include/pybind11/cast.h
2 | index db393411..117680a1 100644
3 | --- a/include/pybind11/cast.h
4 | +++ b/include/pybind11/cast.h
5 | @@ -661,7 +661,7 @@ public:
6 | }
7 |
8 | static constexpr auto name
9 | - = const_name("Tuple[") + concat(make_caster::name...) + const_name("]");
10 | + = const_name("Tuple[") + pybind11::detail::concat(make_caster::name...) + const_name("]");
11 |
12 | template
13 | using cast_op_type = type;
14 | @@ -1438,7 +1438,7 @@ public:
15 | static_assert(args_pos == -1 || args_pos == constexpr_first(),
16 | "py::args cannot be specified more than once");
17 |
18 | - static constexpr auto arg_names = concat(type_descr(make_caster::name)...);
19 | + static constexpr auto arg_names = pybind11::detail::concat(type_descr(make_caster::name)...);
20 |
21 | bool load_args(function_call &call) { return load_impl_sequence(call, indices{}); }
22 |
23 |
--------------------------------------------------------------------------------
/src/boost.h:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | // `boost::optional` as an example -- can be any `std::optional`-like container
4 | namespace pybind11 {
5 | namespace detail {
6 |
7 | template
8 | struct type_caster> : optional_caster> {};
9 |
10 | template<> struct type_caster
11 | : public void_caster {};
12 |
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/src/common.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "config.h"
4 |
5 | #include
6 | #include
7 | #include
8 | #include
9 |
10 | namespace py = pybind11;
11 | using namespace pybind11::literals;
12 |
13 | #if PY_MAJOR_VERSION >= 3
14 | #define PY_DIV "__truediv__"
15 | #define PY_RDIV "__rtruediv__"
16 | #else
17 | #define PY_DIV "__div__"
18 | #define PY_RDIV "__rdiv__"
19 | #endif
20 |
21 | PYBIND11_DECLARE_HOLDER_TYPE(T, std::shared_ptr)
22 | PYBIND11_DECLARE_HOLDER_TYPE(T, std::shared_ptr)
23 |
24 | #include "boost.h"
25 |
--------------------------------------------------------------------------------
/src/config.h.in:
--------------------------------------------------------------------------------
1 | #cmakedefine STORMPY_DISABLE_SIGNATURE_DOC
2 |
--------------------------------------------------------------------------------
/src/core/analysis.cpp:
--------------------------------------------------------------------------------
1 | #include "analysis.h"
2 |
3 | #include "storm/analysis/GraphConditions.h"
4 |
5 | // Define python bindings
6 | void define_graph_constraints(py::module& m) {
7 |
8 | // ConstraintCollector
9 | py::class_, std::shared_ptr>>(m, "ConstraintCollector", "Collector for constraints on parametric Markov chains")
10 | .def(py::init const&>(), py::arg("model"))
11 | .def_property_readonly("wellformed_constraints", &storm::analysis::ConstraintCollector::getWellformedConstraints, "Get the constraints ensuring a wellformed model")
12 | .def_property_readonly("graph_preserving_constraints", &storm::analysis::ConstraintCollector::getGraphPreservingConstraints, "Get the constraints ensuring the graph is preserved")
13 | ;
14 |
15 | }
16 |
--------------------------------------------------------------------------------
/src/core/analysis.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 | #include "common.h"
3 |
4 | void define_graph_constraints(py::module& m);
5 |
--------------------------------------------------------------------------------
/src/core/bisimulation.h:
--------------------------------------------------------------------------------
1 | #ifndef PYTHON_CORE_BISIMULATION_H_
2 | #define PYTHON_CORE_BISIMULATION_H_
3 |
4 | #include "common.h"
5 |
6 | void define_bisimulation(py::module& m);
7 |
8 | #endif /* PYTHON_CORE_BISIMULATION_H_ */
9 |
--------------------------------------------------------------------------------
/src/core/common.h:
--------------------------------------------------------------------------------
1 | #include "src/common.h"
2 | #include "storm/api/storm.h"
3 | #include
4 |
--------------------------------------------------------------------------------
/src/core/core.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "common.h"
4 |
5 | void define_core(py::module& m);
6 | void define_parse(py::module& m);
7 | void define_build(py::module& m);
8 | void define_export(py::module& m);
9 | void define_optimality_type(py::module& m);
--------------------------------------------------------------------------------
/src/core/counterexample.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "common.h"
4 |
5 | void define_counterexamples(py::module& m);
6 |
--------------------------------------------------------------------------------
/src/core/environment.h:
--------------------------------------------------------------------------------
1 | #ifndef PYTHON_CORE_ENVIRONMENT_H_
2 | #define PYTHON_CORE_ENVIRONMENT_H_
3 |
4 | #include "common.h"
5 |
6 | void define_environment(py::module& m);
7 |
8 | #endif /* PYTHON_CORE_ENVIRONMENT_H_ */
9 |
--------------------------------------------------------------------------------
/src/core/input.h:
--------------------------------------------------------------------------------
1 | #ifndef PYTHON_CORE_INPUT_H_
2 | #define PYTHON_CORE_INPUT_H_
3 |
4 | #include "common.h"
5 |
6 | void define_property(py::module& m);
7 | void define_input(py::module& m);
8 |
9 |
10 | #endif /* PYTHON_CORE_INPUT_H_ */
11 |
--------------------------------------------------------------------------------
/src/core/modelchecking.h:
--------------------------------------------------------------------------------
1 | #ifndef PYTHON_CORE_MODELCHECKING_H_
2 | #define PYTHON_CORE_MODELCHECKING_H_
3 |
4 | #include "common.h"
5 |
6 | void define_modelchecking(py::module& m);
7 |
8 | #endif /* PYTHON_CORE_MODELCHECKING_H_ */
9 |
--------------------------------------------------------------------------------
/src/core/result.h:
--------------------------------------------------------------------------------
1 | #ifndef PYTHON_CORE_RESULT_H_
2 | #define PYTHON_CORE_RESULT_H_
3 |
4 | #include "common.h"
5 |
6 | void define_result(py::module& m);
7 |
8 | #endif /* PYTHON_CORE_RESULT_H_ */
9 |
--------------------------------------------------------------------------------
/src/core/simulator.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "common.h"
4 |
5 | template
6 | void define_sparse_model_simulator(py::module& m, std::string const& vtSuffix);
7 |
8 | template
9 | void define_prism_program_simulator(py::module& m, std::string const& vtSuffix);
--------------------------------------------------------------------------------
/src/core/transformation.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "common.h"
4 |
5 | void define_transformation(py::module& m);
6 | template
7 | void define_transformation_typed(py::module& m, std::string const& suffix);
8 |
--------------------------------------------------------------------------------
/src/dft/analysis.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "common.h"
4 |
5 | void define_analysis(py::module& m);
6 |
7 | template
8 | void define_analysis_typed(py::module& m, std::string const& vt_suffix);
9 |
--------------------------------------------------------------------------------
/src/dft/common.h:
--------------------------------------------------------------------------------
1 | #include "src/common.h"
2 | #include "storm-dft/api/storm-dft.h"
--------------------------------------------------------------------------------
/src/dft/dft.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "common.h"
4 |
5 | void define_dft(py::module& m);
6 |
7 | template
8 | void define_dft_typed(py::module& m, std::string const& vt_suffix);
9 |
10 | void define_symmetries(py::module& m);
11 |
--------------------------------------------------------------------------------
/src/dft/dft_elements.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "common.h"
4 |
5 | void define_dft_elements(py::module& m);
6 |
7 | template
8 | void define_dft_elements_typed(py::module& m, std::string const& vt_suffix);
9 |
--------------------------------------------------------------------------------
/src/dft/dft_state.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "common.h"
4 |
5 | template
6 | void define_dft_state(py::module& m, std::string const& vt_suffix);
7 |
8 | void define_failable_elements(py::module& m);
9 |
--------------------------------------------------------------------------------
/src/dft/io.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "common.h"
4 |
5 | void define_input(py::module& m);
6 | void define_output(py::module& m);
7 |
--------------------------------------------------------------------------------
/src/dft/module.cpp:
--------------------------------------------------------------------------------
1 | #include "dft.h"
2 | #include "src/helpers.h"
3 | #include "storm-dft/storage/DftModule.h"
4 |
5 | using DftIndependentModule = storm::dft::storage::DftIndependentModule;
6 |
7 | void define_module(py::module& m) {
8 |
9 | py::class_>(m, "DftIndependentModule", "Independent module in DFT")
10 | .def("static", &DftIndependentModule::isStatic, "Whether the module contains only static elements (except in submodules)")
11 | .def("fully_static", &DftIndependentModule::isFullyStatic, "Whether the module contains only static elements (also in submodules)")
12 | .def("single_be", &DftIndependentModule::isSingleBE, "Whether the module consists of a single BE (trivial module)")
13 | .def("representative", &DftIndependentModule::getRepresentative, "Get module representative")
14 | .def("elements", &DftIndependentModule::getElements, "Get elements of module (excluding submodules)")
15 | .def("submodules", &DftIndependentModule::getSubModules, "Get submodules")
16 | .def("_subtree_double", &DftIndependentModule::getSubtree, "Get subtree formed by module", py::arg("dft"))
17 | .def("_subtree_ratfunc", &DftIndependentModule::getSubtree, "Get subtree formed by module", py::arg("dft"))
18 | ;
19 | }
20 |
--------------------------------------------------------------------------------
/src/dft/module.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "common.h"
4 |
5 | void define_module(py::module& m);
--------------------------------------------------------------------------------
/src/dft/simulator.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "common.h"
4 |
5 | void define_simulator(py::module& m);
6 |
7 | template
8 | void define_simulator_typed(py::module& m, std::string const& vt_suffix);
9 |
--------------------------------------------------------------------------------
/src/dft/transformations.cpp:
--------------------------------------------------------------------------------
1 | #include "dft.h"
2 | #include "src/helpers.h"
3 |
4 | #include "storm-dft/transformations/DftInstantiator.h"
5 |
6 | using DFTInstantiator = storm::dft::transformations::DftInstantiator;
7 |
8 | void define_transformations(py::module& m) {
9 |
10 | py::class_>(m, "DFTInstantiator", "Instantiator for parametric DFT")
11 | .def(py::init const&>(), "Initialize with parametric DFT", py::arg("dft"))
12 | .def("instantiate", &DFTInstantiator::instantiate, "Instantiate parametric DFT and obtain concrete DFT", py::arg("valuation"))
13 | ;
14 | }
15 |
16 |
--------------------------------------------------------------------------------
/src/dft/transformations.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "common.h"
4 |
5 | void define_transformations(py::module& m);
6 |
--------------------------------------------------------------------------------
/src/gspn/common.h:
--------------------------------------------------------------------------------
1 | #include "src/common.h"
2 | #include "storm-gspn/api/storm-gspn.h"
--------------------------------------------------------------------------------
/src/gspn/gspn.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "common.h"
4 |
5 | void define_gspn(py::module& m);
6 |
7 |
8 |
--------------------------------------------------------------------------------
/src/gspn/gspn_io.cpp:
--------------------------------------------------------------------------------
1 | #include "gspn_io.h"
2 | #include "src/helpers.h"
3 | #include "storm-gspn/storage/gspn/GSPN.h"
4 | #include "storm-gspn/parser/GspnParser.h"
5 |
6 | using GSPN = storm::gspn::GSPN;
7 | using GSPNParser = storm::parser::GspnParser;
8 | using GSPNJaniBuilder = storm::builder::JaniGSPNBuilder;
9 |
10 |
11 | void define_gspn_io(py::module& m) {
12 |
13 | // GspnParser class
14 | py::class_>(m, "GSPNParser")
15 | .def(py::init<>())
16 | .def("parse", [](GSPNParser& p, std::string const& filename, std::string const& constantDefinitions) -> GSPN& {return *(p.parse(filename,constantDefinitions)); }, "filename"_a, "constant_definitions"_a = "")
17 | ;
18 |
19 | // GspnToJani builder
20 | py::class_>(m, "GSPNToJaniBuilder")
21 | .def(py::init(), py::arg("gspn"))
22 | .def("build", &GSPNJaniBuilder::build, py::arg("automaton_name") = "gspn_automaton", "Build Jani model from GSPN")
23 | .def("create_deadlock_properties", &GSPNJaniBuilder::getDeadlockProperties, py::arg("jani_model"), "Create standard properties for deadlocks")
24 | ;
25 |
26 | }
27 |
--------------------------------------------------------------------------------
/src/gspn/gspn_io.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "common.h"
4 |
5 | void define_gspn_io(py::module& m);
6 |
7 |
--------------------------------------------------------------------------------
/src/helpers.h:
--------------------------------------------------------------------------------
1 | /*
2 | * helpers.h
3 | *
4 | * Created on: 16 Apr 2016
5 | * Author: harold
6 | */
7 |
8 | #ifndef PYTHON_HELPERS_H_
9 | #define PYTHON_HELPERS_H_
10 |
11 | #include
12 | #include
13 |
14 | /**
15 | * Helper function to get a string out of the stream operator.
16 | * Used for __str__ functions.
17 | */
18 | template
19 | std::string streamToString(T const& t) {
20 | std::stringstream ss;
21 | ss << t;
22 | return ss.str();
23 | }
24 |
25 | template
26 | std::string containerToString(T& t) {
27 | // is there a way to make ^this const&?
28 | // I guess not all containers have const iterators
29 | std::stringstream ss;
30 | for (auto const& e : t) {
31 | ss << e << ", ";
32 | }
33 | return ss.str();
34 | }
35 |
36 | // Be warned: Enabling something like this will break everything about Monomial,
37 | // as to Python the shared_ptr (Arg) IS the Monomial
38 | // //PYBIND11_DECLARE_HOLDER_TYPE(T, std::shared_ptr);
39 |
40 | #endif /* PYTHON_HELPERS_H_ */
41 |
--------------------------------------------------------------------------------
/src/logic/formulae.h:
--------------------------------------------------------------------------------
1 | #ifndef PYTHON_LOGIC_FORMULAE_H_
2 | #define PYTHON_LOGIC_FORMULAE_H_
3 |
4 | #include "src/common.h"
5 |
6 | void define_formulae(py::module& m);
7 |
8 | #endif /* PYTHON_LOGIC_FORMULAE_H_ */
9 |
--------------------------------------------------------------------------------
/src/mod_core.cpp:
--------------------------------------------------------------------------------
1 | #include "common.h"
2 |
3 | #include "core/core.h"
4 | #include "core/result.h"
5 | #include "core/modelchecking.h"
6 | #include "core/bisimulation.h"
7 | #include "core/input.h"
8 | #include "core/analysis.h"
9 | #include "core/counterexample.h"
10 | #include "core/environment.h"
11 | #include "core/transformation.h"
12 | #include "core/simulator.h"
13 |
14 | PYBIND11_MODULE(core, m) {
15 | m.doc() = "core";
16 |
17 | #ifdef STORMPY_DISABLE_SIGNATURE_DOC
18 | py::options options;
19 | options.disable_function_signatures();
20 | #endif
21 |
22 | define_environment(m);
23 | define_core(m);
24 |
25 | define_property(m);
26 | define_parse(m);
27 | define_build(m);
28 | define_optimality_type(m);
29 | define_export(m);
30 | define_result(m);
31 | define_modelchecking(m);
32 | define_counterexamples(m);
33 | define_bisimulation(m);
34 | define_input(m);
35 | define_graph_constraints(m);
36 | define_transformation(m);
37 | define_transformation_typed(m, "Double");
38 | define_transformation_typed(m, "Exact");
39 | define_transformation_typed(m, "RatFunc");
40 | define_sparse_model_simulator(m, "Double");
41 | define_sparse_model_simulator(m, "Exact");
42 | define_prism_program_simulator(m, "Double");
43 |
44 | }
45 |
--------------------------------------------------------------------------------
/src/mod_dft.cpp:
--------------------------------------------------------------------------------
1 | #include "common.h"
2 |
3 | #include "dft/analysis.h"
4 | #include "dft/dft.h"
5 | #include "dft/dft_elements.h"
6 | #include "dft/dft_state.h"
7 | #include "dft/io.h"
8 | #include "dft/module.h"
9 | #include "dft/simulator.h"
10 | #include "dft/transformations.h"
11 |
12 | PYBIND11_MODULE(dft, m) {
13 | m.doc() = "Functionality for DFT analysis";
14 |
15 | #ifdef STORMPY_DISABLE_SIGNATURE_DOC
16 | py::options options;
17 | options.disable_function_signatures();
18 | #endif
19 |
20 | define_symmetries(m); // Must be before define_analysis_typed
21 | define_analysis(m);
22 | define_analysis_typed(m, "_double");
23 | define_analysis_typed(m, "_ratfunc");
24 | define_dft(m);
25 | define_dft_typed(m, "_double");
26 | define_dft_typed(m, "_ratfunc");
27 | define_dft_elements(m);
28 | define_dft_elements_typed(m, "_double");
29 | define_dft_elements_typed(m, "_ratfunc");
30 | define_dft_state(m, "_double");
31 | define_dft_state(m, "_ratfunc");
32 | define_failable_elements(m);
33 | define_input(m);
34 | define_module(m);
35 | define_output(m);
36 | define_simulator(m);
37 | define_simulator_typed(m, "_double");
38 | define_simulator_typed(m, "_ratfunc");
39 | define_transformations(m);
40 | }
41 |
--------------------------------------------------------------------------------
/src/mod_gspn.cpp:
--------------------------------------------------------------------------------
1 | #include "common.h"
2 |
3 | #include "gspn/gspn.h"
4 | #include "gspn/gspn_io.h"
5 |
6 | PYBIND11_MODULE(gspn, m) {
7 | m.doc() = "Support for GSPNs";
8 |
9 | #ifdef STORMPY_DISABLE_SIGNATURE_DOC
10 | py::options options;
11 | options.disable_function_signatures();
12 | #endif
13 |
14 | define_gspn(m);
15 | define_gspn_io(m);
16 | }
17 |
--------------------------------------------------------------------------------
/src/mod_info.cpp:
--------------------------------------------------------------------------------
1 | #include "common.h"
2 | #include "storm-version-info/storm-version.h"
3 |
4 | PYBIND11_MODULE(info, m) {
5 | m.doc() = "Storm information";
6 |
7 | #ifdef STORMPY_DISABLE_SIGNATURE_DOC
8 | py::options options;
9 | options.disable_function_signatures();
10 | #endif
11 |
12 | py::class_(m, "Version", "Version information for Storm")
13 | // static properties are still called with self as argument (which we ignore), see
14 | // https://pybind11.readthedocs.io/en/master/advanced/classes.html#static-properties
15 | .def_property_readonly_static("major", [](py::object /* self */){ return storm::StormVersion::versionMajor; }, "Storm major version.")
16 | .def_property_readonly_static("minor", [](py::object /* self */){ return storm::StormVersion::versionMinor; }, "Storm minor version.")
17 | .def_property_readonly_static("patch", [](py::object /* self */){ return storm::StormVersion::versionPatch; }, "Storm patch version.")
18 | .def_property_readonly_static("development", [](py::object /* self */){ return storm::StormVersion::versionDev; }, "Flag if Storm is development version.")
19 | .def_property_readonly_static("short", [](py::object /* self */){ return storm::StormVersion::shortVersionString(); }, "Storm version in short representation.")
20 | .def_property_readonly_static("long", [](py::object /* self */){ return storm::StormVersion::longVersionString(); }, "Storm version in long representation.")
21 | .def_property_readonly_static("build_info", [](py::object /* self */){ return storm::StormVersion::buildInfo(); }, "Build info for Storm.")
22 | ;
23 | }
24 |
--------------------------------------------------------------------------------
/src/mod_logic.cpp:
--------------------------------------------------------------------------------
1 | #include "common.h"
2 |
3 | #include "logic/formulae.h"
4 |
5 | PYBIND11_MODULE(logic, m) {
6 | m.doc() = "Logic module for Storm";
7 |
8 | #ifdef STORMPY_DISABLE_SIGNATURE_DOC
9 | py::options options;
10 | options.disable_function_signatures();
11 | #endif
12 |
13 | define_formulae(m);
14 | }
15 |
--------------------------------------------------------------------------------
/src/mod_pars.cpp:
--------------------------------------------------------------------------------
1 | #include "common.h"
2 |
3 | #include "pars/pars.h"
4 | #include "pars/pla.h"
5 | #include "pars/model_instantiator.h"
6 |
7 | PYBIND11_MODULE(pars, m) {
8 | m.doc() = "Functionality for parametric analysis";
9 |
10 | #ifdef STORMPY_DISABLE_SIGNATURE_DOC
11 | py::options options;
12 | options.disable_function_signatures();
13 | #endif
14 |
15 | define_pars(m);
16 | define_pla(m);
17 | define_model_instantiator(m);
18 | define_model_instantiation_checker(m);
19 | }
20 |
--------------------------------------------------------------------------------
/src/mod_pomdp.cpp:
--------------------------------------------------------------------------------
1 |
2 | #include "common.h"
3 |
4 | #include "pomdp/tracker.h"
5 | #include "pomdp/qualitative_analysis.h"
6 | #include "pomdp/transformations.h"
7 | #include "pomdp/memory.h"
8 | #include "pomdp/quantitative_analysis.h"
9 | #include
10 |
11 | PYBIND11_MODULE(pomdp, m) {
12 | m.doc() = "Functionality for POMDP analysis";
13 |
14 | #ifdef STORMPY_DISABLE_SIGNATURE_DOC
15 | py::options options;
16 | options.disable_function_signatures();
17 | #endif
18 | define_tracker(m, "Double");
19 | define_tracker(m, "Exact");
20 | define_qualitative_policy_search(m, "Double");
21 | define_qualitative_policy_search_nt(m);
22 | define_memory(m);
23 | define_transformations_nt(m);
24 | define_transformations(m, "Double");
25 | define_transformations(m, "Exact");
26 | define_belief_exploration(m, "Double");
27 |
28 | define_transformations(m, "Rf");
29 | }
30 |
--------------------------------------------------------------------------------
/src/mod_utility.cpp:
--------------------------------------------------------------------------------
1 | #include "common.h"
2 |
3 | #include "utility/shortestPaths.h"
4 | #include "utility/smtsolver.h"
5 | #include "utility/chrono.h"
6 | #include "utility/json.h"
7 | #include "storm/adapters/RationalNumberAdapter.h"
8 |
9 | PYBIND11_MODULE(utility, m) {
10 | m.doc() = "Utilities for Storm";
11 |
12 | #ifdef STORMPY_DISABLE_SIGNATURE_DOC
13 | py::options options;
14 | options.disable_function_signatures();
15 | #endif
16 |
17 | define_ksp(m);
18 | define_smt(m);
19 | define_chrono(m);
20 | define_json(m, "Double");
21 | define_json(m, "Rational");
22 | }
23 |
--------------------------------------------------------------------------------
/src/pars/common.h:
--------------------------------------------------------------------------------
1 | #include "src/common.h"
2 |
3 | #include "storm-pars/api/storm-pars.h"
4 |
5 | #include "storm/modelchecker/results/ExplicitQuantitativeCheckResult.h"
6 | #include "storm/modelchecker/results/ExplicitQualitativeCheckResult.h"
--------------------------------------------------------------------------------
/src/pars/model_instantiator.h:
--------------------------------------------------------------------------------
1 | #ifndef PYTHON_PARS_MODEL_INSTANTIATOR_H_
2 | #define PYTHON_PARS_MODEL_INSTANTIATOR_H_
3 |
4 | #include "common.h"
5 |
6 | void define_model_instantiator(py::module& m);
7 | void define_model_instantiation_checker(py::module& m);
8 |
9 | #endif /* PYTHON_PARS_MODEL_INSTANTIATOR_H_ */
10 |
--------------------------------------------------------------------------------
/src/pars/pars.h:
--------------------------------------------------------------------------------
1 | #ifndef PYTHON_PARS_PARS_H_
2 | #define PYTHON_PARS_PARS_H_
3 |
4 | #include "common.h"
5 |
6 | void define_pars(py::module& m);
7 |
8 | #endif /* PYTHON_PARS_PARS_H_ */
9 |
--------------------------------------------------------------------------------
/src/pars/pla.h:
--------------------------------------------------------------------------------
1 | #ifndef PYTHON_PARS_PLA_H_
2 | #define PYTHON_PARS_PLA_H_
3 |
4 | #include "common.h"
5 |
6 | void define_pla(py::module& m);
7 |
8 | #endif /* PYTHON_PARS_PLA_H_ */
9 |
--------------------------------------------------------------------------------
/src/pomdp/common.h:
--------------------------------------------------------------------------------
1 | #include "src/common.h"
2 |
--------------------------------------------------------------------------------
/src/pomdp/memory.cpp:
--------------------------------------------------------------------------------
1 | #include "memory.h"
2 | #include "src/helpers.h"
3 | #include
4 |
5 |
6 | void define_memory(py::module& m) {
7 | py::class_ memory(m, "PomdpMemory", "Memory for POMDP policies");
8 | memory.def_property_readonly("nr_states",&storm::storage::PomdpMemory::getNumberOfStates, "How many states does the memory structure have");
9 |
10 | // Trivial, FixedCounter, SelectiveCounter, FixedRing, SelectiveRing, SettableBits, Full
11 | py::enum_(m, "PomdpMemoryPattern", "Memory pattern for POMDP memory")
12 | .value("trivial", storm::storage::PomdpMemoryPattern::Trivial)
13 | .value("fixed_counter", storm::storage::PomdpMemoryPattern::FixedCounter)
14 | .value("selective_counter", storm::storage::PomdpMemoryPattern::SelectiveCounter)
15 | .value("fixed_ring", storm::storage::PomdpMemoryPattern::FixedRing)
16 | .value("selective_ring", storm::storage::PomdpMemoryPattern::SelectiveRing)
17 | .value("settable_bits", storm::storage::PomdpMemoryPattern::SettableBits)
18 | .value("full", storm::storage::PomdpMemoryPattern::Full)
19 | ;
20 |
21 |
22 | py::class_ memorybuilder(m, "PomdpMemoryBuilder", "MemoryBuilder for POMDP policies");
23 | memorybuilder.def(py::init<>());
24 | memorybuilder.def("build", &storm::storage::PomdpMemoryBuilder::build, py::arg("pattern"), py::arg("nr_states"));
25 |
26 |
27 | }
--------------------------------------------------------------------------------
/src/pomdp/memory.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 | #include "common.h"
3 |
4 | void define_memory(py::module& m);
5 |
--------------------------------------------------------------------------------
/src/pomdp/qualitative_analysis.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 | #include "common.h"
3 |
4 | template
5 | void define_qualitative_policy_search(py::module& m, std::string const& vtSuffix);
6 | void define_qualitative_policy_search_nt(py::module& m);
--------------------------------------------------------------------------------
/src/pomdp/quantitative_analysis.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 | #include "common.h"
3 |
4 | template
5 | void define_belief_exploration(py::module& m, std::string const& vtSuffix);
--------------------------------------------------------------------------------
/src/pomdp/tracker.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 | #include "common.h"
3 |
4 | template
5 | void define_tracker(py::module& m, std::string const& vtSuffix);
6 |
--------------------------------------------------------------------------------
/src/pomdp/transformations.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "common.h"
4 |
5 | void define_transformations_nt(py::module& m);
6 | template
7 | void define_transformations(py::module& m, std::string const& vtSuffix);
8 |
--------------------------------------------------------------------------------
/src/pycarl/common.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 | #include
5 | #include
6 | #include
7 | #include
8 |
9 |
10 | #include
11 |
12 | namespace py = pybind11;
13 |
14 | #if PY_MAJOR_VERSION >= 3
15 | #define PY_DIV "__truediv__"
16 | #define PY_RDIV "__rtruediv__"
17 | #else
18 | #define PY_DIV "__div__"
19 | #define PY_RDIV "__rdiv__"
20 | #endif
21 |
22 | struct NoPickling: public std::exception {
23 | virtual const char* what() const throw() {
24 | return "Pickling support not implemented!";
25 | }
26 | };
27 |
28 |
29 |
30 | // `boost::variant` as an example -- can be any `std::variant`-like container
31 | namespace pybind11 {
32 | namespace detail {
33 | template
34 | struct type_caster> : variant_caster> {};
35 |
36 | // Specifies the function used to visit the variant -- `apply_visitor` instead of `visit`
37 | template <>
38 | struct visit_helper {
39 | template
40 | static auto call(Args &&...args)
41 | -> decltype(boost::apply_visitor(std::forward(args)...)) {
42 | return boost::apply_visitor(std::forward(args)...);
43 | }
44 | };
45 | }
46 | } // namespace pybind11::detail
--------------------------------------------------------------------------------
/src/pycarl/core/bound_type.cpp:
--------------------------------------------------------------------------------
1 | #include "bound_type.h"
2 |
3 | #include "src/pycarl/types.h"
4 | #include "src/pycarl/helpers.h"
5 |
6 |
7 | void define_boundtype(py::module& m) {
8 | py::enum_(m, "BoundType")
9 | .value("STRICT", carl::BoundType::STRICT)
10 | .value("WEAK", carl::BoundType::WEAK)
11 | .value("INFTY", carl::BoundType::INFTY)
12 | ;
13 | }
14 |
--------------------------------------------------------------------------------
/src/pycarl/core/bound_type.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "src/pycarl/common.h"
4 |
5 | void define_boundtype(py::module& m);
6 |
--------------------------------------------------------------------------------
/src/pycarl/core/monomial.h:
--------------------------------------------------------------------------------
1 | /*
2 | * monomial.h
3 | *
4 | * Created on: 16 Apr 2016
5 | * Author: harold
6 | */
7 |
8 | #ifndef PYTHON_PYCARL_CORE_MONOMIAL_H_
9 | #define PYTHON_PYCARL_CORE_MONOMIAL_H_
10 |
11 | #include "src/pycarl/common.h"
12 |
13 | void define_monomial(py::module& m);
14 |
15 | #endif /* PYTHON_PYCARL_CORE_MONOMIAL_H_ */
16 |
--------------------------------------------------------------------------------
/src/pycarl/core/variable.h:
--------------------------------------------------------------------------------
1 | /*
2 | * variable.h
3 | *
4 | * Created on: 16 Apr 2016
5 | * Author: harold
6 | */
7 |
8 | #ifndef PYTHON_PYCARL_CORE_VARIABLE_H_
9 | #define PYTHON_PYCARL_CORE_VARIABLE_H_
10 |
11 | #include "src/pycarl/common.h"
12 |
13 | void define_variabletype(py::module& m);
14 | void define_variable(py::module& m);
15 |
16 | #endif /* PYTHON_PYCARL_CORE_VARIABLE_H_ */
17 |
--------------------------------------------------------------------------------
/src/pycarl/definitions.h.in:
--------------------------------------------------------------------------------
1 | #cmakedefine PYCARL_HAS_CLN
2 |
--------------------------------------------------------------------------------
/src/pycarl/formula/formula_type.cpp:
--------------------------------------------------------------------------------
1 | #include "formula_type.h"
2 | #include
3 |
4 | void define_formula_type(py::module& m) {
5 | // Mostly just the operators are useful for Python, but as other values may be returned,
6 | // all of them are included
7 | py::enum_(m, "FormulaType")
8 | .value("ITE", carl::FormulaType::ITE)
9 | .value("EXISTS", carl::FormulaType::EXISTS)
10 | .value("FORALL", carl::FormulaType::FORALL)
11 | .value("TRUE", carl::FormulaType::TRUE)
12 | .value("FALSE", carl::FormulaType::FALSE)
13 | .value("BOOL", carl::FormulaType::BOOL)
14 | .value("NOT", carl::FormulaType::NOT)
15 | .value("IMPLIES", carl::FormulaType::IMPLIES)
16 | .value("AND", carl::FormulaType::AND)
17 | .value("OR", carl::FormulaType::OR)
18 | .value("XOR", carl::FormulaType::XOR)
19 | .value("IFF", carl::FormulaType::IFF)
20 | .value("CONSTRAINT", carl::FormulaType::CONSTRAINT)
21 | .value("BITVECTOR", carl::FormulaType::BITVECTOR)
22 | .value("UEQ", carl::FormulaType::UEQ)
23 | ;
24 | }
--------------------------------------------------------------------------------
/src/pycarl/formula/formula_type.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "src/pycarl/common.h"
4 |
5 | void define_formula_type(py::module& m);
--------------------------------------------------------------------------------
/src/pycarl/formula/relation.cpp:
--------------------------------------------------------------------------------
1 | #include "relation.h"
2 | #include "src/pycarl/helpers.h"
3 |
4 | #include
5 |
6 | void define_relation(py::module& m) {
7 | py::enum_(m, "Relation")
8 | .value("EQ", carl::Relation::EQ)
9 | .value("NEQ", carl::Relation::NEQ)
10 | .value("LESS", carl::Relation::LESS)
11 | .value("LEQ", carl::Relation::LEQ)
12 | .value("GREATER", carl::Relation::GREATER)
13 | .value("GEQ", carl::Relation::GEQ)
14 | .def("__str__", &streamToString, py::prepend() /* use custom method instead of default enum overload */)
15 | ;
16 | }
17 |
--------------------------------------------------------------------------------
/src/pycarl/formula/relation.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "src/pycarl/common.h"
4 |
5 | void define_relation(py::module& m);
6 |
--------------------------------------------------------------------------------
/src/pycarl/helpers.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 | #include
5 |
6 | /**
7 | * Helper function to get a string out of the stream operator.
8 | * Used for __str__ functions.
9 | */
10 | template
11 | std::string streamToString(T const & t) {
12 | std::stringstream ss;
13 | ss << t;
14 | return ss.str();
15 | }
16 |
--------------------------------------------------------------------------------
/src/pycarl/mod_cln.cpp:
--------------------------------------------------------------------------------
1 | #include "common.h"
2 | #include "types.h"
3 |
4 | #include "typed_core/integer.h"
5 | #include "typed_core/rational.h"
6 | #include "typed_core/term.h"
7 | #include "typed_core/polynomial.h"
8 | #include "typed_core/rationalfunction.h"
9 | #include "typed_core/factorization.h"
10 | #include "typed_core/factorizedpolynomial.h"
11 | #include "typed_core/factorizedrationalfunction.h"
12 | #include "typed_core/interval.h"
13 |
14 | PYBIND11_MODULE(cln, m) {
15 | m.attr("__name__") = "stormpy.pycarl.cln";
16 |
17 | m.doc() = "pycarl core cln-typed data and functions";
18 |
19 | define_cln_integer(m);
20 | define_cln_rational(m);
21 | define_term(m);
22 | define_polynomial(m);
23 | define_factorizationcache(m);
24 | define_factorization(m);
25 | define_factorizedpolynomial(m);
26 | define_rationalfunction(m);
27 | define_factorizedrationalfunction(m);
28 |
29 | define_interval(m);
30 | }
31 |
--------------------------------------------------------------------------------
/src/pycarl/mod_core.cpp:
--------------------------------------------------------------------------------
1 | #include "common.h"
2 |
3 | #include "core/variable.h"
4 | #include "core/monomial.h"
5 | #include "core/bound_type.h"
6 | #include "typed_core/interval.h"
7 |
8 | PYBIND11_MODULE(pycarl_core, m) {
9 | m.doc() = "pycarl core untyped functions";
10 |
11 | define_variabletype(m);
12 | define_variable(m);
13 | define_monomial(m);
14 | define_boundtype(m);
15 |
16 | define_interval(m);
17 |
18 | py::register_exception(m, "NoPicklingSupport");
19 | }
20 |
--------------------------------------------------------------------------------
/src/pycarl/mod_formula.cpp:
--------------------------------------------------------------------------------
1 | #include "common.h"
2 | #include "helpers.h"
3 |
4 | #include "formula/formula_type.h"
5 | #include "formula/relation.h"
6 |
7 | PYBIND11_MODULE(formula, m) {
8 | m.attr("__name__") = "stormpy.pycarl.formula";
9 | m.doc() = "pycarl formula untyped functions";
10 |
11 |
12 | // Constraint relies on Rational
13 | m.import("stormpy.pycarl");
14 |
15 | define_relation(m);
16 | define_formula_type(m);
17 |
18 | }
19 |
--------------------------------------------------------------------------------
/src/pycarl/mod_gmp.cpp:
--------------------------------------------------------------------------------
1 | #include "common.h"
2 | #include "types.h"
3 |
4 | #include "typed_core/integer.h"
5 | #include "typed_core/rational.h"
6 | #include "typed_core/term.h"
7 | #include "typed_core/polynomial.h"
8 | #include "typed_core/rationalfunction.h"
9 | #include "typed_core/factorization.h"
10 | #include "typed_core/factorizedpolynomial.h"
11 | #include "typed_core/factorizedrationalfunction.h"
12 | #include "typed_core/interval.h"
13 |
14 | PYBIND11_MODULE(gmp, m) {
15 | m.attr("__name__") = "stormpy.pycarl.gmp";
16 | m.doc() = "pycarl core gmp-typed data and functions";
17 |
18 | define_gmp_integer(m);
19 | define_gmp_rational(m);
20 | define_term(m);
21 | define_polynomial(m);
22 | define_factorizationcache(m);
23 | define_factorization(m);
24 | define_factorizedpolynomial(m);
25 | define_rationalfunction(m);
26 | define_factorizedrationalfunction(m);
27 |
28 | define_interval(m);
29 | }
30 |
--------------------------------------------------------------------------------
/src/pycarl/mod_parse.cpp:
--------------------------------------------------------------------------------
1 |
2 | #include "common.h"
3 |
4 |
5 | #include
6 | #include
7 |
8 | /**
9 | * The actual module definition
10 | */
11 | PYBIND11_MODULE(parse, m) {
12 | m.attr("__name__") = "stormpy.pycarl.parse";
13 | m.doc() = "pycarl parsing functions";
14 |
15 | // Constraint relies on Rational
16 | m.import("stormpy.pycarl");
17 |
18 |
19 | py::enum_(m, "_ParserReturnType")
20 | .value("Rational", carlparser::ParserReturnType::Rational)
21 | .value("Variable", carlparser::ParserReturnType::Variable)
22 | .value("Monomial", carlparser::ParserReturnType::Monomial)
23 | .value("Term", carlparser::ParserReturnType::Term)
24 | .value("Polynomial", carlparser::ParserReturnType::Polynomial)
25 | .value("RationalFunction", carlparser::ParserReturnType::RationalFunction)
26 | .value("Constraint", carlparser::ParserReturnType::Constraint)
27 | .value("Formula", carlparser::ParserReturnType::Formula)
28 | ;
29 |
30 | }
31 |
--------------------------------------------------------------------------------
/src/pycarl/mod_typed_formula.cpp:
--------------------------------------------------------------------------------
1 | #include "common.h"
2 | #include "helpers.h"
3 |
4 | #include "typed_formula/constraint.h"
5 | #include "typed_formula/formula.h"
6 |
7 | PYBIND11_MODULE(formula, m) {
8 | m.attr("__name__") = "stormpy.pycarl.formula";
9 | m.doc() = "pycarl formula typed functions";
10 |
11 |
12 | // Constraint relies on Rational
13 | m.import("stormpy.pycarl");
14 | m.import("stormpy.pycarl.formula");
15 |
16 | define_constraint(m);
17 | define_simple_constraint(m);
18 | define_formula(m);
19 |
20 | }
21 |
--------------------------------------------------------------------------------
/src/pycarl/mod_typed_parse.cpp:
--------------------------------------------------------------------------------
1 |
2 | #include "common.h"
3 | #include "types.h"
4 |
5 | #include "typed_parse/parser.h"
6 |
7 | #include
8 |
9 | /**
10 | * The actual module definition
11 | */
12 | PYBIND11_MODULE(parse, m) {
13 | m.attr("__name__") = "stormpy.pycarl.parse";
14 | m.doc() = "pycarl parse typed functions";
15 |
16 | py::class_>(m, "_ParserResultWrapper")
17 | .def("get_type", &ParserResultWrapper::getType)
18 | .def("as_rational", &ParserResultWrapper::asRational)
19 | .def("as_variable", &ParserResultWrapper::asVariable)
20 | .def("as_monomial", &ParserResultWrapper::asMonomial)
21 | .def("as_term", &ParserResultWrapper::asTerm)
22 | .def("as_polynomial", &ParserResultWrapper::asPolynomial)
23 | .def("as_rational_function", &ParserResultWrapper::asRationalFunction)
24 | .def("as_constraint", &ParserResultWrapper::asConstraint)
25 | .def("as_formula", &ParserResultWrapper::asFormula)
26 | ;
27 |
28 | m.def("_deserialize", &from_string);
29 | m.def("_check_parsed_type", &carlparser::check_type);
30 |
31 | }
32 |
--------------------------------------------------------------------------------
/src/pycarl/typed_core/factorization.h:
--------------------------------------------------------------------------------
1 | #ifndef PYTHON_PYCARL_CORE_FACTORIZATION_H_
2 | #define PYTHON_PYCARL_CORE_FACTORIZATION_H_
3 |
4 | #include "src/pycarl/common.h"
5 |
6 | void define_factorizationcache(py::module& m);
7 | void define_factorization(py::module& m);
8 |
9 | #endif /* PYTHON_PYCARL_CORE_FACTORIZATION_H_ */
10 |
--------------------------------------------------------------------------------
/src/pycarl/typed_core/factorizedpolynomial.h:
--------------------------------------------------------------------------------
1 | #ifndef PYTHON_PYCARL_CORE_FACTORIZEDPOLYNOMIAL_H_
2 | #define PYTHON_PYCARL_CORE_FACTORIZEDPOLYNOMIAL_H_
3 |
4 | #include "src/pycarl/common.h"
5 |
6 | void define_factorizedpolynomial(py::module& m);
7 |
8 | #endif /* PYTHON_PYCARL_CORE_FACTORIZEDPOLYNOMIAL_H_ */
9 |
--------------------------------------------------------------------------------
/src/pycarl/typed_core/factorizedrationalfunction.h:
--------------------------------------------------------------------------------
1 | /*
2 | * factorizedraitonalfunction.h
3 | *
4 | * Created on: 16 Apr 2016
5 | * Author: harold
6 | */
7 |
8 | #ifndef PYTHON_PYCARL_CORE_FACTORIZEDRATIONALFUNCTION_H_
9 | #define PYTHON_PYCARL_CORE_FACTORIZEDRATIONALFUNCTION_H_
10 |
11 | #include "src/pycarl/common.h"
12 |
13 | void define_factorizedrationalfunction(py::module& m);
14 |
15 | #endif /* PYTHON_PYCARL_CORE_FACTORIZEDRATIONALFUNCTION_H_ */
16 |
--------------------------------------------------------------------------------
/src/pycarl/typed_core/integer.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "src/pycarl/common.h"
4 |
5 | void define_cln_integer(py::module& m);
6 | void define_gmp_integer(py::module& m);
--------------------------------------------------------------------------------
/src/pycarl/typed_core/polynomial.h:
--------------------------------------------------------------------------------
1 | /*
2 | * polynomial.h
3 | *
4 | * Created on: 16 Apr 2016
5 | * Author: harold
6 | */
7 |
8 | #ifndef PYTHON_PYCARL_CORE_POLYNOMIAL_H_
9 | #define PYTHON_PYCARL_CORE_POLYNOMIAL_H_
10 |
11 | #include "src/pycarl/common.h"
12 |
13 | void define_polynomial(py::module& m);
14 |
15 | #endif /* PYTHON_PYCARL_CORE_POLYNOMIAL_H_ */
16 |
--------------------------------------------------------------------------------
/src/pycarl/typed_core/rational.h:
--------------------------------------------------------------------------------
1 | /*
2 | * rational.h
3 | *
4 | * Created on: 16 Apr 2016
5 | * Author: harold
6 | */
7 |
8 | #ifndef PYTHON_PYCARL_CORE_RATIONAL_H_
9 | #define PYTHON_PYCARL_CORE_RATIONAL_H_
10 |
11 | #include "src/pycarl/common.h"
12 |
13 | void define_cln_rational(py::module& m);
14 | void define_gmp_rational(py::module& m);
15 |
16 | #endif /* PYTHON_PYCARL_CORE_RATIONAL_H_ */
17 |
--------------------------------------------------------------------------------
/src/pycarl/typed_core/rationalfunction.h:
--------------------------------------------------------------------------------
1 | /*
2 | * rationalfunction.h
3 | *
4 | * Created on: 16 Apr 2016
5 | * Author: harold
6 | */
7 |
8 | #ifndef PYTHON_PYCARL_CORE_RATIONALFUNCTION_H_
9 | #define PYTHON_PYCARL_CORE_RATIONALFUNCTION_H_
10 |
11 | #include "src/pycarl/common.h"
12 |
13 | void define_rationalfunction(py::module& m);
14 |
15 | #endif /* PYTHON_PYCARL_CORE_RATIONALFUNCTION_H_ */
16 |
--------------------------------------------------------------------------------
/src/pycarl/typed_core/term.h:
--------------------------------------------------------------------------------
1 | /*
2 | * term.h
3 | *
4 | * Created on: 16 Apr 2016
5 | * Author: harold
6 | */
7 |
8 | #ifndef PYTHON_PYCARL_CORE_TERM_H_
9 | #define PYTHON_PYCARL_CORE_TERM_H_
10 |
11 | #include "src/pycarl/common.h"
12 |
13 | void define_term(py::module& m);
14 |
15 | #endif /* PYTHON_PYCARL_CORE_TERM_H_ */
16 |
--------------------------------------------------------------------------------
/src/pycarl/typed_formula/common.h:
--------------------------------------------------------------------------------
1 | /*
2 | * common.h
3 | *
4 | * Created on: 16 Apr 2016
5 | * Author: harold
6 | */
7 |
8 | #ifndef PYTHON_FORMULA_COMMON_H_
9 | #define PYTHON_FORMULA_COMMON_H_
10 |
11 | #include "types.h"
12 |
13 | //toString
14 | #include "src/pycarl/helpers.h"
15 |
16 | #endif /* PYTHON_FORMULA_COMMON_H_ */
17 |
--------------------------------------------------------------------------------
/src/pycarl/typed_formula/constraint.h:
--------------------------------------------------------------------------------
1 | /*
2 | * constraint.h
3 | *
4 | * Created on: 16 Apr 2016
5 | * Author: harold
6 | */
7 |
8 | #pragma once
9 |
10 | #include "src/pycarl/common.h"
11 |
12 | void define_constraint(py::module& m);
13 | void define_simple_constraint(py::module& m);
14 |
--------------------------------------------------------------------------------
/src/pycarl/typed_formula/formula.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "src/pycarl/common.h"
4 |
5 | void define_formula(py::module& m);
6 |
--------------------------------------------------------------------------------
/src/pycarl/typed_formula/types.h:
--------------------------------------------------------------------------------
1 |
2 | #include "src/pycarl/types.h"
3 |
4 | #include
5 | #include
6 | #include
7 |
8 | typedef carl::Constraint Constraint;
9 | typedef carl::SimpleConstraint SimpleConstraint;
10 | typedef carl::SimpleConstraint SimpleConstraintRatFunc;
11 | typedef carl::Formula Formula;
12 |
13 |
--------------------------------------------------------------------------------
/src/pycarl/typed_parse/parser.cpp:
--------------------------------------------------------------------------------
1 | #include "parser.h"
2 |
3 | ParserResultWrapper from_string(const std::string& input) {
4 | ParserResultWrapper res;
5 | res._content = carlparser::deserialize(input);
6 | return res;
7 | }
--------------------------------------------------------------------------------
/src/pycarl/typed_parse/parser.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "src/pycarl/common.h"
4 | #include "src/pycarl/types.h"
5 | #include
6 | #include
7 | #include
8 |
9 | template
10 | struct ParserResultWrapper {
11 | carlparser::parser_types _content;
12 |
13 | carlparser::ParserReturnType getType() const {
14 | return carlparser::check_type(_content);
15 | }
16 |
17 | typename Pol::CoeffType asRational() const {
18 | return boost::get(_content);
19 | }
20 |
21 | carl::Monomial::Arg asMonomial() const {
22 | return boost::get(_content);
23 | }
24 |
25 | carl::Variable asVariable() const {
26 | return boost::get(_content);
27 | }
28 |
29 | carl::Term asTerm() const {
30 | return boost::get>(_content);
31 | }
32 |
33 | Pol asPolynomial() const {
34 | return boost::get(_content);
35 | }
36 |
37 | carl::RationalFunction asRationalFunction() const {
38 | auto rf = boost::get>(_content);
39 | return carl::RationalFunction(rf.nominatorAsPolynomial(), rf.denominatorAsPolynomial());
40 | }
41 |
42 | carl::Constraint asConstraint() const {
43 | return boost::get>(_content);
44 | }
45 |
46 | carl::Formula asFormula() const {
47 | return boost::get>(_content);
48 | }
49 | };
50 |
51 | ParserResultWrapper from_string(const std::string& input);
52 |
--------------------------------------------------------------------------------
/src/pycarl/types.h:
--------------------------------------------------------------------------------
1 | #include "pycarl/definitions.h"
2 |
3 | #include
4 | #include
5 | #include
6 | #include
7 | #include
8 | #include
9 | #include
10 |
11 | #ifdef PYCARL_USE_CLN
12 | #include "types/cln_types.h"
13 | #else
14 | #include "types/gmp_types.h"
15 | #endif
16 |
17 | typedef carl::Monomial Monomial;
18 | typedef carl::Term Term;
19 | typedef carl::MultivariatePolynomial Polynomial;
20 | typedef carl::Factorization Factorization;
21 | typedef carl::FactorizedPolynomial FactorizedPolynomial;
22 | typedef carl::RationalFunction RationalFunction;
23 | typedef carl::RationalFunction FactorizedRationalFunction;
24 | typedef carl::PolynomialFactorizationPair FactorizationPair;
25 |
--------------------------------------------------------------------------------
/src/pycarl/types/cln_types.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "pycarl/definitions.h"
4 | #include
5 |
6 |
7 | typedef cln::cl_RA Rational;
8 | typedef cln::cl_I Integer;
9 |
10 |
--------------------------------------------------------------------------------
/src/pycarl/types/gmp_types.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 | #include
3 |
4 |
5 | typedef mpq_class Rational;
6 | typedef mpz_class Integer;
--------------------------------------------------------------------------------
/src/storage/bitvector.h:
--------------------------------------------------------------------------------
1 | #ifndef PYTHON_STORAGE_BITVECTOR_H_
2 | #define PYTHON_STORAGE_BITVECTOR_H_
3 |
4 | #include "common.h"
5 |
6 | void define_bitvector(py::module& m);
7 |
8 | #endif /* PYTHON_STORAGE_BITVECTOR_H_ */
9 |
--------------------------------------------------------------------------------
/src/storage/choiceorigins.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "common.h"
4 |
5 |
6 | void define_origins(py::module& m);
--------------------------------------------------------------------------------
/src/storage/common.h:
--------------------------------------------------------------------------------
1 | #include "src/common.h"
2 |
--------------------------------------------------------------------------------
/src/storage/dd.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "common.h"
4 | #include "storm/storage/dd/DdType.h"
5 |
6 | template
7 | void define_dd(py::module& m, std::string const& libname);
8 | void define_dd_nt(py::module& m);
--------------------------------------------------------------------------------
/src/storage/decomposition.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "common.h"
4 |
5 | void define_maximal_end_components(py::module& m);
6 |
7 | template
8 | void define_maximal_end_component_decomposition(py::module& m, std::string const& vt_suffix);
9 |
--------------------------------------------------------------------------------
/src/storage/distribution.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include "distribution.h"
3 | #include "src/helpers.h"
4 |
5 | #include "storm/storage/Distribution.h"
6 |
7 | template
8 | void define_distribution(py::module& m, std::string vt_suffix) {
9 | using Distrib = storm::storage::Distribution;
10 |
11 | std::string distributionClassName = std::string("Distribution") + vt_suffix;
12 | py::class_ distribution(m, distributionClassName.c_str(), "Finite Support Distribution");
13 | distribution
14 | .def("__str__", &streamToString);
15 | }
16 |
17 |
18 | template void define_distribution(py::module&, std::string vt_suffix);
19 | template void define_distribution(py::module&, std::string vt_suffix);
20 | template void define_distribution(py::module&, std::string vt_suffix);
21 |
--------------------------------------------------------------------------------
/src/storage/distribution.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "common.h"
4 |
5 | template
6 | void define_distribution(py::module& m, std::string vt_suffix);
--------------------------------------------------------------------------------
/src/storage/expressions.h:
--------------------------------------------------------------------------------
1 | #ifndef PYTHON_STORAGE_EXPRESSIONS_H_
2 | #define PYTHON_STORAGE_EXPRESSIONS_H_
3 |
4 | #include "common.h"
5 |
6 | void define_expressions(py::module& m);
7 |
8 | #endif /* PYTHON_STORAGE_EXPRESSIONS_H_ */
9 |
--------------------------------------------------------------------------------
/src/storage/geometry.cpp:
--------------------------------------------------------------------------------
1 | #include "geometry.h"
2 | #include "src/helpers.h"
3 | #include
4 |
5 | template
6 | void define_geometry(py::module& m, std::string vt_suffix) {
7 | typedef storm::storage::geometry::Polytope Polytope;
8 | py::class_> polytope(m, ("Polytope" + vt_suffix).c_str());
9 | polytope.def_property_readonly("vertices", &Polytope::getVertices);
10 | polytope.def("create_downward_closure", &Polytope::downwardClosure);
11 | polytope.def("get_vertices_clockwise", &Polytope::getVerticesInClockwiseOrder);
12 |
13 | }
14 |
15 | template
16 | void define_geometry(py::module&, std::string);
17 | template
18 | void define_geometry(py::module&, std::string);
19 |
20 |
21 |
--------------------------------------------------------------------------------
/src/storage/geometry.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "common.h"
4 |
5 | template
6 | void define_geometry(py::module& m, std::string vt_suffix);
--------------------------------------------------------------------------------
/src/storage/jani.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "common.h"
4 |
5 | void define_jani(py::module& m);
6 | void define_jani_transformers(py::module& m);
--------------------------------------------------------------------------------
/src/storage/labeling.h:
--------------------------------------------------------------------------------
1 | #ifndef PYTHON_STORAGE_LABELING_H_
2 | #define PYTHON_STORAGE_LABELING_H_
3 |
4 | #include "common.h"
5 |
6 | void define_labeling(py::module& m);
7 |
8 | #endif /* PYTHON_STORAGE_LABELING_H_ */
9 |
--------------------------------------------------------------------------------
/src/storage/matrix.h:
--------------------------------------------------------------------------------
1 | #ifndef PYTHON_STORAGE_MATRIX_H_
2 | #define PYTHON_STORAGE_MATRIX_H_
3 |
4 | #include "common.h"
5 |
6 | template
7 | void define_sparse_matrix(py::module& m, std::string const& vtSuffix);
8 |
9 | void define_sparse_matrix_nt(py::module& m);
10 |
11 | #endif /* PYTHON_STORAGE_MATRIX_H_ */
12 |
--------------------------------------------------------------------------------
/src/storage/model.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "common.h"
4 | #include "storm/storage/dd/DdType.h"
5 |
6 | void define_model(py::module& m);
7 | template
8 | void define_sparse_model(py::module& m, std::string const& vtSuffix);
9 | void define_sparse_parametric_model(py::module& m);
10 | void define_sparse_interval_model(py::module& m);
11 |
12 | template
13 | void define_symbolic_model(py::module& m, std::string vt_suffix);
14 |
--------------------------------------------------------------------------------
/src/storage/model_components.h:
--------------------------------------------------------------------------------
1 | #ifndef PYTHON_STORAGE_SPARSEMODELCOMPONENTS_H
2 | #define PYTHON_STORAGE_SPARSEMODELCOMPONENTS_H
3 |
4 | #include "common.h"
5 |
6 | template
7 | void define_sparse_model_components(py::module& m, std::string const& vtSuffix);
8 |
9 | #endif /* PYTHON_STORAGE_SPARSEMODELCOMPONENTS_H */
--------------------------------------------------------------------------------
/src/storage/prism.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "common.h"
4 |
5 | void define_prism(py::module& m);
6 |
--------------------------------------------------------------------------------
/src/storage/scheduler.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "common.h"
4 |
5 |
6 | template
7 | void define_scheduler(py::module& m, std::string vt_suffix);
8 |
--------------------------------------------------------------------------------
/src/storage/valuation.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "common.h"
4 |
5 | void define_statevaluation(py::module& m);
6 | void define_simplevaluation(py::module& m);
--------------------------------------------------------------------------------
/src/utility/chrono.cpp:
--------------------------------------------------------------------------------
1 | #include "chrono.h"
2 | #include "src/helpers.h"
3 |
4 | #include
5 |
6 | void define_chrono(py::module& m) {
7 | py::class_(m, "milliseconds")
8 | .def("count", &std::chrono::milliseconds::count)
9 | .def("__str__", [](std::chrono::milliseconds const& t) { std::stringstream strstr; strstr << t.count(); return strstr.str(); });
10 | }
--------------------------------------------------------------------------------
/src/utility/chrono.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "src/common.h"
4 |
5 | void define_chrono(py::module& m);
--------------------------------------------------------------------------------
/src/utility/json.cpp:
--------------------------------------------------------------------------------
1 | #include "json.h"
2 | #include "src/helpers.h"
3 | #include
4 |
5 | template
6 | void define_json(py::module& m, std::string const& vtSuffix) {
7 | py::class_> jsoncont(m, ("JsonContainer" + vtSuffix).c_str(), "Storm-internal container for JSON structures");
8 | jsoncont.def("__str__", [](storm::json const& container) {return container.dump(4);});
9 | jsoncont.def("__getitem__", [](storm::json const& container, std::string const& item) {return container[item]; });
10 | }
11 |
12 | template void define_json (py::module& m, std::string const& vtSuffix);
13 | template void define_json (py::module& m, std::string const& vtSuffix);
--------------------------------------------------------------------------------
/src/utility/json.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "src/common.h"
4 |
5 | template
6 | void define_json(py::module& m, std::string const& vtSuffix);
--------------------------------------------------------------------------------
/src/utility/shortestPaths.h:
--------------------------------------------------------------------------------
1 | #ifndef PYTHON_UTILITY_SHORTESTPATHS_H_
2 | #define PYTHON_UTILITY_SHORTESTPATHS_H_
3 |
4 | #include "src/common.h"
5 |
6 | void define_ksp(py::module& m);
7 |
8 | #endif /* PYTHON_UTILITY_SHORTESTPATHS_H_ */
9 |
--------------------------------------------------------------------------------
/src/utility/smtsolver.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "src/common.h"
4 |
5 | void define_smt(py::module& m);
--------------------------------------------------------------------------------
/tests/conftest.py:
--------------------------------------------------------------------------------
1 | import sys
2 | import os
3 |
4 | sys.path.append(os.path.join(os.path.dirname(__file__), "helpers"))
5 |
--------------------------------------------------------------------------------
/tests/core/test_core.py:
--------------------------------------------------------------------------------
1 | class TestCore:
2 | def test_init(self):
3 | import stormpy
4 |
5 | def test_pycarl(self):
6 | import stormpy
7 |
8 | rational = stormpy.Rational(0.25)
9 | assert str(rational) == "1/4"
10 | pol1 = stormpy.FactorizedPolynomial(32)
11 | pol2 = stormpy.FactorizedPolynomial(2)
12 | rat = stormpy.FactorizedRationalFunction(pol1, pol2)
13 | assert str(rat) == "16"
14 |
--------------------------------------------------------------------------------
/tests/core/test_environment.py:
--------------------------------------------------------------------------------
1 | import stormpy
2 | from helpers.helper import get_example_path
3 |
4 |
5 | class TestEnvironment:
6 | def test_environment(self):
7 | env = stormpy.Environment()
8 |
--------------------------------------------------------------------------------
/tests/dft/conftest.py:
--------------------------------------------------------------------------------
1 | from configurations import has_dft
2 |
3 | if has_dft:
4 | import stormpy.dft
5 |
--------------------------------------------------------------------------------
/tests/dft/test_module.py:
--------------------------------------------------------------------------------
1 | import os
2 |
3 | import stormpy
4 | from helpers.helper import get_example_path
5 |
6 | from configurations import dft
7 |
8 |
9 | @dft
10 | class TestModule:
11 | def test_module(self):
12 | dft = stormpy.dft.load_dft_galileo_file(get_example_path("dft", "hecs.dft"))
13 | assert dft.nr_elements() == 23
14 | assert dft.nr_be() == 13
15 | assert dft.nr_dynamic() == 2
16 | module = dft.modules()
17 | assert dft.get_element(module.representative()).name == "n0"
18 | assert len(module.elements()) == 1
19 | assert len(module.submodules()) == 4
20 | for submodule in module.submodules():
21 | assert dft.get_element(submodule.representative()).name in ["n116", "n137", "n120", "n21"]
22 | assert len(submodule.elements()) in [1, 7]
23 | assert len(submodule.submodules()) in [0, 2, 3, 7]
24 |
25 | def test_module_json(self):
26 | dft = stormpy.dft.load_dft_galileo_file(get_example_path("dft", "hecs.dft"))
27 | json = stormpy.dft.modules_json(dft)
28 | assert json["representative"]["name"] == "n0"
29 | assert len(json["elements"]) == 1
30 | assert len(json["submodules"]) == 4
31 | for submodule in json["submodules"]:
32 | assert submodule["representative"]["name"] in ["n116", "n137", "n120", "n21"]
33 | assert len(submodule["elements"]) in [1, 7]
34 | assert len(submodule["submodules"]) in [0, 2, 3, 7]
35 |
--------------------------------------------------------------------------------
/tests/dft/test_transformations.py:
--------------------------------------------------------------------------------
1 | import stormpy
2 | from helpers.helper import get_example_path
3 | from stormpy import pycarl
4 |
5 | import math
6 | from configurations import dft
7 |
8 |
9 | @dft
10 | class TestTransformations:
11 |
12 | def test_instantiate_dft(self):
13 | pycarl.clear_pools()
14 | dft = stormpy.dft.load_parametric_dft_galileo_file(get_example_path("dft", "symmetry_param.dft"))
15 | assert dft.nr_elements() == 7
16 | assert dft.nr_be() == 4
17 |
18 | instantiator = stormpy.dft.DFTInstantiator(dft)
19 | x = pycarl.variable_with_name("x")
20 | y = pycarl.variable_with_name("y")
21 | valuation = {x: stormpy.RationalRF("5"), y: stormpy.RationalRF("0.01")}
22 | inst_dft = instantiator.instantiate(valuation)
23 | assert inst_dft.nr_elements() == 7
24 | assert inst_dft.nr_be() == 4
25 | elem = inst_dft.get_element_by_name("C")
26 | assert str(elem) == "{C} BE(exp 5, 0.05)"
27 | elem = inst_dft.get_element_by_name("D")
28 | assert str(elem) == "{D} BE(exp 0.01, 0)"
29 |
--------------------------------------------------------------------------------
/tests/gspn/conftest.py:
--------------------------------------------------------------------------------
1 | from configurations import has_gspn
2 |
3 | if has_gspn:
4 | import stormpy.gspn
5 |
--------------------------------------------------------------------------------
/tests/helpers/helper.py:
--------------------------------------------------------------------------------
1 | import os
2 | import stormpy
3 | import stormpy.examples
4 | import stormpy.examples.files
5 |
6 | example_dir = stormpy.examples.files.testfile_dir
7 |
8 |
9 | def get_example_path(*paths):
10 | return os.path.join(example_dir, *paths)
11 |
--------------------------------------------------------------------------------
/tests/info/test_info.py:
--------------------------------------------------------------------------------
1 | import stormpy
2 | import stormpy.info
3 |
4 |
5 | class TestInfo:
6 | def test_version(self):
7 | assert isinstance(stormpy.info.Version.short, str) and "." in stormpy.info.Version.short
8 | assert isinstance(stormpy.info.Version.long, str) and "Version" in stormpy.info.Version.long
9 | assert isinstance(stormpy.info.Version.build_info, str) and "Compiled" in stormpy.info.Version.build_info
10 |
11 | def test_version_equal(self):
12 | assert stormpy.info.storm_version() in stormpy.info.Version.short
13 | assert (stormpy.info.Version.development and stormpy.info.Version.short.endswith(" (dev)")) or not stormpy.info.Version.development
14 |
--------------------------------------------------------------------------------
/tests/pars/conftest.py:
--------------------------------------------------------------------------------
1 | from configurations import has_pars
2 |
3 | if has_pars:
4 | import stormpy.pars
5 |
--------------------------------------------------------------------------------
/tests/pomdp/conftest.py:
--------------------------------------------------------------------------------
1 | from configurations import has_pomdp
2 |
3 | if has_pomdp:
4 | import stormpy.pomdp
5 |
--------------------------------------------------------------------------------
/tests/pycarl/conftest.py:
--------------------------------------------------------------------------------
1 | # Intentionally empty
2 |
--------------------------------------------------------------------------------
/tests/pycarl/convert/conftest.py:
--------------------------------------------------------------------------------
1 | from stormpy import pycarl
2 | from stormpy.pycarl import convert
3 | from stormpy.pycarl import formula
4 | from stormpy.pycarl import gmp
5 | from stormpy.pycarl.gmp import formula
6 |
7 | if pycarl.has_cln():
8 | from stormpy.pycarl import cln
9 | from stormpy.pycarl.cln import formula
10 |
--------------------------------------------------------------------------------
/tests/pycarl/convert/test_convert_python_types.py:
--------------------------------------------------------------------------------
1 | import pytest
2 | from stormpy import pycarl
3 |
4 | parameters = [(pycarl.gmp, pycarl.convert.gmp_converter)]
5 | names = ["gmp_converter"]
6 |
7 | if pycarl.has_cln():
8 | parameters.append((pycarl.cln, pycarl.convert.cln_converter))
9 | names.append("cln_converter")
10 |
11 |
12 | @pytest.mark.parametrize("convert_package,converter", parameters, ids=names)
13 | class TestConvertExplicit:
14 | def test_convert_int(self, convert_package, converter):
15 | original = -2
16 | assert isinstance(original, int)
17 | converted = converter.convert_integer(original)
18 | assert isinstance(converted, convert_package.Integer)
19 |
20 | def test_convert_float(self, convert_package, converter):
21 | original = 43.12
22 | assert isinstance(original, float)
23 | converted = converter.convert_rational(original)
24 | assert isinstance(converted, convert_package.Rational)
25 |
--------------------------------------------------------------------------------
/tests/pycarl/core/test_factorized_rational_function.py:
--------------------------------------------------------------------------------
1 | from stormpy import pycarl
2 | from configurations import PackageSelector
3 |
4 |
5 | class TestFactorizedRationalFunction(PackageSelector):
6 | def test_init(self, package):
7 | pol1 = package.FactorizedPolynomial(32)
8 | pol2 = package.FactorizedPolynomial(2)
9 | rat = package.FactorizedRationalFunction(pol1, pol2)
10 | assert rat.numerator == 16
11 | assert rat.denominator == 1
12 |
13 | def test_derivation(self, package):
14 | x = pycarl.Variable("x")
15 | p1 = package.create_factorized_polynomial(x * x + package.Integer(3))
16 | p2 = package.create_factorized_polynomial(x + package.Integer(1))
17 |
18 | rat = package.FactorizedRationalFunction(p1, p2)
19 | derivation = rat.derive(x)
20 |
21 | pe1 = package.create_factorized_polynomial(package.Integer(2) * x + x * x - 3)
22 | pe2 = package.create_factorized_polynomial((x + package.Integer(1)) * (x + package.Integer(1)))
23 | expected = package.FactorizedRationalFunction(pe1, pe2)
24 | assert derivation == expected
25 |
--------------------------------------------------------------------------------
/tests/pycarl/core/test_infinity.py:
--------------------------------------------------------------------------------
1 | from stormpy import pycarl
2 |
3 |
4 | def test_infinity_comparison():
5 | assert not pycarl.inf < pycarl.inf
6 | assert -pycarl.inf < pycarl.inf
7 | assert not pycarl.inf < -pycarl.inf
8 | assert not -pycarl.inf < -pycarl.inf
9 | assert not pycarl.inf > pycarl.inf
10 | assert not -pycarl.inf > pycarl.inf
11 | assert pycarl.inf > -pycarl.inf
12 | assert not -pycarl.inf > -pycarl.inf
13 | assert pycarl.inf <= pycarl.inf
14 | assert -pycarl.inf <= pycarl.inf
15 | assert not pycarl.inf <= -pycarl.inf
16 | assert -pycarl.inf <= -pycarl.inf
17 | assert pycarl.inf >= pycarl.inf
18 | assert not -pycarl.inf >= pycarl.inf
19 | assert pycarl.inf >= -pycarl.inf
20 | assert -pycarl.inf >= -pycarl.inf
21 |
--------------------------------------------------------------------------------
/tests/pycarl/core/test_interval.py:
--------------------------------------------------------------------------------
1 | from stormpy import pycarl
2 | from configurations import PackageSelector
3 |
4 |
5 | class TestIntervalDouble:
6 | def test_init(self):
7 | interval = pycarl.Interval(1)
8 | assert interval.isPointInterval
9 | assert interval.lower() == 1
10 |
11 | def test_addition(self):
12 | int1 = pycarl.Interval(2, 4)
13 | int2 = pycarl.Interval(-1, 1)
14 | res = int1 + int2
15 | assert res.lower() == 1
16 | assert res.upper() == 5
17 |
18 |
19 | class TestInterval(PackageSelector):
20 | def test_init(self, package):
21 | interval = package.Interval(package.Rational(1))
22 | assert interval.isPointInterval
23 | assert interval.lower() == 1
24 |
25 | def test_addition(self, package):
26 | int1 = package.Interval(package.Rational(2), package.Rational(4))
27 | int2 = package.Interval(package.Rational(-1), package.Rational(1))
28 | res = int1 + int2
29 | assert res.lower() == 1
30 | assert res.upper() == 5
31 |
--------------------------------------------------------------------------------
/tests/pycarl/core/test_monomial.py:
--------------------------------------------------------------------------------
1 | from stormpy import pycarl
2 |
3 |
4 | class TestCore:
5 | def test_init(self):
6 | var = pycarl.Variable("x")
7 | exp = 1
8 | monom = pycarl.create_monomial(var, exp)
9 |
--------------------------------------------------------------------------------
/tests/pycarl/core/test_monomial_pool.py:
--------------------------------------------------------------------------------
1 | from stormpy import pycarl
2 | from configurations import PackageSelector, pycarl_cln
3 |
4 |
5 | class TestMonomialPool(PackageSelector):
6 | def test_clear(self, package):
7 | pycarl.clear_pools()
8 | var = pycarl.Variable("i")
9 | pol = package.Polynomial(var)
10 |
11 | pycarl.clear_pools()
12 | var = pycarl.Variable("i")
13 | pol = package.Polynomial(var)
14 |
15 | pycarl.clear_pools()
16 | var = pycarl.Variable("i")
17 | pol = package.Polynomial(var)
18 |
19 |
20 | @pycarl_cln
21 | def test_clear_cln():
22 | pycarl.clear_pools()
23 | var = pycarl.Variable("i")
24 | pol = pycarl.cln.Polynomial(var)
25 |
26 | pycarl.clear_pools()
27 | var = pycarl.Variable("i")
28 | pol = pycarl.gmp.Polynomial(var)
29 |
30 | pycarl.clear_pools()
31 | var = pycarl.Variable("i")
32 | pol = pycarl.cln.Polynomial(var)
33 |
--------------------------------------------------------------------------------
/tests/pycarl/core/test_variable.py:
--------------------------------------------------------------------------------
1 | from stormpy import pycarl
2 | import pickle
3 |
4 |
5 | class TestVariable:
6 | def test_init(self):
7 | pycarl.clear_pools()
8 | var = pycarl.Variable("x")
9 | assert var.name == "x"
10 | assert not var.is_no_variable
11 |
12 | def test_eq(self):
13 | pycarl.clear_pools()
14 | var1 = pycarl.Variable("x")
15 | var2 = pycarl.variable_with_name("x")
16 | assert var1 == var2
17 | var3 = pycarl.Variable("y")
18 | assert var1 != var3
19 |
20 | def test_product(self):
21 | pycarl.clear_pools()
22 | x = pycarl.Variable("x")
23 | y = pycarl.Variable("y")
24 | product = x * y
25 |
26 | def test_pickle(self):
27 | pycarl.clear_pools()
28 | var1 = pycarl.Variable("x")
29 | ser = pickle.dumps(var1)
30 | var2 = pickle.loads(ser)
31 | assert var1 == var2
32 | var3 = pycarl.Variable("y")
33 | ser = pickle.dumps(var3)
34 | var4 = pickle.loads(ser)
35 | assert var3 == var4
36 | assert var4 != var2
37 |
--------------------------------------------------------------------------------
/tests/pycarl/formula/conftest.py:
--------------------------------------------------------------------------------
1 | from stormpy import pycarl
2 | from stormpy.pycarl.gmp import formula
3 |
4 | if pycarl.has_cln():
5 | from stormpy.pycarl.cln import formula
6 |
--------------------------------------------------------------------------------
/tests/pycarl/formula/test_constraint.py:
--------------------------------------------------------------------------------
1 | from stormpy import pycarl
2 | from stormpy.pycarl.formula import Relation
3 | from configurations import PackageSelector
4 |
5 |
6 | class TestConstraint(PackageSelector):
7 | def test_init_bool(self, package):
8 | constraint = package.formula.Constraint(True)
9 | assert constraint.relation == Relation.EQ
10 | assert constraint.lhs == 0
11 |
12 | def test_init_var(self, package):
13 | pycarl.clear_pools()
14 | var = pycarl.Variable("x")
15 | bound = package.Rational(3)
16 | constraint = package.formula.Constraint(var, Relation.GREATER, bound)
17 | assert constraint.relation == Relation.LESS
18 |
19 | def test_init_pol(self, package):
20 | pycarl.clear_pools()
21 | var = pycarl.Variable("x")
22 | pol = var * var + package.Integer(2)
23 | constraint = package.formula.Constraint(pol, Relation.LEQ)
24 | assert constraint.relation == Relation.LESS
25 |
--------------------------------------------------------------------------------
/tests/pycarl/formula/test_formula.py:
--------------------------------------------------------------------------------
1 | from stormpy import pycarl
2 | from stormpy.pycarl.formula import Relation, FormulaType
3 |
4 | from configurations import PackageSelector
5 |
6 |
7 | class TestFormula(PackageSelector):
8 | def test_init_constraint(self, package):
9 | pycarl.clear_pools()
10 | x = pycarl.Variable("x")
11 | constraint = package.formula.Constraint(x, Relation.GREATER, package.Rational(3))
12 | formula = package.formula.Formula(constraint)
13 |
14 | def test_negation(self, package):
15 | pycarl.clear_pools()
16 | x = pycarl.Variable("x")
17 | constraint = package.formula.Constraint(x, Relation.GREATER, package.Rational(3))
18 | formula = package.formula.Formula(constraint)
19 | neg_formula = ~constraint
20 | assert neg_formula.type == FormulaType.CONSTRAINT
21 | assert str(~neg_formula) == str(formula)
22 |
23 | def test_conjunction(self, package):
24 | pycarl.clear_pools()
25 | x = pycarl.Variable("x")
26 | y = pycarl.Variable("y")
27 | constraint1 = package.formula.Constraint(x, Relation.GREATER, package.Rational(3))
28 | formula1 = package.formula.Formula(constraint1)
29 | constraint2 = package.formula.Constraint(y, Relation.EQ, package.Rational(2))
30 | formula2 = package.formula.Formula(constraint2)
31 | and_formula = formula1 & formula2
32 | assert and_formula.type == FormulaType.AND
33 | assert len(and_formula) == 2
34 | subformulas = and_formula.get_subformulas()
35 | assert len(subformulas) == 2
36 | assert str(subformulas[0]) == str(formula1)
37 | assert str(subformulas[1]) == str(formula2)
38 |
--------------------------------------------------------------------------------
/tests/pycarl/formula/test_relation.py:
--------------------------------------------------------------------------------
1 | from stormpy import pycarl
2 | from stormpy.pycarl.formula import Relation
3 |
4 |
5 | class TestRelation:
6 | def test_to_string(self):
7 | r = Relation.LESS
8 | assert str(r) == "<"
9 | assert str(Relation.GEQ) == ">="
10 |
--------------------------------------------------------------------------------
/tests/pycarl/parse/conftest.py:
--------------------------------------------------------------------------------
1 | from stormpy import pycarl
2 |
3 | if pycarl.has_parser():
4 | from stormpy.pycarl import parse
5 | from stormpy.pycarl.gmp import parse
6 | from stormpy.pycarl.gmp import formula
7 |
8 | if pycarl.has_cln():
9 | from stormpy.pycarl.cln import parse
10 | from stormpy.pycarl.cln import formula
11 |
--------------------------------------------------------------------------------
/tests/pycarl/parse/test_pycarl_parse.py:
--------------------------------------------------------------------------------
1 | from stormpy import pycarl
2 |
3 | from configurations import PackageSelector, pycarl_parser
4 |
5 |
6 | @pycarl_parser
7 | class TestPycarlParse(PackageSelector):
8 | def test_parse_number(self, package):
9 | num = pycarl.parse.deserialize("2", package)
10 | assert num == package.Rational(2)
11 | num = pycarl.parse.deserialize("-2", package)
12 | assert num == package.Rational(-2)
13 | num = pycarl.parse.deserialize("(- 2)", package)
14 | assert num == package.Rational(-2)
15 |
16 | def test_parse_polynomial(self, package):
17 | pol = pycarl.parse.deserialize("(+ y 1)", package)
18 | assert str(pol) == "y+1"
19 |
20 | def test_parse_rational_function(self, package):
21 | rf = pycarl.parse.deserialize("(/ (+ x 1) (+ y 1))", package)
22 | x = pycarl.variable_with_name("x")
23 | y = pycarl.variable_with_name("y")
24 | assert package.numerator(rf) == package.Polynomial(x) + 1
25 |
26 | def test_parse_constraint(self, package):
27 | constraint = pycarl.parse.deserialize("(< x 0)", package)
28 | assert str(constraint) == "x<0"
29 | constraint = pycarl.parse.deserialize("(< x 1)", package)
30 | x = pycarl.variable_with_name("x")
31 | assert constraint.lhs == x - package.Rational(1)
32 | constraint = pycarl.parse.deserialize("(<= (* (- 1) x) 0)", package)
33 | assert constraint.lhs == -package.Polynomial(x)
34 |
--------------------------------------------------------------------------------
/tests/simulator/test_simulator.py:
--------------------------------------------------------------------------------
1 | import stormpy
2 | import stormpy.simulator
3 | from helpers.helper import get_example_path
4 |
5 |
6 | class TestSparseSimulator:
7 | path = stormpy.examples.files.prism_dtmc_die
8 | prism_program = stormpy.parse_prism_program(path)
9 |
10 | model = stormpy.build_model(prism_program)
11 | simulator = stormpy.simulator.create_simulator(model, seed=42)
12 | final_outcomes = dict()
13 | for n in range(7):
14 | while not simulator.is_done():
15 | observation, reward, labels = simulator.step()
16 | assert len(labels) == 2
17 | assert "done" in labels
18 | if observation not in final_outcomes:
19 | final_outcomes[observation] = 1
20 | else:
21 | final_outcomes[observation] += 1
22 | simulator.restart()
23 |
24 |
25 | class TestPrismSimulator:
26 |
27 | def test_negative_values(self):
28 | prism_program = stormpy.parse_prism_program(get_example_path("dtmc", "negativevals.pm"))
29 | prism_program = stormpy.preprocess_symbolic_input(prism_program, [], "")[0].as_prism_program()
30 |
31 | simulator = stormpy.simulator.create_simulator(prism_program, seed=42)
32 | simulator.set_action_mode(stormpy.simulator.SimulatorActionMode.GLOBAL_NAMES)
33 | state, rew, labels = simulator.restart()
34 | assert state["s"] == -1
35 | assert int(state["s"]) == -1
36 |
--------------------------------------------------------------------------------
/tests/storage/test_bitvector.py:
--------------------------------------------------------------------------------
1 | import stormpy
2 |
3 |
4 | class TestBitvector:
5 | def test_init_default(self):
6 | bit = stormpy.BitVector()
7 | assert bit.size() == 0
8 | assert bit.number_of_set_bits() == 0
9 |
10 | def test_init_length(self):
11 | bit = stormpy.BitVector(10)
12 | assert bit.size() == 10
13 | assert bit.number_of_set_bits() == 0
14 | bit = stormpy.BitVector(5, True)
15 | assert bit.size() == 5
16 | assert bit.number_of_set_bits() == 5
17 |
18 | def test_init_vector(self):
19 | bit = stormpy.BitVector(5, [2, 3])
20 | assert bit.size() == 5
21 | assert bit.number_of_set_bits() == 2
22 | assert bit.get(0) is False
23 | assert bit.get(1) is False
24 | assert bit.get(2) is True
25 | assert bit.get(3) is True
26 | assert bit.get(4) is False
27 |
28 | def test_init_bitvector(self):
29 | bit = stormpy.BitVector(7, [0, 6])
30 | bit2 = stormpy.BitVector(bit)
31 | assert bit == bit2
32 | assert bit2.get(0) is True
33 | assert bit2.get(6) is True
34 |
35 | def test_negate(self):
36 | bit = stormpy.BitVector(7, [0, 6])
37 | bit2 = stormpy.BitVector(bit)
38 | bit = ~bit
39 | assert bit.get(0) is False
40 | assert bit.get(6) is False
41 | for i in range(bit.size()):
42 | assert bit.get(i) is not bit2.get(i)
43 |
--------------------------------------------------------------------------------
/tests/storage/test_jani.py:
--------------------------------------------------------------------------------
1 | import stormpy
2 | from helpers.helper import get_example_path
3 | import pytest
4 |
5 |
6 | class TestJani:
7 |
8 | def test_information_collection(self):
9 | model, properties = stormpy.parse_jani_model(get_example_path("dtmc", "brp.jani"))
10 | information = stormpy.collect_information(model)
11 | assert information.nr_automata == 5
12 | assert information.nr_edges == 31
13 | assert information.nr_variables == 18
14 |
--------------------------------------------------------------------------------