summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErin van der Veen2018-07-06 22:03:22 +0200
committerErin van der Veen2018-07-06 22:03:22 +0200
commit7f013920d7a1ed27a0382ffd228bbdad795db6f4 (patch)
tree5ca57770c3d9df146c6fb3b6e513549a67a29c38
parentTrivial fixes (diff)
parentRemove run.py, add README (diff)
Merge branch 'master' of gitlab.science.ru.nl:eveen/Model-Checking
-rw-r--r--.gitignore2
-rw-r--r--Assignment2/src/README25
-rwxr-xr-xAssignment2/src/run.py47
3 files changed, 25 insertions, 49 deletions
diff --git a/.gitignore b/.gitignore
index ebd6f84..11ee9ea 100644
--- a/.gitignore
+++ b/.gitignore
@@ -17,6 +17,4 @@ _minted-*/
Clean System Files/
dtmc
-__pycache__/
-
*.drn
diff --git a/Assignment2/src/README b/Assignment2/src/README
new file mode 100644
index 0000000..5fa6f9a
--- /dev/null
+++ b/Assignment2/src/README
@@ -0,0 +1,25 @@
+You can run this tool in Docker.
+All you need to do is run:
+
+ ./start.sh die.prism die.properties
+
+Which repairs the model in die.prism for the properties in die.properties.
+
+The first time, this will build the Docker image. This can take a while, and
+may seem to freeze your system, and no progress is reported (unless you remove
+the -q switch in start.sh). The next time will be faster.
+
+The result is a Z3 model which contains instantiations for variables like v0x1.
+These are the values that should be added to the probabilities of transitions
+(here from state 0 to state 1) to make the model satisfy. Additionally, there
+is a variable cost which is the cost of the reparation. By default, this is the
+Sum of Squared Errors measure. To change to the Number of Modified Transitions
+measure, change line 328 of DTMC.icl to:
+
+ # (config,dtmc) = repairConfig NumberModifiedTransitions dtmc
+
+To run Z3 with a minimisation goal, uncomment line 339 in the same line.
+Additionally, to approximate the cost as described in the discussion of the
+paper, add a line like this under line 338:
+
+ # w = addAssert z3 "(> 0.3 cost)" w
diff --git a/Assignment2/src/run.py b/Assignment2/src/run.py
deleted file mode 100755
index 94862bf..0000000
--- a/Assignment2/src/run.py
+++ /dev/null
@@ -1,47 +0,0 @@
-#!/usr/bin/env python3
-from argparse import ArgumentParser, FileType
-import stormpy
-
-# as in https://github.com/moves-rwth/stormpy/blob/master/examples//parametric_models/02-parametric-models.py, but no idea why
-import stormpy.info
-if stormpy.info.storm_ratfunc_use_cln():
- import pycarl.cln.formula
-else:
- import pycarl.gmp.formula
-
-def main():
- parser = ArgumentParser(description='Model Repair tool')
- parser.add_argument('--program', '-p', type=FileType('r'), required=True,
- help='Path to the PRISM program to check and repair')
- parser.add_argument('--properties', '-f', type=FileType('r'), required=True,
- help='Path to the properties to check')
- args = parser.parse_args()
-
- program = stormpy.parse_prism_program(args.program.name)
- properties = args.properties.read()
-
- properties = stormpy.parse_properties_for_prism_program(properties, program)
- model = stormpy.build_parametric_model(program, properties)
-
- print('Built a model with {} states and {} transitions'.format(
- model.nr_states, model.nr_transitions))
- params = model.collect_probability_parameters()
- print('Parameter(s): ' + ', '.join([str(p) for p in params]))
-
- for prop in properties:
- print('Checking:', prop)
-
- result = stormpy.model_checking(model, prop)
- init = model.initial_states[0]
- func = result.at(init)
-
- collector = stormpy.ConstraintCollector(model)
- print('Well-formed constraints:')
- for formula in collector.wellformed_constraints:
- print(formula.get_constraint())
- print('Graph preserving constraints:')
- for formula in collector.graph_preserving_constraints:
- print(formula.get_constraint())
-
-if __name__ == '__main__':
- main()