799 changed files with 63066 additions and 35070 deletions
-
2.gitignore
-
217.travis.yml
-
28CHANGELOG.md
-
60CMakeLists.txt
-
4README.md
-
2doc/checklist_new_release.md
-
54resources/3rdparty/CMakeLists.txt
-
6resources/3rdparty/carl/CMakeLists.txt
-
3191resources/3rdparty/cudd-3.0.0/Makefile.in
-
1256resources/3rdparty/cudd-3.0.0/aclocal.m4
-
19902resources/3rdparty/cudd-3.0.0/configure
-
9resources/3rdparty/z3/output_version.cpp
-
2resources/cmake/find_modules/FindZ3.cmake
-
52resources/cmake/macros/GetGitRevisionDescription.cmake
-
9resources/cmake/macros/GetGitRevisionDescription.cmake.in
-
18resources/cmake/macros/export.cmake
-
11resources/cmake/stormConfigVersion.cmake.in
-
554resources/examples/testfiles/ctmc/cluster2.drn
-
28resources/examples/testfiles/ctmc/simple2.sm
-
4resources/examples/testfiles/dft/and.dft
-
71resources/examples/testfiles/dft/and.json
-
8resources/examples/testfiles/dft/fdep.dft
-
5resources/examples/testfiles/dft/fdep2.dft
-
5resources/examples/testfiles/dft/fdep3.dft
-
7resources/examples/testfiles/dft/fdep4.dft
-
7resources/examples/testfiles/dft/fdep5.dft
-
4resources/examples/testfiles/dft/or.dft
-
4resources/examples/testfiles/dft/pand.dft
-
12resources/examples/testfiles/dft/pdep.dft
-
9resources/examples/testfiles/dft/pdep2.dft
-
5resources/examples/testfiles/dft/pdep3.dft
-
7resources/examples/testfiles/dft/pdep4.dft
-
5resources/examples/testfiles/dft/por.dft
-
5resources/examples/testfiles/dft/seq.dft
-
6resources/examples/testfiles/dft/seq2.dft
-
6resources/examples/testfiles/dft/seq3.dft
-
7resources/examples/testfiles/dft/seq4.dft
-
9resources/examples/testfiles/dft/seq5.dft
-
5resources/examples/testfiles/dft/spare.dft
-
8resources/examples/testfiles/dft/spare2.dft
-
10resources/examples/testfiles/dft/spare3.dft
-
9resources/examples/testfiles/dft/spare4.dft
-
9resources/examples/testfiles/dft/spare5.dft
-
7resources/examples/testfiles/dft/spare6.dft
-
5resources/examples/testfiles/dft/spare7.dft
-
7resources/examples/testfiles/dft/spare8.dft
-
5resources/examples/testfiles/dft/voting.dft
-
5resources/examples/testfiles/dft/voting2.dft
-
5resources/examples/testfiles/dft/voting3.dft
-
6resources/examples/testfiles/dft/voting4.dft
-
32337resources/examples/testfiles/dtmc/crowds-5-5.drn
-
71resources/examples/testfiles/ma/jobscheduler.drn
-
42resources/examples/testfiles/ma/simple2.ma
-
12resources/examples/testfiles/mdp/prism-mec-example1.nm
-
13resources/examples/testfiles/mdp/prism-mec-example2.nm
-
2resources/examples/testfiles/mdp/two_dice.drn
-
4src/CMakeLists.txt
-
4src/storm-cli-utilities/CMakeLists.txt
-
27src/storm-cli-utilities/cli.cpp
-
7src/storm-cli-utilities/cli.h
-
315src/storm-cli-utilities/model-handling.h
-
9src/storm-conv-cli/CMakeLists.txt
-
341src/storm-conv-cli/storm-conv.cpp
-
40src/storm-conv/CMakeLists.txt
-
78src/storm-conv/api/storm-conv.cpp
-
28src/storm-conv/api/storm-conv.h
-
20src/storm-conv/converter/options/JaniConversionOptions.cpp
-
39src/storm-conv/converter/options/JaniConversionOptions.h
-
12src/storm-conv/converter/options/PrismToJaniConverterOptions.cpp
-
21src/storm-conv/converter/options/PrismToJaniConverterOptions.h
-
24src/storm-conv/settings/ConvSettings.cpp
-
11src/storm-conv/settings/ConvSettings.h
-
77src/storm-conv/settings/modules/ConversionGeneralSettings.cpp
-
88src/storm-conv/settings/modules/ConversionGeneralSettings.h
-
114src/storm-conv/settings/modules/ConversionInputSettings.cpp
-
118src/storm-conv/settings/modules/ConversionInputSettings.h
-
57src/storm-conv/settings/modules/ConversionOutputSettings.cpp
-
49src/storm-conv/settings/modules/ConversionOutputSettings.h
-
88src/storm-conv/settings/modules/JaniExportSettings.cpp
-
50src/storm-conv/settings/modules/JaniExportSettings.h
-
40src/storm-counterexamples/CMakeLists.txt
-
2src/storm-counterexamples/api/counterexamples.cpp
-
4src/storm-counterexamples/api/counterexamples.h
-
2src/storm-counterexamples/counterexamples/Counterexample.cpp
-
0src/storm-counterexamples/counterexamples/Counterexample.h
-
2src/storm-counterexamples/counterexamples/HighLevelCounterexample.cpp
-
2src/storm-counterexamples/counterexamples/HighLevelCounterexample.h
-
8src/storm-counterexamples/counterexamples/MILPMinimalLabelSetGenerator.h
-
748src/storm-counterexamples/counterexamples/SMTMinimalLabelSetGenerator.h
-
16src/storm-counterexamples/settings/modules/CounterexampleGeneratorSettings.cpp
-
8src/storm-counterexamples/settings/modules/CounterexampleGeneratorSettings.h
-
2src/storm-dft-cli/CMakeLists.txt
-
197src/storm-dft-cli/storm-dft.cpp
-
4src/storm-dft/CMakeLists.txt
-
74src/storm-dft/api/storm-dft.cpp
-
138src/storm-dft/api/storm-dft.h
-
118src/storm-dft/builder/DFTBuilder.cpp
-
50src/storm-dft/builder/DFTBuilder.h
-
2src/storm-dft/builder/ExplicitDFTModelBuilder.cpp
-
8src/storm-dft/modelchecker/dft/DFTASFChecker.h
3191
resources/3rdparty/cudd-3.0.0/Makefile.in
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
1256
resources/3rdparty/cudd-3.0.0/aclocal.m4
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
19902
resources/3rdparty/cudd-3.0.0/configure
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
@ -0,0 +1,9 @@ |
|||||
|
#include <iostream>
|
||||
|
#include <z3.h>
|
||||
|
|
||||
|
int main() { |
||||
|
unsigned major, minor, build_number, revision_number; |
||||
|
Z3_get_version(&major, &minor, &build_number, &revision_number); |
||||
|
std::cout << major << "." << minor << "." << build_number << std::endl; |
||||
|
return 0; |
||||
|
} |
@ -0,0 +1,11 @@ |
|||||
|
set(PACKAGE_VERSION "@storm_VERSION@") |
||||
|
|
||||
|
# Check whether the requested PACKAGE_FIND_VERSION is compatible |
||||
|
if("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}") |
||||
|
set(PACKAGE_VERSION_COMPATIBLE FALSE) |
||||
|
else() |
||||
|
set(PACKAGE_VERSION_COMPATIBLE TRUE) |
||||
|
if ("${PACKAGE_VERSION}" VERSION_EQUAL "${PACKAGE_FIND_VERSION}") |
||||
|
set(PACKAGE_VERSION_EXACT TRUE) |
||||
|
endif() |
||||
|
endif() |
554
resources/examples/testfiles/ctmc/cluster2.drn
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
@ -0,0 +1,28 @@ |
|||||
|
|
||||
|
ctmc |
||||
|
|
||||
|
|
||||
|
module main |
||||
|
|
||||
|
s : [0..4]; // current state: |
||||
|
|
||||
|
|
||||
|
<> s=0 -> 4 : (s'=1) + 4 : (s'=2); |
||||
|
<> s=1 -> 0.3 : (s'=2) + 0.7 : (s'=1); |
||||
|
<> s=2 -> 0.5 : (s'=2) + 0.5 : (s'=3); |
||||
|
<> s=3 -> 1 : (s'=4); |
||||
|
<> s=4 -> 1 : (s'=3); |
||||
|
|
||||
|
endmodule |
||||
|
|
||||
|
rewards "rew1" |
||||
|
s=0 : 7; |
||||
|
[] s=2 : 1; |
||||
|
endrewards |
||||
|
|
||||
|
|
||||
|
rewards "rew2" |
||||
|
s=0 : 7; |
||||
|
[] s=2 : 1; |
||||
|
[] s=4 : 100; |
||||
|
endrewards |
@ -0,0 +1,4 @@ |
|||||
|
toplevel "A"; |
||||
|
"A" and "B" "C"; |
||||
|
"B" lambda=0.5 dorm=0.3; |
||||
|
"C" lambda=0.5 dorm=0.3; |
@ -0,0 +1,71 @@ |
|||||
|
{ |
||||
|
"toplevel": "2", |
||||
|
"parameters": {}, |
||||
|
"nodes": [ |
||||
|
{ |
||||
|
"data": { |
||||
|
"id": "0", |
||||
|
"name": "A", |
||||
|
"type": "be", |
||||
|
"rate": "1", |
||||
|
"dorm": "1", |
||||
|
"label": "A (1)" |
||||
|
}, |
||||
|
"position": { |
||||
|
"x": 440, |
||||
|
"y": 260 |
||||
|
}, |
||||
|
"group": "nodes", |
||||
|
"removed": false, |
||||
|
"selected": false, |
||||
|
"selectable": true, |
||||
|
"locked": false, |
||||
|
"grabbable": true, |
||||
|
"classes": "be" |
||||
|
}, |
||||
|
{ |
||||
|
"data": { |
||||
|
"id": "1", |
||||
|
"name": "B", |
||||
|
"type": "be", |
||||
|
"rate": "1", |
||||
|
"dorm": "1", |
||||
|
"label": "B (1)" |
||||
|
}, |
||||
|
"position": { |
||||
|
"x": 548, |
||||
|
"y": 265 |
||||
|
}, |
||||
|
"group": "nodes", |
||||
|
"removed": false, |
||||
|
"selected": false, |
||||
|
"selectable": true, |
||||
|
"locked": false, |
||||
|
"grabbable": true, |
||||
|
"classes": "be" |
||||
|
}, |
||||
|
{ |
||||
|
"data": { |
||||
|
"id": "2", |
||||
|
"name": "Z", |
||||
|
"type": "and", |
||||
|
"children": [ |
||||
|
"0", |
||||
|
"1" |
||||
|
], |
||||
|
"label": "Z" |
||||
|
}, |
||||
|
"position": { |
||||
|
"x": 505, |
||||
|
"y": 119 |
||||
|
}, |
||||
|
"group": "nodes", |
||||
|
"removed": false, |
||||
|
"selected": false, |
||||
|
"selectable": true, |
||||
|
"locked": false, |
||||
|
"grabbable": true, |
||||
|
"classes": "and" |
||||
|
} |
||||
|
] |
||||
|
} |
@ -0,0 +1,8 @@ |
|||||
|
toplevel "System"; |
||||
|
"System" or "Power" "Machine"; |
||||
|
"Power" fdep "B_Power" "P" "B"; |
||||
|
"Machine" or "P" "B"; |
||||
|
|
||||
|
"B_Power" lambda=0.5 dorm=0; |
||||
|
"P" lambda=0.5 dorm=0; |
||||
|
"B" lambda=0.5 dorm=0.5; |
@ -0,0 +1,5 @@ |
|||||
|
toplevel "A"; |
||||
|
"A" and "B" "C"; |
||||
|
"F" fdep "B" "C"; |
||||
|
"B" lambda=0.5 dorm=0; |
||||
|
"C" lambda=0.5 dorm=0; |
@ -0,0 +1,5 @@ |
|||||
|
toplevel "A"; |
||||
|
"A" and "B" "C" "F"; |
||||
|
"F" fdep "B" "C"; |
||||
|
"B" lambda=0.4 dorm=0; |
||||
|
"C" lambda=0.8 dorm=0; |
@ -0,0 +1,7 @@ |
|||||
|
toplevel "A"; |
||||
|
"A" or "F" "B"; |
||||
|
"F" fdep "E" "C" "D"; |
||||
|
"B" wsp "C" "D"; |
||||
|
"C" lambda=1 dorm=0; |
||||
|
"D" lambda=1 dorm=0.5; |
||||
|
"E" lambda=0.5 dorm=0; |
@ -0,0 +1,7 @@ |
|||||
|
toplevel "A"; |
||||
|
"A" and "B" "C" "D" "E"; |
||||
|
"F" fdep "B" "C" "D"; |
||||
|
"B" lambda=0.5 dorm=0; |
||||
|
"C" lambda=0.5 dorm=0; |
||||
|
"D" lambda=0.5 dorm=0; |
||||
|
"E" lambda=0.5 dorm=0; |
@ -0,0 +1,4 @@ |
|||||
|
toplevel "A"; |
||||
|
"A" or "B" "C"; |
||||
|
"B" lambda=0.5 dorm=0.3; |
||||
|
"C" lambda=0.5 dorm=0.3; |
@ -0,0 +1,4 @@ |
|||||
|
toplevel "A"; |
||||
|
"A" pand "B" "C"; |
||||
|
"B" lambda=0.4 dorm=0.3; |
||||
|
"C" lambda=0.2 dorm=0.3; |
@ -0,0 +1,12 @@ |
|||||
|
// From Junges2015 |
||||
|
// Example 3.19 |
||||
|
|
||||
|
toplevel "SF"; |
||||
|
"SF" or "A" "B" "PDEP"; |
||||
|
"A" pand "S" "MA"; |
||||
|
"B" and "MA" "MB"; |
||||
|
"PDEP" pdep=0.2 "MA" "S"; |
||||
|
|
||||
|
"S" lambda=0.5 dorm=0; |
||||
|
"MA" lambda=0.5 dorm=0; |
||||
|
"MB" lambda=0.5 dorm=0; |
@ -0,0 +1,9 @@ |
|||||
|
toplevel "SF"; |
||||
|
"SF" or "A" "B" "PDEP"; |
||||
|
"A" pand "S" "MA"; |
||||
|
"B" and "MA" "MB"; |
||||
|
"PDEP" pdep=0.2 "MA" "S" "MB"; |
||||
|
|
||||
|
"S" lambda=0.5 dorm=0; |
||||
|
"MA" lambda=0.5 dorm=0; |
||||
|
"MB" lambda=0.5 dorm=0; |
@ -0,0 +1,5 @@ |
|||||
|
toplevel "A"; |
||||
|
"A" and "B" "C" "F"; |
||||
|
"F" pdep=0.3 "B" "C"; |
||||
|
"B" lambda=0.4 dorm=0; |
||||
|
"C" lambda=0.8 dorm=0; |
@ -0,0 +1,7 @@ |
|||||
|
toplevel "SF"; |
||||
|
"SF" pand "S" "A" "B"; |
||||
|
"PDEP" pdep=0.2 "S" "A" "B"; |
||||
|
|
||||
|
"S" lambda=0.5 dorm=0; |
||||
|
"A" lambda=0.5 dorm=0; |
||||
|
"B" lambda=0.5 dorm=0; |
@ -0,0 +1,5 @@ |
|||||
|
toplevel "A"; |
||||
|
"A" por "B" "C" "D"; |
||||
|
"B" lambda=0.4 dorm=0.0; |
||||
|
"C" lambda=0.2 dorm=0.0; |
||||
|
"D" lambda=0.2 dorm=0.0; |
@ -0,0 +1,5 @@ |
|||||
|
toplevel "A"; |
||||
|
"A" and "B" "C"; |
||||
|
"X" seq "B" "C"; |
||||
|
"B" lambda=0.5 dorm=0.3; |
||||
|
"C" lambda=0.5 dorm=0.3; |
@ -0,0 +1,6 @@ |
|||||
|
toplevel "A"; |
||||
|
"A" and "B" "C" "D"; |
||||
|
"X" seq "B" "C" "D"; |
||||
|
"B" lambda=0.5 dorm=0.3; |
||||
|
"C" lambda=0.5 dorm=0.3; |
||||
|
"D" lambda=0.5 dorm=0.3; |
@ -0,0 +1,6 @@ |
|||||
|
toplevel "A"; |
||||
|
"A" and "C" "D"; |
||||
|
"X" seq "B" "C" "D"; |
||||
|
"B" lambda=0.5 dorm=0.3; |
||||
|
"C" lambda=0.5 dorm=0.3; |
||||
|
"D" lambda=0.5 dorm=0.3; |
@ -0,0 +1,7 @@ |
|||||
|
toplevel "A"; |
||||
|
"A" and "T1" "B3"; |
||||
|
"T1" or "B1" "B2"; |
||||
|
"X" seq "B1" "B2" "B3"; |
||||
|
"B1" lambda=0.5 dorm=0.3; |
||||
|
"B2" lambda=0.5 dorm=0.3; |
||||
|
"B3" lambda=0.5 dorm=0.3; |
@ -0,0 +1,9 @@ |
|||||
|
toplevel "A"; |
||||
|
"A" and "T1" "T2"; |
||||
|
"T1" pand "B1" "B2"; |
||||
|
"T2" pand "B3" "B4"; |
||||
|
"X" seq "B4" "B3"; |
||||
|
"B1" lambda=0.7 dorm=0.3; |
||||
|
"B2" lambda=0.5 dorm=0.3; |
||||
|
"B3" lambda=0.5 dorm=0.3; |
||||
|
"B4" lambda=0.7 dorm=0.3; |
@ -0,0 +1,5 @@ |
|||||
|
toplevel "A"; |
||||
|
"A" wsp "I" "M"; |
||||
|
"I" lambda=0.5 dorm=0.3; |
||||
|
"M" lambda=0.5 dorm=0.3; |
||||
|
|
@ -0,0 +1,8 @@ |
|||||
|
toplevel "A"; |
||||
|
"A" or "B" "C"; |
||||
|
"B" wsp "I" "J"; |
||||
|
"C" wsp "M" "J"; |
||||
|
"I" lambda=0.5 dorm=0.3; |
||||
|
"J" lambda=0.5 dorm=0.3; |
||||
|
"M" lambda=0.5 dorm=0.3; |
||||
|
|
@ -0,0 +1,10 @@ |
|||||
|
toplevel "A"; |
||||
|
"A" or "B" "C" "D"; |
||||
|
"B" wsp "I" "M"; |
||||
|
"C" wsp "J" "M"; |
||||
|
"D" wsp "K" "M"; |
||||
|
"I" lambda=0.5 dorm=0.3; |
||||
|
"J" lambda=0.5 dorm=0.3; |
||||
|
"K" lambda=0.5 dorm=0.3; |
||||
|
"M" lambda=0.5 dorm=0.3; |
||||
|
|
@ -0,0 +1,9 @@ |
|||||
|
toplevel "A"; |
||||
|
"A" and "B" "C"; |
||||
|
"B" wsp "I" "J" "K"; |
||||
|
"C" wsp "M" "J"; |
||||
|
"I" lambda=0.5 dorm=0.3; |
||||
|
"J" lambda=0.5 dorm=0.3; |
||||
|
"K" lambda=0.5 dorm=0.3; |
||||
|
"M" lambda=0.5 dorm=0.3; |
||||
|
|
@ -0,0 +1,9 @@ |
|||||
|
toplevel "A"; |
||||
|
"A" wsp "I" "B"; |
||||
|
"B" or "C" "J"; |
||||
|
"C" or "K" "L"; |
||||
|
"I" lambda=0.5 dorm=0; |
||||
|
"J" lambda=0.5 dorm=0; |
||||
|
"K" lambda=0.5 dorm=0; |
||||
|
"L" lambda=0.5 dorm=0; |
||||
|
|
@ -0,0 +1,7 @@ |
|||||
|
toplevel "A"; |
||||
|
"A" or "I" "B"; |
||||
|
"B" wsp "J" "M"; |
||||
|
"I" lambda=0.5 dorm=0.5; |
||||
|
"J" lambda=0.5 dorm=0.5; |
||||
|
"M" lambda=0.5 dorm=0.5; |
||||
|
|
@ -0,0 +1,5 @@ |
|||||
|
toplevel "A"; |
||||
|
"A" wsp "K" "J" "I"; |
||||
|
"I" lambda=0.5 dorm=0.5; |
||||
|
"J" lambda=1 dorm=0.5; |
||||
|
"K" lambda=0.5 dorm=0.5; |
@ -0,0 +1,7 @@ |
|||||
|
toplevel "A"; |
||||
|
"A" wsp "I" "B"; |
||||
|
"B" wsp "J" "K"; |
||||
|
"I" lambda=0.5 dorm=0.3; |
||||
|
"J" lambda=0.5 dorm=0.3; |
||||
|
"K" lambda=0.5 dorm=0.3; |
||||
|
|
@ -0,0 +1,5 @@ |
|||||
|
toplevel "A"; |
||||
|
"A" 1of3 "B" "C" "D"; |
||||
|
"B" lambda=0.1 dorm=0; |
||||
|
"C" lambda=0.2 dorm=0; |
||||
|
"D" lambda=0.3 dorm=0; |
@ -0,0 +1,5 @@ |
|||||
|
toplevel "A"; |
||||
|
"A" 1of3 "B" "C" "D"; |
||||
|
"B" lambda=0.3 dorm=0; |
||||
|
"C" lambda=0.4 dorm=0; |
||||
|
"D" lambda=1 dorm=0; |
@ -0,0 +1,5 @@ |
|||||
|
toplevel "A"; |
||||
|
"A" 2of3 "B" "C" "D"; |
||||
|
"B" lambda=0.3 dorm=0; |
||||
|
"C" lambda=0.4 dorm=0; |
||||
|
"D" lambda=1 dorm=0; |
@ -0,0 +1,6 @@ |
|||||
|
toplevel "A"; |
||||
|
"A" 2of3 "B" "C" "D"; |
||||
|
"D" or "E"; |
||||
|
"B" lambda=1 dorm=0.0; |
||||
|
"C" lambda=1 dorm=0.0; |
||||
|
"E" lambda=1 dorm=0.0; |
32337
resources/examples/testfiles/dtmc/crowds-5-5.drn
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
@ -0,0 +1,71 @@ |
|||||
|
// Exported by storm |
||||
|
// Original model type: Markov Automaton |
||||
|
@type: Markov Automaton |
||||
|
@parameters |
||||
|
|
||||
|
@reward_models |
||||
|
avg_waiting_time |
||||
|
@nr_states |
||||
|
17 |
||||
|
@model |
||||
|
state 0 !0 [1] init |
||||
|
action 0 [0] |
||||
|
1 : 1 |
||||
|
action 1 [0] |
||||
|
2 : 1 |
||||
|
action 2 [0] |
||||
|
3 : 1 |
||||
|
state 1 !3 [1] |
||||
|
action 0 [0] |
||||
|
4 : 0.333333 |
||||
|
5 : 0.666667 |
||||
|
state 2 !4 [1] |
||||
|
action 0 [0] |
||||
|
4 : 0.25 |
||||
|
6 : 0.75 |
||||
|
state 3 !5 [1] |
||||
|
action 0 [0] |
||||
|
5 : 0.4 |
||||
|
6 : 0.6 |
||||
|
state 4 !0 [0.666667] one_job_finished slowest_before_fastest |
||||
|
action 0 [0] |
||||
|
7 : 1 |
||||
|
state 5 !0 [0.666667] one_job_finished |
||||
|
action 0 [0] |
||||
|
8 : 1 |
||||
|
state 6 !0 [0.666667] one_job_finished |
||||
|
action 0 [0] |
||||
|
9 : 1 |
||||
|
state 7 !5 [0.666667] one_job_finished slowest_before_fastest |
||||
|
action 0 [0] |
||||
|
10 : 0.4 |
||||
|
11 : 0.6 |
||||
|
state 8 !4 [0.666667] one_job_finished |
||||
|
action 0 [0] |
||||
|
10 : 0.25 |
||||
|
12 : 0.75 |
||||
|
state 9 !3 [0.666667] one_job_finished |
||||
|
action 0 [0] |
||||
|
11 : 0.333333 |
||||
|
12 : 0.666667 |
||||
|
state 10 !0 [0.333333] half_of_jobs_finished slowest_before_fastest |
||||
|
action 0 [0] |
||||
|
13 : 1 |
||||
|
state 11 !0 [0.333333] half_of_jobs_finished |
||||
|
action 0 [0] |
||||
|
14 : 1 |
||||
|
state 12 !0 [0.333333] half_of_jobs_finished |
||||
|
action 0 [0] |
||||
|
15 : 1 |
||||
|
state 13 !3 [0.333333] half_of_jobs_finished slowest_before_fastest |
||||
|
action 0 [0] |
||||
|
16 : 1 |
||||
|
state 14 !2 [0.333333] half_of_jobs_finished |
||||
|
action 0 [0] |
||||
|
16 : 1 |
||||
|
state 15 !1 [0.333333] half_of_jobs_finished |
||||
|
action 0 [0] |
||||
|
16 : 1 |
||||
|
state 16 !1 [0] all_jobs_finished deadlock |
||||
|
action 0 [0] |
||||
|
16 : 1 |
@ -0,0 +1,42 @@ |
|||||
|
|
||||
|
ma |
||||
|
|
||||
|
|
||||
|
module main |
||||
|
|
||||
|
s : [0..5]; // current state: |
||||
|
|
||||
|
|
||||
|
<> s=0 -> 4 : (s'=1) + 4 : (s'=2); |
||||
|
[alpha] s=1 -> 1 : (s'=0); |
||||
|
[beta] s=1 -> 0.3 : (s'=5) + 0.7 : (s'=1); |
||||
|
<> s=5 -> 1 : (s'=2); |
||||
|
[gamma] s=2 -> 1 : (s'=1); |
||||
|
[delta] s=2 -> 0.5 : (s'=2) + 0.5 : (s'=3); |
||||
|
<> s=3 -> 1 : (s'=4); |
||||
|
[lambda] s=4 -> 1 : (s'=3); |
||||
|
|
||||
|
endmodule |
||||
|
|
||||
|
rewards "rew0" |
||||
|
[delta] s=2 : 1; |
||||
|
endrewards |
||||
|
|
||||
|
rewards "rew1" |
||||
|
s=0 : 7; |
||||
|
[delta] s=2 : 1; |
||||
|
endrewards |
||||
|
|
||||
|
|
||||
|
rewards "rew2" |
||||
|
s=0 : 7; |
||||
|
[delta] s=2 : 1; |
||||
|
[lambda] s=4 : 100; |
||||
|
endrewards |
||||
|
|
||||
|
rewards "rew3" |
||||
|
s=0 : 7; |
||||
|
[delta] s=2 : 1; |
||||
|
[gamma] s=2 : 100; |
||||
|
[lambda] s=4 : 27; |
||||
|
endrewards |
@ -0,0 +1,12 @@ |
|||||
|
mdp |
||||
|
|
||||
|
module test |
||||
|
|
||||
|
x : [0..2]; |
||||
|
|
||||
|
[] x=0 -> true; |
||||
|
[] x=0 -> 0.5 : (x'=1) + 0.5: (x'=2); |
||||
|
[] x=1 -> (x'=0); |
||||
|
[] x=2 -> true; |
||||
|
|
||||
|
endmodule |
@ -0,0 +1,13 @@ |
|||||
|
mdp |
||||
|
|
||||
|
module test |
||||
|
|
||||
|
x : [0..2]; |
||||
|
|
||||
|
[] x=0 -> true; |
||||
|
[] x=0 -> 0.5 : (x'=1) + 0.5: (x'=1); |
||||
|
[] x=0 -> (x'=2); |
||||
|
[] x=1 -> (x'=0); |
||||
|
[] x=2 -> true; |
||||
|
|
||||
|
endmodule |
@ -0,0 +1,9 @@ |
|||||
|
# Create storm-conv. |
||||
|
add_executable(storm-conv-cli ${PROJECT_SOURCE_DIR}/src/storm-conv-cli/storm-conv.cpp) |
||||
|
target_link_libraries(storm-conv-cli storm-conv storm-cli-utilities) # Adding headers for xcode |
||||
|
set_target_properties(storm-conv-cli PROPERTIES OUTPUT_NAME "storm-conv") |
||||
|
|
||||
|
add_dependencies(binaries storm-conv-cli) |
||||
|
|
||||
|
# installation |
||||
|
install(TARGETS storm-conv-cli EXPORT storm_Targets RUNTIME DESTINATION bin LIBRARY DESTINATION lib OPTIONAL) |
@ -0,0 +1,341 @@ |
|||||
|
|
||||
|
#include "storm-conv/api/storm-conv.h"
|
||||
|
|
||||
|
#include "storm/settings/SettingsManager.h"
|
||||
|
#include "storm-conv/settings/ConvSettings.h"
|
||||
|
#include "storm-conv/settings/modules/ConversionGeneralSettings.h"
|
||||
|
#include "storm-conv/settings/modules/ConversionInputSettings.h"
|
||||
|
#include "storm-conv/settings/modules/ConversionOutputSettings.h"
|
||||
|
|
||||
|
#include "storm/api/storm.h"
|
||||
|
#include "storm-parsers/api/storm-parsers.h"
|
||||
|
#include "storm/utility/initialize.h"
|
||||
|
#include "storm/utility/macros.h"
|
||||
|
#include "storm/utility/Stopwatch.h"
|
||||
|
|
||||
|
#include "storm/storage/SymbolicModelDescription.h"
|
||||
|
#include "storm/storage/jani/Model.h"
|
||||
|
#include "storm/storage/jani/Property.h"
|
||||
|
|
||||
|
|
||||
|
#include "storm-cli-utilities/cli.h"
|
||||
|
#include "storm/exceptions/OptionParserException.h"
|
||||
|
|
||||
|
namespace storm { |
||||
|
namespace conv { |
||||
|
|
||||
|
void setUrgentOptions() { |
||||
|
|
||||
|
// Set the correct log level
|
||||
|
if (storm::settings::getModule<storm::settings::modules::ConversionOutputSettings>().isStdOutOutputEnabled()) { |
||||
|
storm::utility::setLogLevel(l3pp::LogLevel::OFF); |
||||
|
} else { |
||||
|
auto const& general = storm::settings::getModule<storm::settings::modules::ConversionGeneralSettings>(); |
||||
|
if (general.isVerboseSet()) { |
||||
|
storm::utility::setLogLevel(l3pp::LogLevel::INFO); |
||||
|
} |
||||
|
if (general.isDebugOutputSet()) { |
||||
|
storm::utility::setLogLevel(l3pp::LogLevel::DEBUG); |
||||
|
} |
||||
|
if (general.isTraceOutputSet()) { |
||||
|
storm::utility::setLogLevel(l3pp::LogLevel::TRACE); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
storm::utility::Stopwatch startStopwatch(std::string const& message) { |
||||
|
STORM_PRINT_AND_LOG(message); |
||||
|
return storm::utility::Stopwatch(true); |
||||
|
} |
||||
|
|
||||
|
void stopStopwatch(storm::utility::Stopwatch& stopWatch) { |
||||
|
stopWatch.stop(); |
||||
|
STORM_PRINT_AND_LOG(" done. (" << stopWatch << " seconds)." << std::endl); |
||||
|
} |
||||
|
|
||||
|
void processPrismInputJaniOutput(storm::prism::Program const& prismProg, std::vector<storm::jani::Property> const& properties) { |
||||
|
auto const& output = storm::settings::getModule<storm::settings::modules::ConversionOutputSettings>(); |
||||
|
auto const& input = storm::settings::getModule<storm::settings::modules::ConversionInputSettings>(); |
||||
|
auto const& jani = storm::settings::getModule<storm::settings::modules::JaniExportSettings>(); |
||||
|
|
||||
|
auto conversionTime = startStopwatch("Converting PRISM Program to JANI model ... " ); |
||||
|
|
||||
|
storm::converter::PrismToJaniConverterOptions options; |
||||
|
options.allVariablesGlobal = jani.isGlobalVarsSet(); |
||||
|
options.suffix = ""; |
||||
|
options.janiOptions = storm::converter::JaniConversionOptions(jani); |
||||
|
options.janiOptions.substituteConstants = true; |
||||
|
|
||||
|
// Get the name of the output file
|
||||
|
std::string outputFilename = ""; |
||||
|
if (output.isJaniOutputFilenameSet()) { |
||||
|
outputFilename = output.getJaniOutputFilename(); |
||||
|
} else if (input.isPrismInputSet() && !output.isStdOutOutputEnabled()) { |
||||
|
outputFilename = input.getPrismInputFilename(); |
||||
|
// Remove extension if present
|
||||
|
auto dotPos = outputFilename.rfind('.'); |
||||
|
if (dotPos != std::string::npos) { |
||||
|
outputFilename.erase(dotPos); |
||||
|
} |
||||
|
std::string suffix = ""; |
||||
|
if (input.isConstantsSet()) { |
||||
|
suffix = input.getConstantDefinitionString(); |
||||
|
std::replace(suffix.begin(), suffix.end(), ',', '_'); |
||||
|
std::replace(suffix.begin(), suffix.end(), '=', '-'); |
||||
|
} |
||||
|
suffix = suffix + ".jani"; |
||||
|
outputFilename += suffix; |
||||
|
} |
||||
|
|
||||
|
// Find a good model name
|
||||
|
auto startOfFilename = outputFilename.rfind("/"); |
||||
|
if (startOfFilename == std::string::npos) { |
||||
|
startOfFilename = 0; |
||||
|
} else { |
||||
|
++startOfFilename; |
||||
|
} |
||||
|
auto endOfFilename = outputFilename.rfind("."); |
||||
|
if (endOfFilename == std::string::npos) { |
||||
|
endOfFilename = outputFilename.size(); |
||||
|
} |
||||
|
options.janiOptions.modelName = outputFilename.substr(startOfFilename, endOfFilename - startOfFilename); |
||||
|
|
||||
|
|
||||
|
auto janiModelProperties = storm::api::convertPrismToJani(prismProg, properties, options); |
||||
|
|
||||
|
stopStopwatch(conversionTime); |
||||
|
auto exportingTime = startStopwatch("Exporting JANI model ... "); |
||||
|
|
||||
|
if (outputFilename != "") { |
||||
|
storm::api::exportJaniToFile(janiModelProperties.first, janiModelProperties.second, outputFilename, jani.isCompactJsonSet()); |
||||
|
STORM_PRINT_AND_LOG("Stored to file '" << outputFilename << "'"); |
||||
|
} |
||||
|
|
||||
|
if (output.isStdOutOutputEnabled()) { |
||||
|
storm::api::printJaniToStream(janiModelProperties.first, janiModelProperties.second, std::cout, jani.isCompactJsonSet()); |
||||
|
} |
||||
|
stopStopwatch(exportingTime); |
||||
|
} |
||||
|
|
||||
|
void processPrismInput() { |
||||
|
auto parsingTime = startStopwatch("Parsing PRISM input ... " ); |
||||
|
|
||||
|
auto const& input = storm::settings::getModule<storm::settings::modules::ConversionInputSettings>(); |
||||
|
|
||||
|
// Parse the prism program
|
||||
|
storm::storage::SymbolicModelDescription prismProg = storm::api::parseProgram(input.getPrismInputFilename(), input.isPrismCompatibilityEnabled(), false); |
||||
|
|
||||
|
// Parse properties (if available)
|
||||
|
std::vector<storm::jani::Property> properties; |
||||
|
if (input.isPropertyInputSet()) { |
||||
|
boost::optional<std::set<std::string>> propertyFilter = storm::api::parsePropertyFilter(input.getPropertyInputFilter()); |
||||
|
properties = storm::api::parsePropertiesForSymbolicModelDescription(input.getPropertyInput(), prismProg, propertyFilter); |
||||
|
} |
||||
|
|
||||
|
// Set constant definitions in program
|
||||
|
std::string constantDefinitionString = input.getConstantDefinitionString(); |
||||
|
auto constantDefinitions = prismProg.parseConstantDefinitions(constantDefinitionString); |
||||
|
prismProg = storm::storage::SymbolicModelDescription(prismProg.asPrismProgram().defineUndefinedConstants(constantDefinitions)); |
||||
|
// Substitution of constants can only be done after conversion in order to preserve formula definitions in which
|
||||
|
// constants appear that are renamed in some modules...
|
||||
|
|
||||
|
stopStopwatch(parsingTime); |
||||
|
|
||||
|
// Branch on the type of output
|
||||
|
auto const& output = storm::settings::getModule<storm::settings::modules::ConversionOutputSettings>(); |
||||
|
if (output.isJaniOutputSet()) { |
||||
|
processPrismInputJaniOutput(prismProg.asPrismProgram(), properties); |
||||
|
} else { |
||||
|
STORM_LOG_THROW(false, storm::exceptions::InvalidSettingsException, "There is either no outputformat specified or the provided combination of input and output format is not compatible."); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
void processJaniInputJaniOutput(storm::jani::Model const& janiModel, std::vector<storm::jani::Property> const& properties) { |
||||
|
auto conversionTime = startStopwatch("Performing transformations on JANI model ... " ); |
||||
|
|
||||
|
auto const& output = storm::settings::getModule<storm::settings::modules::ConversionOutputSettings>(); |
||||
|
auto const& input = storm::settings::getModule<storm::settings::modules::ConversionInputSettings>(); |
||||
|
auto const& jani = storm::settings::getModule<storm::settings::modules::JaniExportSettings>(); |
||||
|
|
||||
|
storm::converter::JaniConversionOptions options(jani); |
||||
|
|
||||
|
// Get the name of the output file
|
||||
|
std::string outputFilename = ""; |
||||
|
if (output.isJaniOutputFilenameSet()) { |
||||
|
outputFilename = output.getJaniOutputFilename(); |
||||
|
} else if (input.isJaniInputSet() && !output.isStdOutOutputEnabled()) { |
||||
|
outputFilename = input.getJaniInputFilename(); |
||||
|
// Remove extension if present
|
||||
|
auto dotPos = outputFilename.rfind('.'); |
||||
|
if (dotPos != std::string::npos) { |
||||
|
outputFilename.erase(dotPos); |
||||
|
} |
||||
|
outputFilename += "_converted.jani"; |
||||
|
} |
||||
|
|
||||
|
// Get a good model name from the output filename
|
||||
|
auto startOfFilename = outputFilename.rfind("/"); |
||||
|
if (startOfFilename == std::string::npos) { |
||||
|
startOfFilename = 0; |
||||
|
} else { |
||||
|
++startOfFilename; |
||||
|
} |
||||
|
auto endOfFilename = outputFilename.rfind("."); |
||||
|
if (endOfFilename == std::string::npos) { |
||||
|
endOfFilename = outputFilename.size(); |
||||
|
} |
||||
|
options.modelName = outputFilename.substr(startOfFilename, endOfFilename - startOfFilename); |
||||
|
|
||||
|
auto transformedJaniModel = janiModel; |
||||
|
auto transformedProperties = properties; |
||||
|
storm::api::transformJani(transformedJaniModel, transformedProperties, options); |
||||
|
|
||||
|
stopStopwatch(conversionTime); |
||||
|
auto exportingTime = startStopwatch("Exporting JANI model ... "); |
||||
|
|
||||
|
if (outputFilename != "") { |
||||
|
storm::api::exportJaniToFile(transformedJaniModel, transformedProperties, outputFilename, jani.isCompactJsonSet()); |
||||
|
STORM_PRINT_AND_LOG("Stored to file '" << outputFilename << "'"); |
||||
|
} |
||||
|
|
||||
|
if (output.isStdOutOutputEnabled()) { |
||||
|
storm::api::printJaniToStream(transformedJaniModel, transformedProperties, std::cout, jani.isCompactJsonSet()); |
||||
|
} |
||||
|
stopStopwatch(exportingTime); |
||||
|
} |
||||
|
|
||||
|
void processJaniInput() { |
||||
|
auto parsingTime = startStopwatch("Parsing JANI input ... " ); |
||||
|
|
||||
|
auto const& input = storm::settings::getModule<storm::settings::modules::ConversionInputSettings>(); |
||||
|
|
||||
|
// Parse the jani model and selected properties
|
||||
|
boost::optional<std::vector<std::string>> janiPropertyFilter; |
||||
|
if (input.isJaniPropertiesSet()) { |
||||
|
if (input.areJaniPropertiesSelected()) { |
||||
|
janiPropertyFilter = input.getSelectedJaniProperties(); |
||||
|
} else { |
||||
|
janiPropertyFilter = boost::none; |
||||
|
} |
||||
|
} else { |
||||
|
if (input.isPropertyInputSet()) { |
||||
|
janiPropertyFilter = std::vector<std::string>(); |
||||
|
} else { |
||||
|
// If no properties are selected, take the ones from the jani file.
|
||||
|
janiPropertyFilter = boost::none; |
||||
|
} |
||||
|
} |
||||
|
auto janiModelProperties = storm::api::parseJaniModel(input.getJaniInputFilename(), storm::jani::getAllKnownModelFeatures(), janiPropertyFilter); |
||||
|
|
||||
|
// Parse additional properties given from command line
|
||||
|
std::vector<storm::jani::Property> properties = std::move(janiModelProperties.second); |
||||
|
if (input.isPropertyInputSet()) { |
||||
|
boost::optional<std::set<std::string>> propertyFilter = storm::api::parsePropertyFilter(input.getPropertyInputFilter()); |
||||
|
auto additionalProperties = storm::api::parsePropertiesForSymbolicModelDescription(input.getPropertyInput(), janiModelProperties.first, propertyFilter); |
||||
|
properties.insert(properties.end(), additionalProperties.begin(), additionalProperties.end()); |
||||
|
} |
||||
|
|
||||
|
storm::storage::SymbolicModelDescription symbDescr(janiModelProperties.first); |
||||
|
|
||||
|
// Substitute constant definitions in model and properties.
|
||||
|
std::string constantDefinitionString = input.getConstantDefinitionString(); |
||||
|
auto constantDefinitions = symbDescr.parseConstantDefinitions(constantDefinitionString); |
||||
|
auto janiModel = janiModelProperties.first.defineUndefinedConstants(constantDefinitions).substituteConstants(); |
||||
|
if (!properties.empty()) { |
||||
|
properties = storm::api::substituteConstantsInProperties(properties, constantDefinitions); |
||||
|
} |
||||
|
stopStopwatch(parsingTime); |
||||
|
|
||||
|
// Branch on the type of output
|
||||
|
auto const& output = storm::settings::getModule<storm::settings::modules::ConversionOutputSettings>(); |
||||
|
if (output.isJaniOutputSet()) { |
||||
|
processJaniInputJaniOutput(janiModel, properties); |
||||
|
} else { |
||||
|
STORM_LOG_THROW(false, storm::exceptions::InvalidSettingsException, "There is either no outputformat specified or the provided combination of input and output format is not compatible."); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
void processOptions() { |
||||
|
// Start by setting some urgent options (log levels, etc.)
|
||||
|
setUrgentOptions(); |
||||
|
|
||||
|
// Branch on the type of input
|
||||
|
auto const& input = storm::settings::getModule<storm::settings::modules::ConversionInputSettings>(); |
||||
|
STORM_LOG_THROW(!(input.isPrismInputSet() && input.isJaniInputSet()), storm::exceptions::InvalidSettingsException, "Multiple input options were set."); |
||||
|
if (input.isPrismInputSet()) { |
||||
|
processPrismInput(); |
||||
|
} else if (input.isJaniInputSet()) { |
||||
|
processJaniInput(); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
bool parseOptions(const int argc, const char* argv[]) { |
||||
|
try { |
||||
|
storm::settings::mutableManager().setFromCommandLine(argc, argv); |
||||
|
} catch (storm::exceptions::OptionParserException& e) { |
||||
|
storm::settings::manager().printHelp(); |
||||
|
throw e; |
||||
|
return false; |
||||
|
} |
||||
|
|
||||
|
auto const& general = storm::settings::getModule<storm::settings::modules::ConversionGeneralSettings>(); |
||||
|
|
||||
|
// Set options from config file (if given)
|
||||
|
if (general.isConfigSet()) { |
||||
|
storm::settings::mutableManager().setFromConfigurationFile(general.getConfigFilename()); |
||||
|
} |
||||
|
|
||||
|
bool result = true; |
||||
|
if (general.isHelpSet()) { |
||||
|
storm::settings::manager().printHelp(general.getHelpModuleName()); |
||||
|
result = false; |
||||
|
} |
||||
|
|
||||
|
if (general.isVersionSet()) { |
||||
|
storm::cli::printVersion("storm-conv"); |
||||
|
result = false;; |
||||
|
} |
||||
|
|
||||
|
return result; |
||||
|
} |
||||
|
|
||||
|
/*!
|
||||
|
* Main entry point of the executable storm-conv. |
||||
|
*/ |
||||
|
int main(const int argc, const char** argv) { |
||||
|
|
||||
|
try { |
||||
|
storm::utility::setUp(); |
||||
|
|
||||
|
// Print header info only if output to sdtout is disabled
|
||||
|
bool outputToStdOut = false; |
||||
|
for (int i = 1; i < argc; ++i) { |
||||
|
if (std::string(argv[i]) == "--" + storm::settings::modules::ConversionOutputSettings::stdoutOptionName) { |
||||
|
outputToStdOut = true; |
||||
|
} |
||||
|
} |
||||
|
if (outputToStdOut) { |
||||
|
storm::utility::setLogLevel(l3pp::LogLevel::OFF); |
||||
|
} else { |
||||
|
storm::cli::printHeader("Storm-conv", argc, argv); |
||||
|
} |
||||
|
|
||||
|
storm::settings::initializeConvSettings("Storm-conv", "storm-conv"); |
||||
|
if (!parseOptions(argc, argv)) { |
||||
|
return -1; |
||||
|
} |
||||
|
|
||||
|
storm::conv::processOptions(); |
||||
|
|
||||
|
storm::utility::cleanUp(); |
||||
|
return 0; |
||||
|
} catch (storm::exceptions::BaseException const& exception) { |
||||
|
STORM_LOG_ERROR("An exception caused Storm-conv to terminate. The message of the exception is: " << exception.what()); |
||||
|
return 1; |
||||
|
} catch (std::exception const& exception) { |
||||
|
STORM_LOG_ERROR("An unexpected exception occurred and caused Storm-conv to terminate. The message of this exception is: " << exception.what()); |
||||
|
return 2; |
||||
|
} |
||||
|
} |
@ -0,0 +1,40 @@ |
|||||
|
file(GLOB_RECURSE ALL_FILES ${PROJECT_SOURCE_DIR}/src/storm-conv/*.h ${PROJECT_SOURCE_DIR}/src/storm-conv/*.cpp) |
||||
|
|
||||
|
register_source_groups_from_filestructure("${ALL_FILES}" storm-conv) |
||||
|
|
||||
|
|
||||
|
|
||||
|
file(GLOB_RECURSE STORM_CONV_SOURCES ${PROJECT_SOURCE_DIR}/src/storm-conv/*/*.cpp) |
||||
|
file(GLOB_RECURSE STORM_CONV_HEADERS ${PROJECT_SOURCE_DIR}/src/storm-conv/*/*.h) |
||||
|
|
||||
|
|
||||
|
# Create storm-conv. |
||||
|
add_library(storm-conv SHARED ${STORM_CONV_SOURCES} ${STORM_CONV_HEADERS}) |
||||
|
|
||||
|
# Remove define symbol for shared libstorm. |
||||
|
set_target_properties(storm-conv PROPERTIES DEFINE_SYMBOL "") |
||||
|
#add_dependencies(storm resources) |
||||
|
list(APPEND STORM_TARGETS storm-conv) |
||||
|
set(STORM_TARGETS ${STORM_TARGETS} PARENT_SCOPE) |
||||
|
|
||||
|
target_link_libraries(storm-conv PUBLIC storm ${STORM_CONV_LINK_LIBRARIES}) |
||||
|
|
||||
|
# Install storm headers to include directory. |
||||
|
foreach(HEADER ${STORM_CONV_HEADERS}) |
||||
|
string(REGEX REPLACE "${PROJECT_SOURCE_DIR}/src/?" "" RELATIVE_HEADER_PATH ${HEADER}) |
||||
|
string(REGEX MATCH "(.*)[/\\]" RELATIVE_DIRECTORY ${RELATIVE_HEADER_PATH}) |
||||
|
string(REGEX REPLACE "${RELATIVE_DIRECTORY}/?" "" HEADER_FILENAME ${RELATIVE_HEADER_PATH}) |
||||
|
add_custom_command( |
||||
|
OUTPUT ${CMAKE_BINARY_DIR}/include/${RELATIVE_DIRECTORY}${HEADER_FILENAME} |
||||
|
COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/include/${RELATIVE_DIRECTORY} |
||||
|
COMMAND ${CMAKE_COMMAND} -E copy ${HEADER} ${CMAKE_BINARY_DIR}/include/${RELATIVE_DIRECTORY}${HEADER_FILENAME} |
||||
|
DEPENDS ${HEADER} |
||||
|
) |
||||
|
list(APPEND STORM_CONV_OUTPUT_HEADERS "${CMAKE_BINARY_DIR}/include/${RELATIVE_DIRECTORY}${HEADER_FILENAME}") |
||||
|
endforeach() |
||||
|
add_custom_target(copy_storm_conv_headers DEPENDS ${STORM_CONV_OUTPUT_HEADERS} ${STORM_CONV_HEADERS}) |
||||
|
add_dependencies(storm-conv copy_storm_conv_headers) |
||||
|
|
||||
|
# installation |
||||
|
install(TARGETS storm-conv EXPORT storm_Targets RUNTIME DESTINATION bin LIBRARY DESTINATION lib OPTIONAL) |
||||
|
|
@ -0,0 +1,78 @@ |
|||||
|
#include "storm-conv/api/storm-conv.h"
|
||||
|
|
||||
|
#include "storm/storage/prism/Program.h"
|
||||
|
#include "storm/storage/jani/Property.h"
|
||||
|
#include "storm/storage/jani/JaniLocationExpander.h"
|
||||
|
#include "storm/storage/jani/JSONExporter.h"
|
||||
|
|
||||
|
#include "storm/settings/SettingsManager.h"
|
||||
|
#include "storm/settings/modules/CoreSettings.h"
|
||||
|
|
||||
|
namespace storm { |
||||
|
namespace api { |
||||
|
|
||||
|
void transformJani(storm::jani::Model& janiModel, std::vector<storm::jani::Property>& properties, storm::converter::JaniConversionOptions const& options) { |
||||
|
|
||||
|
if (options.substituteConstants) { |
||||
|
janiModel = janiModel.substituteConstants(); |
||||
|
} |
||||
|
|
||||
|
if (!options.locationVariables.empty()) { |
||||
|
for (auto const& pair : options.locationVariables) { |
||||
|
storm::jani::JaniLocationExpander expander(janiModel); |
||||
|
expander.transform(pair.first, pair.second); |
||||
|
janiModel = expander.getResult(); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
if (options.flatten) { |
||||
|
std::shared_ptr<storm::utility::solver::SmtSolverFactory> smtSolverFactory; |
||||
|
if (storm::settings::hasModule<storm::settings::modules::CoreSettings>()) { |
||||
|
smtSolverFactory = std::make_shared<storm::utility::solver::SmtSolverFactory>(); |
||||
|
} else { |
||||
|
smtSolverFactory = std::make_shared<storm::utility::solver::Z3SmtSolverFactory>(); |
||||
|
} |
||||
|
janiModel = janiModel.flattenComposition(smtSolverFactory); |
||||
|
} |
||||
|
|
||||
|
if (!options.edgeAssignments) { |
||||
|
janiModel.pushEdgeAssignmentsToDestinations(); |
||||
|
} |
||||
|
|
||||
|
auto uneliminatedFeatures = janiModel.restrictToFeatures(options.allowedModelFeatures); |
||||
|
STORM_LOG_WARN_COND(uneliminatedFeatures.empty(), "The following model features could not be eliminated: " << uneliminatedFeatures.toString()); |
||||
|
|
||||
|
if (options.modelName) { |
||||
|
janiModel.setName(options.modelName.get()); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
std::pair<storm::jani::Model, std::vector<storm::jani::Property>> convertPrismToJani(storm::prism::Program const& program, std::vector<storm::jani::Property> const& properties, storm::converter::PrismToJaniConverterOptions options) { |
||||
|
|
||||
|
// Perform conversion
|
||||
|
auto res = program.toJani(properties, options.allVariablesGlobal); |
||||
|
if (res.second.empty()) { |
||||
|
std::vector<storm::jani::Property> clondedProperties; |
||||
|
for (auto const& p : properties) { |
||||
|
clondedProperties.push_back(p.clone()); |
||||
|
} |
||||
|
res.second = std::move(clondedProperties); |
||||
|
} |
||||
|
|
||||
|
// Postprocess Jani model based on the options
|
||||
|
transformJani(res.first, res.second, options.janiOptions); |
||||
|
|
||||
|
return res; |
||||
|
} |
||||
|
|
||||
|
void exportJaniToFile(storm::jani::Model const& model, std::vector<storm::jani::Property> const& properties, std::string const& filename, bool compact) { |
||||
|
storm::jani::JsonExporter::toFile(model, properties, filename, true, compact); |
||||
|
} |
||||
|
|
||||
|
void printJaniToStream(storm::jani::Model const& model, std::vector<storm::jani::Property> const& properties, std::ostream& ostream, bool compact) { |
||||
|
storm::jani::JsonExporter::toStream(model, properties, ostream, true, compact); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
} |
||||
|
} |
@ -0,0 +1,28 @@ |
|||||
|
#pragma once |
||||
|
|
||||
|
#include "storm-conv/converter/options/PrismToJaniConverterOptions.h" |
||||
|
#include "storm-conv/converter/options/JaniConversionOptions.h" |
||||
|
|
||||
|
namespace storm { |
||||
|
|
||||
|
namespace prism { |
||||
|
class Program; |
||||
|
} |
||||
|
namespace jani { |
||||
|
class Model; |
||||
|
class Property; |
||||
|
} |
||||
|
|
||||
|
namespace api { |
||||
|
|
||||
|
void transformJani(storm::jani::Model& janiModel, std::vector<storm::jani::Property>& properties, storm::converter::JaniConversionOptions const& options); |
||||
|
|
||||
|
std::pair<storm::jani::Model, std::vector<storm::jani::Property>> convertPrismToJani(storm::prism::Program const& program, std::vector<storm::jani::Property> const& properties = std::vector<storm::jani::Property>(), storm::converter::PrismToJaniConverterOptions options = storm::converter::PrismToJaniConverterOptions()); |
||||
|
|
||||
|
void exportJaniToFile(storm::jani::Model const& model, std::vector<storm::jani::Property> const& properties, std::string const& filename, bool compact = false); |
||||
|
|
||||
|
void printJaniToStream(storm::jani::Model const& model, std::vector<storm::jani::Property> const& properties, std::ostream& ostream, bool compact = false); |
||||
|
|
||||
|
|
||||
|
} |
||||
|
} |
@ -0,0 +1,20 @@ |
|||||
|
#include "storm-conv/converter/options/PrismToJaniConverterOptions.h"
|
||||
|
|
||||
|
namespace storm { |
||||
|
namespace converter { |
||||
|
|
||||
|
JaniConversionOptions::JaniConversionOptions() : edgeAssignments(false), flatten(false), substituteConstants(true), allowedModelFeatures(storm::jani::getAllKnownModelFeatures()) { |
||||
|
// Intentionally left empty
|
||||
|
}; |
||||
|
|
||||
|
JaniConversionOptions::JaniConversionOptions(storm::settings::modules::JaniExportSettings const& settings) : locationVariables(settings.getLocationVariables()), edgeAssignments(settings.isAllowEdgeAssignmentsSet()), flatten(settings.isExportFlattenedSet()), substituteConstants(true), allowedModelFeatures(storm::jani::getAllKnownModelFeatures()) { |
||||
|
if (settings.isEliminateFunctionsSet()) { |
||||
|
allowedModelFeatures.remove(storm::jani::ModelFeature::Functions); |
||||
|
} |
||||
|
if (settings.isEliminateArraysSet()) { |
||||
|
allowedModelFeatures.remove(storm::jani::ModelFeature::Arrays); |
||||
|
} |
||||
|
}; |
||||
|
} |
||||
|
} |
||||
|
|
@ -0,0 +1,39 @@ |
|||||
|
#pragma once |
||||
|
|
||||
|
#include <string> |
||||
|
#include <vector> |
||||
|
#include <boost/optional.hpp> |
||||
|
|
||||
|
#include "storm-conv/settings/modules/JaniExportSettings.h" |
||||
|
#include "storm/storage/jani/ModelFeatures.h" |
||||
|
|
||||
|
namespace storm { |
||||
|
namespace converter { |
||||
|
|
||||
|
struct JaniConversionOptions { |
||||
|
|
||||
|
JaniConversionOptions(); |
||||
|
JaniConversionOptions(storm::settings::modules::JaniExportSettings const& settings); |
||||
|
|
||||
|
/// (Automaton,Variable)-pairs that will be transformed to location variables of the respective automaton. |
||||
|
std::vector<std::pair<std::string, std::string>> locationVariables; |
||||
|
|
||||
|
/// If set, the model might have transient assignments to the edges |
||||
|
bool edgeAssignments; |
||||
|
|
||||
|
/// If set, the model is transformed into a single automaton |
||||
|
bool flatten; |
||||
|
|
||||
|
/// If set, constants in expressions are substituted with their definition |
||||
|
bool substituteConstants; |
||||
|
|
||||
|
/// If given, the model will get this name |
||||
|
boost::optional<std::string> modelName; |
||||
|
|
||||
|
/// Only these model features are allowed in the output |
||||
|
storm::jani::ModelFeatures allowedModelFeatures; |
||||
|
|
||||
|
}; |
||||
|
} |
||||
|
} |
||||
|
|
@ -0,0 +1,12 @@ |
|||||
|
#include "storm-conv/converter/options/PrismToJaniConverterOptions.h"
|
||||
|
|
||||
|
|
||||
|
namespace storm { |
||||
|
namespace converter { |
||||
|
|
||||
|
PrismToJaniConverterOptions::PrismToJaniConverterOptions() : allVariablesGlobal(false), suffix("") { |
||||
|
// Intentionally left empty
|
||||
|
}; |
||||
|
} |
||||
|
} |
||||
|
|
@ -0,0 +1,21 @@ |
|||||
|
#pragma once |
||||
|
|
||||
|
#include <string> |
||||
|
#include "storm-conv/converter/options/JaniConversionOptions.h" |
||||
|
|
||||
|
|
||||
|
namespace storm { |
||||
|
namespace converter { |
||||
|
|
||||
|
|
||||
|
struct PrismToJaniConverterOptions { |
||||
|
|
||||
|
PrismToJaniConverterOptions(); |
||||
|
|
||||
|
bool allVariablesGlobal; |
||||
|
std::string suffix; |
||||
|
JaniConversionOptions janiOptions; |
||||
|
}; |
||||
|
} |
||||
|
} |
||||
|
|
@ -0,0 +1,24 @@ |
|||||
|
#include "storm-conv/settings/ConvSettings.h"
|
||||
|
|
||||
|
#include "storm-conv/settings/modules/ConversionGeneralSettings.h"
|
||||
|
#include "storm-conv/settings/modules/ConversionInputSettings.h"
|
||||
|
#include "storm-conv/settings/modules/ConversionOutputSettings.h"
|
||||
|
#include "storm-conv/settings/modules/JaniExportSettings.h"
|
||||
|
|
||||
|
#include "storm/settings/SettingsManager.h"
|
||||
|
|
||||
|
|
||||
|
namespace storm { |
||||
|
namespace settings { |
||||
|
void initializeConvSettings(std::string const& name, std::string const& executableName) { |
||||
|
storm::settings::mutableManager().setName(name, executableName); |
||||
|
|
||||
|
// Register relevant settings modules.
|
||||
|
storm::settings::addModule<storm::settings::modules::ConversionGeneralSettings>(); |
||||
|
storm::settings::addModule<storm::settings::modules::ConversionInputSettings>(); |
||||
|
storm::settings::addModule<storm::settings::modules::ConversionOutputSettings>(); |
||||
|
storm::settings::addModule<storm::settings::modules::JaniExportSettings>(); |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
} |
@ -0,0 +1,11 @@ |
|||||
|
#pragma once |
||||
|
|
||||
|
#include <string> |
||||
|
|
||||
|
namespace storm { |
||||
|
namespace settings { |
||||
|
|
||||
|
void initializeConvSettings(std::string const& name, std::string const& executableName); |
||||
|
|
||||
|
} |
||||
|
} |
@ -0,0 +1,77 @@ |
|||||
|
#include "storm-conv/settings/modules/ConversionGeneralSettings.h"
|
||||
|
|
||||
|
#include "storm/settings/SettingsManager.h"
|
||||
|
#include "storm/settings/Option.h"
|
||||
|
#include "storm/settings/OptionBuilder.h"
|
||||
|
#include "storm/settings/ArgumentBuilder.h"
|
||||
|
#include "storm/settings/Argument.h"
|
||||
|
|
||||
|
namespace storm { |
||||
|
namespace settings { |
||||
|
namespace modules { |
||||
|
|
||||
|
const std::string ConversionGeneralSettings::moduleName = "general"; |
||||
|
const std::string ConversionGeneralSettings::helpOptionName = "help"; |
||||
|
const std::string ConversionGeneralSettings::helpOptionShortName = "h"; |
||||
|
const std::string ConversionGeneralSettings::versionOptionName = "version"; |
||||
|
const std::string ConversionGeneralSettings::verboseOptionName = "verbose"; |
||||
|
const std::string ConversionGeneralSettings::verboseOptionShortName = "v"; |
||||
|
const std::string ConversionGeneralSettings::debugOptionName = "debug"; |
||||
|
const std::string ConversionGeneralSettings::traceOptionName = "trace"; |
||||
|
const std::string ConversionGeneralSettings::configOptionName = "config"; |
||||
|
const std::string ConversionGeneralSettings::configOptionShortName = "c"; |
||||
|
|
||||
|
ConversionGeneralSettings::ConversionGeneralSettings() : ModuleSettings(moduleName) { |
||||
|
this->addOption(storm::settings::OptionBuilder(moduleName, helpOptionName, false, "Shows all available options, arguments and descriptions.").setShortName(helpOptionShortName) |
||||
|
.addArgument(storm::settings::ArgumentBuilder::createStringArgument("hint", "A regular expression to show help for all matching entities or 'all' for the complete help.").setDefaultValueString("all").build()).build()); |
||||
|
this->addOption(storm::settings::OptionBuilder(moduleName, versionOptionName, false, "Prints the version information.").build()); |
||||
|
this->addOption(storm::settings::OptionBuilder(moduleName, verboseOptionName, false, "Enables more verbose output.").setShortName(verboseOptionShortName).build()); |
||||
|
this->addOption(storm::settings::OptionBuilder(moduleName, debugOptionName, false, "Enables verbose and debug output.").build()); |
||||
|
this->addOption(storm::settings::OptionBuilder(moduleName, traceOptionName, false, "Enables verbose and debug and trace output.").build()); |
||||
|
this->addOption(storm::settings::OptionBuilder(moduleName, configOptionName, false, "If given, this file will be read and parsed for additional configuration settings.").setShortName(configOptionShortName) |
||||
|
.addArgument(storm::settings::ArgumentBuilder::createStringArgument("filename", "The name of the file from which to read the configuration.").addValidatorString(ArgumentValidatorFactory::createExistingFileValidator()).build()).build()); |
||||
|
} |
||||
|
|
||||
|
bool ConversionGeneralSettings::isHelpSet() const { |
||||
|
return this->getOption(helpOptionName).getHasOptionBeenSet(); |
||||
|
} |
||||
|
|
||||
|
bool ConversionGeneralSettings::isVersionSet() const { |
||||
|
return this->getOption(versionOptionName).getHasOptionBeenSet(); |
||||
|
} |
||||
|
|
||||
|
std::string ConversionGeneralSettings::getHelpModuleName() const { |
||||
|
return this->getOption(helpOptionName).getArgumentByName("hint").getValueAsString(); |
||||
|
} |
||||
|
|
||||
|
bool ConversionGeneralSettings::isVerboseSet() const { |
||||
|
return this->getOption(verboseOptionName).getHasOptionBeenSet(); |
||||
|
} |
||||
|
|
||||
|
bool ConversionGeneralSettings::isDebugOutputSet() const { |
||||
|
return this->getOption(debugOptionName).getHasOptionBeenSet(); |
||||
|
} |
||||
|
|
||||
|
bool ConversionGeneralSettings::isTraceOutputSet() const { |
||||
|
return this->getOption(traceOptionName).getHasOptionBeenSet(); |
||||
|
} |
||||
|
|
||||
|
bool ConversionGeneralSettings::isConfigSet() const { |
||||
|
return this->getOption(configOptionName).getHasOptionBeenSet(); |
||||
|
} |
||||
|
|
||||
|
std::string ConversionGeneralSettings::getConfigFilename() const { |
||||
|
return this->getOption(configOptionName).getArgumentByName("filename").getValueAsString(); |
||||
|
} |
||||
|
|
||||
|
void ConversionGeneralSettings::finalize() { |
||||
|
// Intentionally left empty.
|
||||
|
} |
||||
|
|
||||
|
bool ConversionGeneralSettings::check() const { |
||||
|
return true; |
||||
|
} |
||||
|
|
||||
|
} // namespace modules
|
||||
|
} // namespace settings
|
||||
|
} // namespace storm
|
@ -0,0 +1,88 @@ |
|||||
|
#pragma once |
||||
|
#include "storm/settings/modules/ModuleSettings.h" |
||||
|
|
||||
|
namespace storm { |
||||
|
namespace settings { |
||||
|
namespace modules { |
||||
|
|
||||
|
class ConversionGeneralSettings : public ModuleSettings { |
||||
|
public: |
||||
|
|
||||
|
ConversionGeneralSettings(); |
||||
|
|
||||
|
/*! |
||||
|
* Retrieves whether the help option was set. |
||||
|
* |
||||
|
* @return True if the help option was set. |
||||
|
*/ |
||||
|
bool isHelpSet() const; |
||||
|
|
||||
|
/*! |
||||
|
* Retrieves whether the version option was set. |
||||
|
* |
||||
|
* @return True if the version option was set. |
||||
|
*/ |
||||
|
bool isVersionSet() const; |
||||
|
|
||||
|
/*! |
||||
|
* Retrieves the name of the module for which to show the help or "all" to indicate that the full help |
||||
|
* needs to be shown. |
||||
|
* |
||||
|
* @return The name of the module for which to show the help or "all". |
||||
|
*/ |
||||
|
std::string getHelpModuleName() const; |
||||
|
|
||||
|
/*! |
||||
|
* Retrieves whether the verbose option was set. |
||||
|
* |
||||
|
* @return True if the verbose option was set. |
||||
|
*/ |
||||
|
bool isVerboseSet() const; |
||||
|
|
||||
|
/*! |
||||
|
* Retrieves whether the debug output option was set. |
||||
|
* |
||||
|
*/ |
||||
|
bool isDebugOutputSet() const; |
||||
|
|
||||
|
/*! |
||||
|
* Retrieves whether the trace output option was set. |
||||
|
* |
||||
|
*/ |
||||
|
bool isTraceOutputSet() const; |
||||
|
|
||||
|
/*! |
||||
|
* Retrieves whether the config option was set. |
||||
|
* |
||||
|
* @return True if the config option was set. |
||||
|
*/ |
||||
|
bool isConfigSet() const; |
||||
|
|
||||
|
/*! |
||||
|
* Retrieves the name of the file that is to be scanned for settings. |
||||
|
* |
||||
|
* @return The name of the file that is to be scanned for settings. |
||||
|
*/ |
||||
|
std::string getConfigFilename() const; |
||||
|
|
||||
|
bool check() const override; |
||||
|
void finalize() override; |
||||
|
|
||||
|
// The name of the module. |
||||
|
static const std::string moduleName; |
||||
|
|
||||
|
private: |
||||
|
// Define the string names of the options as constants. |
||||
|
static const std::string helpOptionName; |
||||
|
static const std::string helpOptionShortName; |
||||
|
static const std::string versionOptionName; |
||||
|
static const std::string verboseOptionName; |
||||
|
static const std::string verboseOptionShortName; |
||||
|
static const std::string debugOptionName; |
||||
|
static const std::string traceOptionName; |
||||
|
static const std::string configOptionName; |
||||
|
static const std::string configOptionShortName; |
||||
|
}; |
||||
|
} |
||||
|
} |
||||
|
} |
@ -0,0 +1,114 @@ |
|||||
|
#include "storm-conv/settings/modules/ConversionInputSettings.h"
|
||||
|
|
||||
|
#include "storm/settings/SettingsManager.h"
|
||||
|
#include "storm/settings/Option.h"
|
||||
|
#include "storm/settings/OptionBuilder.h"
|
||||
|
#include "storm/settings/ArgumentBuilder.h"
|
||||
|
#include "storm/settings/Argument.h"
|
||||
|
#include "storm/parser/CSVParser.h"
|
||||
|
|
||||
|
#include "storm/exceptions/InvalidSettingsException.h"
|
||||
|
|
||||
|
namespace storm { |
||||
|
namespace settings { |
||||
|
namespace modules { |
||||
|
|
||||
|
const std::string ConversionInputSettings::moduleName = "input"; |
||||
|
const std::string ConversionInputSettings::propertyOptionName = "prop"; |
||||
|
const std::string ConversionInputSettings::propertyOptionShortName = "prop"; |
||||
|
const std::string ConversionInputSettings::constantsOptionName = "constants"; |
||||
|
const std::string ConversionInputSettings::constantsOptionShortName = "const"; |
||||
|
const std::string ConversionInputSettings::prismInputOptionName = "prism"; |
||||
|
const std::string ConversionInputSettings::prismCompatibilityOptionName = "prismcompat"; |
||||
|
const std::string ConversionInputSettings::prismCompatibilityOptionShortName = "pc"; |
||||
|
const std::string ConversionInputSettings::janiInputOptionName = "jani"; |
||||
|
const std::string ConversionInputSettings::janiPropertyOptionName = "janiproperty"; |
||||
|
const std::string ConversionInputSettings::janiPropertyOptionShortName = "jprop"; |
||||
|
|
||||
|
|
||||
|
ConversionInputSettings::ConversionInputSettings() : ModuleSettings(moduleName) { |
||||
|
// General
|
||||
|
this->addOption(storm::settings::OptionBuilder(moduleName, propertyOptionName, false, "Specifies the properties to be checked on the model.").setShortName(propertyOptionShortName) |
||||
|
.addArgument(storm::settings::ArgumentBuilder::createStringArgument("property or filename", "The formula or the file containing the formulas.").build()) |
||||
|
.addArgument(storm::settings::ArgumentBuilder::createStringArgument("filter", "The names of the properties to check.").setDefaultValueString("all").build()) |
||||
|
.build()); |
||||
|
this->addOption(storm::settings::OptionBuilder(moduleName, constantsOptionName, false, "Specifies the constant replacements to use in symbolic models. Note that this requires the model to be given as an symbolic model (e.g., via --" + prismInputOptionName + ").").setShortName(constantsOptionShortName) |
||||
|
.addArgument(storm::settings::ArgumentBuilder::createStringArgument("values", "A comma separated list of constants and their value, e.g. a=1,b=2,c=3.").setDefaultValueString("").build()).build()); |
||||
|
|
||||
|
// Prism related
|
||||
|
this->addOption(storm::settings::OptionBuilder(moduleName, prismInputOptionName, false, "Parses the model given in the PRISM format.") |
||||
|
.addArgument(storm::settings::ArgumentBuilder::createStringArgument("filename", "The name of the file from which to read the PRISM input.").addValidatorString(ArgumentValidatorFactory::createExistingFileValidator()).build()).build()); |
||||
|
this->addOption(storm::settings::OptionBuilder(moduleName, prismCompatibilityOptionName, false, "Enables PRISM compatibility. This may be necessary to process some PRISM models.").setShortName(prismCompatibilityOptionShortName).build()); |
||||
|
|
||||
|
// Jani related
|
||||
|
this->addOption(storm::settings::OptionBuilder(moduleName, janiInputOptionName, false, "Parses the model given in the JANI format.") |
||||
|
.addArgument(storm::settings::ArgumentBuilder::createStringArgument("filename", "The name of the file from which to read the JANI input.").addValidatorString(ArgumentValidatorFactory::createExistingFileValidator()).build()).build()); |
||||
|
this->addOption(storm::settings::OptionBuilder(moduleName, janiPropertyOptionName, false, "Specifies the properties from the jani model (given by --" + janiInputOptionName + ") to be checked.").setShortName(janiPropertyOptionShortName) |
||||
|
.addArgument(storm::settings::ArgumentBuilder::createStringArgument("values", "A comma separated list of properties to be checked").setDefaultValueString("").build()).build()); |
||||
|
|
||||
|
} |
||||
|
|
||||
|
bool ConversionInputSettings::isPrismInputSet() const { |
||||
|
return this->getOption(prismInputOptionName).getHasOptionBeenSet(); |
||||
|
} |
||||
|
|
||||
|
std::string ConversionInputSettings::getPrismInputFilename() const { |
||||
|
return this->getOption(prismInputOptionName).getArgumentByName("filename").getValueAsString(); |
||||
|
} |
||||
|
|
||||
|
bool ConversionInputSettings::isJaniInputSet() const { |
||||
|
return this->getOption(janiInputOptionName).getHasOptionBeenSet(); |
||||
|
} |
||||
|
|
||||
|
std::string ConversionInputSettings::getJaniInputFilename() const { |
||||
|
return this->getOption(janiInputOptionName).getArgumentByName("filename").getValueAsString(); |
||||
|
} |
||||
|
|
||||
|
bool ConversionInputSettings::isPrismCompatibilityEnabled() const { |
||||
|
return this->getOption(prismCompatibilityOptionName).getHasOptionBeenSet(); |
||||
|
} |
||||
|
|
||||
|
bool ConversionInputSettings::isConstantsSet() const { |
||||
|
return this->getOption(constantsOptionName).getHasOptionBeenSet(); |
||||
|
} |
||||
|
|
||||
|
std::string ConversionInputSettings::getConstantDefinitionString() const { |
||||
|
return this->getOption(constantsOptionName).getArgumentByName("values").getValueAsString(); |
||||
|
} |
||||
|
|
||||
|
bool ConversionInputSettings::isPropertyInputSet() const { |
||||
|
return this->getOption(propertyOptionName).getHasOptionBeenSet(); |
||||
|
} |
||||
|
|
||||
|
std::string ConversionInputSettings::getPropertyInput() const { |
||||
|
return this->getOption(propertyOptionName).getArgumentByName("property or filename").getValueAsString(); |
||||
|
} |
||||
|
|
||||
|
std::string ConversionInputSettings::getPropertyInputFilter() const { |
||||
|
return this->getOption(propertyOptionName).getArgumentByName("filter").getValueAsString(); |
||||
|
} |
||||
|
|
||||
|
bool ConversionInputSettings::isJaniPropertiesSet() const { |
||||
|
return this->getOption(janiPropertyOptionName).getHasOptionBeenSet(); |
||||
|
} |
||||
|
|
||||
|
bool ConversionInputSettings::areJaniPropertiesSelected() const { |
||||
|
return this->getOption(janiPropertyOptionName).getHasOptionBeenSet() && (this->getOption(janiPropertyOptionName).getArgumentByName("values").getValueAsString() != ""); |
||||
|
} |
||||
|
|
||||
|
std::vector<std::string> ConversionInputSettings::getSelectedJaniProperties() const { |
||||
|
return storm::parser::parseCommaSeperatedValues(this->getOption(janiPropertyOptionName).getArgumentByName("values").getValueAsString()); |
||||
|
} |
||||
|
|
||||
|
void ConversionInputSettings::finalize() { |
||||
|
// Intentionally left empty.
|
||||
|
} |
||||
|
|
||||
|
bool ConversionInputSettings::check() const { |
||||
|
return true; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
} // namespace modules
|
||||
|
} // namespace settings
|
||||
|
} // namespace storm
|
@ -0,0 +1,118 @@ |
|||||
|
#pragma once |
||||
|
#include "storm/settings/modules/ModuleSettings.h" |
||||
|
|
||||
|
namespace storm { |
||||
|
namespace settings { |
||||
|
namespace modules { |
||||
|
|
||||
|
class ConversionInputSettings : public ModuleSettings { |
||||
|
public: |
||||
|
|
||||
|
ConversionInputSettings(); |
||||
|
|
||||
|
/*! |
||||
|
* Retrieves whether the property option was set. |
||||
|
* |
||||
|
* @return True if the property option was set. |
||||
|
*/ |
||||
|
bool isPropertyInputSet() const; |
||||
|
|
||||
|
/*! |
||||
|
* Retrieves the property specified with the property option. |
||||
|
* |
||||
|
* @return The property specified with the property option. |
||||
|
*/ |
||||
|
std::string getPropertyInput() const; |
||||
|
|
||||
|
/*! |
||||
|
* Retrieves the property filter. |
||||
|
* |
||||
|
* @return The property filter. |
||||
|
*/ |
||||
|
std::string getPropertyInputFilter() const; |
||||
|
|
||||
|
/*! |
||||
|
* Retrieves whether constant definition option was set. |
||||
|
* |
||||
|
* @return True if the constant definition option was set. |
||||
|
*/ |
||||
|
bool isConstantsSet() const; |
||||
|
|
||||
|
/*! |
||||
|
* Retrieves the string that defines the constants of a symbolic model (given via the symbolic option). |
||||
|
* |
||||
|
* @return The string that defines the constants of a symbolic model. |
||||
|
*/ |
||||
|
std::string getConstantDefinitionString() const; |
||||
|
|
||||
|
/*! |
||||
|
* Retrieves whether the PRISM language option was set. |
||||
|
*/ |
||||
|
bool isPrismInputSet() const; |
||||
|
|
||||
|
/*! |
||||
|
* Retrieves the name of the file that contains the PRISM model specification if the model was given |
||||
|
* using the PRISM input option. |
||||
|
*/ |
||||
|
std::string getPrismInputFilename() const; |
||||
|
|
||||
|
/*! |
||||
|
* Retrieves whether the PRISM compatibility mode was enabled. |
||||
|
* |
||||
|
* @return True iff the PRISM compatibility mode was enabled. |
||||
|
*/ |
||||
|
bool isPrismCompatibilityEnabled() const; |
||||
|
|
||||
|
/*! |
||||
|
* Retrieves whether the Jani option was set. |
||||
|
*/ |
||||
|
bool isJaniInputSet() const; |
||||
|
|
||||
|
/*! |
||||
|
* Retrieves the name of the file that contains the jani model specification if the model was given. |
||||
|
*/ |
||||
|
std::string getJaniInputFilename() const; |
||||
|
|
||||
|
/*! |
||||
|
* Retrieves whether the jani-property option was set |
||||
|
* @return |
||||
|
*/ |
||||
|
bool isJaniPropertiesSet() const; |
||||
|
|
||||
|
/*! |
||||
|
* Retrieves whether one or more jani-properties have been selected |
||||
|
* @return |
||||
|
*/ |
||||
|
bool areJaniPropertiesSelected() const; |
||||
|
|
||||
|
/*! |
||||
|
* @return The names of the jani properties to check |
||||
|
*/ |
||||
|
std::vector<std::string> getSelectedJaniProperties() const; |
||||
|
|
||||
|
|
||||
|
|
||||
|
bool check() const override; |
||||
|
void finalize() override; |
||||
|
|
||||
|
// The name of the module. |
||||
|
static const std::string moduleName; |
||||
|
|
||||
|
private: |
||||
|
// Define the string names of the options as constants. |
||||
|
static const std::string propertyOptionName; |
||||
|
static const std::string propertyOptionShortName; |
||||
|
static const std::string constantsOptionName; |
||||
|
static const std::string constantsOptionShortName; |
||||
|
static const std::string prismInputOptionName; |
||||
|
static const std::string prismCompatibilityOptionName; |
||||
|
static const std::string prismCompatibilityOptionShortName; |
||||
|
static const std::string janiInputOptionName; |
||||
|
static const std::string janiPropertyOptionName; |
||||
|
static const std::string janiPropertyOptionShortName; |
||||
|
}; |
||||
|
|
||||
|
|
||||
|
} |
||||
|
} |
||||
|
} |
@ -0,0 +1,57 @@ |
|||||
|
#include "storm-conv/settings/modules/ConversionOutputSettings.h"
|
||||
|
|
||||
|
#include "storm/settings/SettingsManager.h"
|
||||
|
#include "storm/settings/Option.h"
|
||||
|
#include "storm/settings/OptionBuilder.h"
|
||||
|
#include "storm/settings/ArgumentBuilder.h"
|
||||
|
#include "storm/settings/Argument.h"
|
||||
|
|
||||
|
#include "storm/exceptions/InvalidSettingsException.h"
|
||||
|
#include "storm/exceptions/InvalidOperationException.h"
|
||||
|
|
||||
|
namespace storm { |
||||
|
namespace settings { |
||||
|
namespace modules { |
||||
|
|
||||
|
const std::string ConversionOutputSettings::moduleName = "output"; |
||||
|
const std::string ConversionOutputSettings::stdoutOptionName = "stdout"; |
||||
|
const std::string ConversionOutputSettings::janiOutputOptionName = "tojani"; |
||||
|
|
||||
|
ConversionOutputSettings::ConversionOutputSettings() : ModuleSettings(moduleName) { |
||||
|
this->addOption(storm::settings::OptionBuilder(moduleName, stdoutOptionName, false, "If set, the output will be printed to stdout.").build()); |
||||
|
this->addOption(storm::settings::OptionBuilder(moduleName, janiOutputOptionName, false, "converts the input model to Jani.") |
||||
|
.addArgument(storm::settings::ArgumentBuilder::createStringArgument("filename", "the name of the output file (if not empty).").setDefaultValueString("").build()).build()); |
||||
|
} |
||||
|
|
||||
|
bool ConversionOutputSettings::isStdOutOutputEnabled() const { |
||||
|
return this->getOption(stdoutOptionName).getHasOptionBeenSet(); |
||||
|
} |
||||
|
|
||||
|
bool ConversionOutputSettings::isJaniOutputSet() const { |
||||
|
return this->getOption(janiOutputOptionName).getHasOptionBeenSet(); |
||||
|
} |
||||
|
|
||||
|
bool ConversionOutputSettings::isJaniOutputFilenameSet() const { |
||||
|
return isJaniOutputSet() |
||||
|
&& !this->getOption(janiOutputOptionName).getArgumentByName("filename").wasSetFromDefaultValue() |
||||
|
&& this->getOption(janiOutputOptionName).getArgumentByName("filename").getHasBeenSet() |
||||
|
&& this->getOption(janiOutputOptionName).getArgumentByName("filename").getValueAsString() != ""; |
||||
|
} |
||||
|
|
||||
|
std::string ConversionOutputSettings::getJaniOutputFilename() const { |
||||
|
STORM_LOG_THROW(isJaniOutputFilenameSet(), storm::exceptions::InvalidOperationException, "Tried to get the jani output name although none was specified."); |
||||
|
return this->getOption(janiOutputOptionName).getArgumentByName("filename").getValueAsString(); |
||||
|
} |
||||
|
|
||||
|
void ConversionOutputSettings::finalize() { |
||||
|
// Intentionally left empty.
|
||||
|
} |
||||
|
|
||||
|
bool ConversionOutputSettings::check() const { |
||||
|
STORM_LOG_THROW(!isJaniOutputFilenameSet() || ArgumentValidatorFactory::createWritableFileValidator()->isValid(getJaniOutputFilename()), storm::exceptions::InvalidSettingsException, "Unable to write at file " + getJaniOutputFilename()); |
||||
|
return true; |
||||
|
} |
||||
|
|
||||
|
} // namespace modules
|
||||
|
} // namespace settings
|
||||
|
} // namespace storm
|
@ -0,0 +1,49 @@ |
|||||
|
#pragma once |
||||
|
#include "storm/settings/modules/ModuleSettings.h" |
||||
|
|
||||
|
namespace storm { |
||||
|
namespace settings { |
||||
|
namespace modules { |
||||
|
|
||||
|
class ConversionOutputSettings : public ModuleSettings { |
||||
|
public: |
||||
|
|
||||
|
ConversionOutputSettings(); |
||||
|
|
||||
|
/*! |
||||
|
* Retrieves whether the output should be printed to stdout |
||||
|
*/ |
||||
|
bool isStdOutOutputEnabled() const; |
||||
|
|
||||
|
/*! |
||||
|
* Retrieves whether the output should be in the Jani format |
||||
|
*/ |
||||
|
bool isJaniOutputSet() const; |
||||
|
|
||||
|
/*! |
||||
|
* Retrieves whether an output filename for the jani file was specified |
||||
|
*/ |
||||
|
bool isJaniOutputFilenameSet() const; |
||||
|
|
||||
|
/*! |
||||
|
* Retrieves the name of the jani output (if specified) |
||||
|
*/ |
||||
|
std::string getJaniOutputFilename() const; |
||||
|
|
||||
|
bool check() const override; |
||||
|
void finalize() override; |
||||
|
|
||||
|
// The name of the module. |
||||
|
static const std::string moduleName; |
||||
|
// name of the option that enables output to stdout. It needs to be public because we have to check this option very early |
||||
|
static const std::string stdoutOptionName; |
||||
|
|
||||
|
private: |
||||
|
// Define the string names of the options as constants. |
||||
|
static const std::string janiOutputOptionName; |
||||
|
}; |
||||
|
|
||||
|
|
||||
|
} |
||||
|
} |
||||
|
} |
@ -0,0 +1,88 @@ |
|||||
|
#include "JaniExportSettings.h"
|
||||
|
|
||||
|
#include "storm/settings/SettingsManager.h"
|
||||
|
#include "storm/settings/SettingMemento.h"
|
||||
|
#include "storm/settings/Option.h"
|
||||
|
#include "storm/settings/OptionBuilder.h"
|
||||
|
#include "storm/settings/ArgumentBuilder.h"
|
||||
|
#include "storm/settings/Argument.h"
|
||||
|
|
||||
|
#include <boost/algorithm/string.hpp>
|
||||
|
|
||||
|
namespace storm { |
||||
|
namespace settings { |
||||
|
namespace modules { |
||||
|
const std::string JaniExportSettings::moduleName = "exportJani"; |
||||
|
|
||||
|
const std::string JaniExportSettings::edgeAssignmentsOptionName = "edge-assignments"; |
||||
|
const std::string JaniExportSettings::exportFlattenOptionName = "flatten"; |
||||
|
const std::string JaniExportSettings::locationVariablesOptionName = "location-variables"; |
||||
|
const std::string JaniExportSettings::globalVariablesOptionName = "globalvars"; |
||||
|
const std::string JaniExportSettings::compactJsonOptionName = "compactjson"; |
||||
|
const std::string JaniExportSettings::eliminateArraysOptionName = "remove-arrays"; |
||||
|
const std::string JaniExportSettings::eliminateFunctionsOptionName = "remove-functions"; |
||||
|
|
||||
|
JaniExportSettings::JaniExportSettings() : ModuleSettings(moduleName) { |
||||
|
this->addOption(storm::settings::OptionBuilder(moduleName, locationVariablesOptionName, true, "Variables to export in the location").addArgument(storm::settings::ArgumentBuilder::createStringArgument("variables", "A comma separated list of automaton and local variable names seperated by a dot, e.g. A.x,B.y.").setDefaultValueString("").build()).build()); |
||||
|
this->addOption(storm::settings::OptionBuilder(moduleName, edgeAssignmentsOptionName, false, "If set, the output model can have transient edge assignments. This can simplify the jani model but is not compliant to the jani standard.").build()); |
||||
|
this->addOption(storm::settings::OptionBuilder(moduleName, exportFlattenOptionName, false, "Flattens the composition of Automata to obtain an equivalent model that contains exactly one automaton").build()); |
||||
|
this->addOption(storm::settings::OptionBuilder(moduleName, globalVariablesOptionName, false, "If set, variables will preferably be made global, e.g., to guarantee the same variable order as in the input file.").build()); |
||||
|
this->addOption(storm::settings::OptionBuilder(moduleName, compactJsonOptionName, false, "If set, the size of the resulting jani file will be reduced at the cost of (human-)readability.").build()); |
||||
|
this->addOption(storm::settings::OptionBuilder(moduleName, eliminateArraysOptionName, false, "If set, transforms the model such that array variables/expressions are eliminated.").build()); |
||||
|
this->addOption(storm::settings::OptionBuilder(moduleName, eliminateFunctionsOptionName, false, "If set, transforms the model such that functions are eliminated.").build()); |
||||
|
} |
||||
|
|
||||
|
bool JaniExportSettings::isAllowEdgeAssignmentsSet() const { |
||||
|
return this->getOption(edgeAssignmentsOptionName).getHasOptionBeenSet(); |
||||
|
} |
||||
|
|
||||
|
bool JaniExportSettings::isExportFlattenedSet() const { |
||||
|
return this->getOption(exportFlattenOptionName).getHasOptionBeenSet(); |
||||
|
} |
||||
|
|
||||
|
bool JaniExportSettings::isLocationVariablesSet() const { |
||||
|
return this->getOption(locationVariablesOptionName).getHasOptionBeenSet(); |
||||
|
} |
||||
|
|
||||
|
std::vector<std::pair<std::string, std::string>> JaniExportSettings::getLocationVariables() const { |
||||
|
std::vector<std::pair<std::string, std::string>> result; |
||||
|
if (isLocationVariablesSet()) { |
||||
|
std::string argument = this->getOption(locationVariablesOptionName).getArgumentByName("variables").getValueAsString(); |
||||
|
std::vector<std::string> arguments; |
||||
|
boost::split( arguments, argument, boost::is_any_of(",")); |
||||
|
for (auto const& pair : arguments) { |
||||
|
std::vector<std::string> keyvaluepair; |
||||
|
boost::split( keyvaluepair, pair, boost::is_any_of(".")); |
||||
|
STORM_LOG_THROW(keyvaluepair.size() == 2, storm::exceptions::IllegalArgumentException, "Expected a name of the form AUTOMATON.VARIABLE (with no further dots) but got " << pair); |
||||
|
result.emplace_back(keyvaluepair.at(0), keyvaluepair.at(1)); |
||||
|
} |
||||
|
} |
||||
|
return result; |
||||
|
} |
||||
|
|
||||
|
bool JaniExportSettings::isGlobalVarsSet() const { |
||||
|
return this->getOption(globalVariablesOptionName).getHasOptionBeenSet(); |
||||
|
} |
||||
|
|
||||
|
bool JaniExportSettings::isCompactJsonSet() const { |
||||
|
return this->getOption(compactJsonOptionName).getHasOptionBeenSet(); |
||||
|
} |
||||
|
|
||||
|
bool JaniExportSettings::isEliminateArraysSet() const { |
||||
|
return this->getOption(eliminateArraysOptionName).getHasOptionBeenSet(); |
||||
|
} |
||||
|
|
||||
|
bool JaniExportSettings::isEliminateFunctionsSet() const { |
||||
|
return this->getOption(eliminateFunctionsOptionName).getHasOptionBeenSet(); |
||||
|
} |
||||
|
|
||||
|
void JaniExportSettings::finalize() { |
||||
|
|
||||
|
} |
||||
|
|
||||
|
bool JaniExportSettings::check() const { |
||||
|
return true; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
@ -0,0 +1,50 @@ |
|||||
|
#pragma once |
||||
|
|
||||
|
#include "storm-config.h" |
||||
|
#include "storm/settings/modules/ModuleSettings.h" |
||||
|
|
||||
|
|
||||
|
namespace storm { |
||||
|
namespace settings { |
||||
|
namespace modules { |
||||
|
class JaniExportSettings : public ModuleSettings { |
||||
|
public: |
||||
|
/*! |
||||
|
* Creates a new JaniExport setting |
||||
|
*/ |
||||
|
JaniExportSettings(); |
||||
|
|
||||
|
bool isAllowEdgeAssignmentsSet() const; |
||||
|
|
||||
|
bool isExportFlattenedSet() const; |
||||
|
|
||||
|
bool isLocationVariablesSet() const; |
||||
|
|
||||
|
bool isGlobalVarsSet() const; |
||||
|
|
||||
|
bool isCompactJsonSet() const; |
||||
|
|
||||
|
bool isEliminateArraysSet() const; |
||||
|
|
||||
|
bool isEliminateFunctionsSet() const; |
||||
|
|
||||
|
std::vector<std::pair<std::string, std::string>> getLocationVariables() const; |
||||
|
|
||||
|
bool check() const override; |
||||
|
void finalize() override; |
||||
|
|
||||
|
static const std::string moduleName; |
||||
|
|
||||
|
private: |
||||
|
static const std::string edgeAssignmentsOptionName; |
||||
|
static const std::string exportFlattenOptionName; |
||||
|
static const std::string locationVariablesOptionName; |
||||
|
static const std::string globalVariablesOptionName; |
||||
|
static const std::string compactJsonOptionName; |
||||
|
static const std::string eliminateArraysOptionName; |
||||
|
static const std::string eliminateFunctionsOptionName; |
||||
|
|
||||
|
}; |
||||
|
} |
||||
|
} |
||||
|
} |
@ -0,0 +1,40 @@ |
|||||
|
file(GLOB_RECURSE ALL_FILES ${PROJECT_SOURCE_DIR}/src/storm-counterexamples/*.h ${PROJECT_SOURCE_DIR}/src/storm-counterexamples/*.cpp) |
||||
|
|
||||
|
register_source_groups_from_filestructure("${ALL_FILES}" storm-counterexamples) |
||||
|
|
||||
|
|
||||
|
|
||||
|
file(GLOB_RECURSE STORM_CEX_SOURCES ${PROJECT_SOURCE_DIR}/src/storm-counterexamples/*/*.cpp) |
||||
|
file(GLOB_RECURSE STORM_CEX_HEADERS ${PROJECT_SOURCE_DIR}/src/storm-counterexamples/*/*.h) |
||||
|
|
||||
|
|
||||
|
# Create storm-dft. |
||||
|
add_library(storm-counterexamples SHARED ${STORM_CEX_SOURCES} ${STORM_CEX_HEADERS}) |
||||
|
|
||||
|
# Remove define symbol for shared libstorm. |
||||
|
set_target_properties(storm-counterexamples PROPERTIES DEFINE_SYMBOL "") |
||||
|
#add_dependencies(storm resources) |
||||
|
list(APPEND STORM_TARGETS storm-counterexamples) |
||||
|
set(STORM_TARGETS ${STORM_TARGETS} PARENT_SCOPE) |
||||
|
|
||||
|
target_link_libraries(storm-counterexamples PUBLIC storm) |
||||
|
|
||||
|
# Install storm headers to include directory. |
||||
|
foreach(HEADER ${STORM_CEX_HEADERS}) |
||||
|
string(REGEX REPLACE "${PROJECT_SOURCE_DIR}/src/?" "" RELATIVE_HEADER_PATH ${HEADER}) |
||||
|
string(REGEX MATCH "(.*)[/\\]" RELATIVE_DIRECTORY ${RELATIVE_HEADER_PATH}) |
||||
|
string(REGEX REPLACE "${RELATIVE_DIRECTORY}/?" "" HEADER_FILENAME ${RELATIVE_HEADER_PATH}) |
||||
|
add_custom_command( |
||||
|
OUTPUT ${CMAKE_BINARY_DIR}/include/${RELATIVE_DIRECTORY}${HEADER_FILENAME} |
||||
|
COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/include/${RELATIVE_DIRECTORY} |
||||
|
COMMAND ${CMAKE_COMMAND} -E copy ${HEADER} ${CMAKE_BINARY_DIR}/include/${RELATIVE_DIRECTORY}${HEADER_FILENAME} |
||||
|
DEPENDS ${HEADER} |
||||
|
) |
||||
|
list(APPEND STORM_CEX_OUTPUT_HEADERS "${CMAKE_BINARY_DIR}/include/${RELATIVE_DIRECTORY}${HEADER_FILENAME}") |
||||
|
endforeach() |
||||
|
add_custom_target(copy_storm_cex_headers DEPENDS ${STORM_CEX_OUTPUT_HEADERS} ${STORM_CEX_HEADERS}) |
||||
|
add_dependencies(storm-counterexamples copy_storm_cex_headers) |
||||
|
|
||||
|
# installation |
||||
|
install(TARGETS storm-counterexamples EXPORT storm_Targets RUNTIME DESTINATION bin LIBRARY DESTINATION lib OPTIONAL) |
||||
|
|
@ -1,4 +1,4 @@ |
|||||
#include "storm/api/counterexamples.h"
|
|
||||
|
#include "storm-counterexamples/api/counterexamples.h"
|
||||
|
|
||||
#include "storm/environment/Environment.h"
|
#include "storm/environment/Environment.h"
|
||||
|
|
@ -1,7 +1,7 @@ |
|||||
#pragma once |
#pragma once |
||||
|
|
||||
#include "storm/counterexamples/MILPMinimalLabelSetGenerator.h" |
|
||||
#include "storm/counterexamples/SMTMinimalLabelSetGenerator.h" |
|
||||
|
#include "storm-counterexamples/counterexamples/MILPMinimalLabelSetGenerator.h" |
||||
|
#include "storm-counterexamples/counterexamples/SMTMinimalLabelSetGenerator.h" |
||||
|
|
||||
namespace storm { |
namespace storm { |
||||
namespace api { |
namespace api { |
@ -1,4 +1,4 @@ |
|||||
#include "storm/counterexamples/Counterexample.h"
|
|
||||
|
#include "storm-counterexamples/counterexamples/Counterexample.h"
|
||||
|
|
||||
namespace storm { |
namespace storm { |
||||
namespace counterexamples { |
namespace counterexamples { |
@ -1,4 +1,4 @@ |
|||||
#include "storm/counterexamples/HighLevelCounterexample.h"
|
|
||||
|
#include "storm-counterexamples/counterexamples/HighLevelCounterexample.h"
|
||||
|
|
||||
namespace storm { |
namespace storm { |
||||
namespace counterexamples { |
namespace counterexamples { |
@ -1,6 +1,6 @@ |
|||||
#pragma once |
#pragma once |
||||
|
|
||||
#include "storm/counterexamples/Counterexample.h" |
|
||||
|
#include "Counterexample.h" |
||||
|
|
||||
#include "storm/storage/SymbolicModelDescription.h" |
#include "storm/storage/SymbolicModelDescription.h" |
||||
|
|
748
src/storm-counterexamples/counterexamples/SMTMinimalLabelSetGenerator.h
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
@ -0,0 +1,74 @@ |
|||||
|
#include "storm-dft/api/storm-dft.h"
|
||||
|
|
||||
|
namespace storm { |
||||
|
namespace api { |
||||
|
|
||||
|
template<> |
||||
|
void exportDFTToJsonFile(storm::storage::DFT<double> const& dft, std::string const& file) { |
||||
|
storm::storage::DftJsonExporter<double>::toFile(dft, file); |
||||
|
} |
||||
|
|
||||
|
template<> |
||||
|
void exportDFTToJsonFile(storm::storage::DFT<storm::RationalFunction> const& dft, std::string const& file) { |
||||
|
STORM_LOG_THROW(false, storm::exceptions::NotSupportedException, "Export to JSON not supported for this data type."); |
||||
|
} |
||||
|
|
||||
|
template<> |
||||
|
std::string exportDFTToJsonString(storm::storage::DFT<double> const& dft) { |
||||
|
std::stringstream stream; |
||||
|
storm::storage::DftJsonExporter<double>::toStream(dft, stream); |
||||
|
return stream.str(); |
||||
|
} |
||||
|
|
||||
|
template<> |
||||
|
std::string exportDFTToJsonString(storm::storage::DFT<storm::RationalFunction> const& dft) { |
||||
|
STORM_LOG_THROW(false, storm::exceptions::NotSupportedException, "Export to JSON not supported for this data type."); |
||||
|
} |
||||
|
|
||||
|
template<> |
||||
|
void exportDFTToSMT(storm::storage::DFT<double> const& dft, std::string const& file) { |
||||
|
storm::modelchecker::DFTASFChecker asfChecker(dft); |
||||
|
asfChecker.convert(); |
||||
|
asfChecker.toFile(file); |
||||
|
} |
||||
|
|
||||
|
template<> |
||||
|
void exportDFTToSMT(storm::storage::DFT<storm::RationalFunction> const& dft, std::string const& file) { |
||||
|
STORM_LOG_THROW(false, storm::exceptions::NotSupportedException, "Export to SMT does not support this data type."); |
||||
|
} |
||||
|
|
||||
|
template<> |
||||
|
void transformToGSPN(storm::storage::DFT<double> const& dft) { |
||||
|
// Transform to GSPN
|
||||
|
storm::transformations::dft::DftToGspnTransformator<double> gspnTransformator(dft); |
||||
|
bool smart = true; |
||||
|
gspnTransformator.transform(smart); |
||||
|
storm::gspn::GSPN* gspn = gspnTransformator.obtainGSPN(); |
||||
|
uint64_t toplevelFailedPlace = gspnTransformator.toplevelFailedPlaceId(); |
||||
|
|
||||
|
storm::api::handleGSPNExportSettings(*gspn, [&](storm::builder::JaniGSPNBuilder const& builder) { |
||||
|
std::shared_ptr<storm::expressions::ExpressionManager> const& exprManager = gspn->getExpressionManager(); |
||||
|
storm::jani::Variable const& topfailedVar = builder.getPlaceVariable(toplevelFailedPlace); |
||||
|
|
||||
|
storm::expressions::Expression targetExpression = exprManager->integer(1) == topfailedVar.getExpressionVariable().getExpression(); |
||||
|
auto evtlFormula = std::make_shared<storm::logic::AtomicExpressionFormula>(targetExpression); |
||||
|
auto tbFormula = std::make_shared<storm::logic::BoundedUntilFormula>(std::make_shared<storm::logic::BooleanLiteralFormula>(true), evtlFormula, storm::logic::TimeBound(false, exprManager->integer(0)), storm::logic::TimeBound(false, exprManager->integer(10)), storm::logic::TimeBoundReference(storm::logic::TimeBoundType::Time)); |
||||
|
auto tbUntil = std::make_shared<storm::logic::ProbabilityOperatorFormula>(tbFormula); |
||||
|
|
||||
|
auto evFormula = std::make_shared<storm::logic::EventuallyFormula>(evtlFormula, storm::logic::FormulaContext::Time); |
||||
|
auto rewFormula = std::make_shared<storm::logic::TimeOperatorFormula>(evFormula, storm::logic::OperatorInformation(), storm::logic::RewardMeasureType::Expectation); |
||||
|
std::vector<storm::jani::Property> res({storm::jani::Property("time-bounded", tbUntil, {}), storm::jani::Property("mttf", rewFormula, {})}); |
||||
|
return res; |
||||
|
} |
||||
|
); |
||||
|
|
||||
|
delete gspn; |
||||
|
} |
||||
|
|
||||
|
template<> |
||||
|
void transformToGSPN(storm::storage::DFT<storm::RationalFunction> const& dft) { |
||||
|
STORM_LOG_THROW(false, storm::exceptions::NotSupportedException, "Transformation to GSPN not supported for this data type."); |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
} |
@ -0,0 +1,138 @@ |
|||||
|
#pragma once |
||||
|
|
||||
|
#include <type_traits> |
||||
|
|
||||
|
#include "storm-dft/parser/DFTGalileoParser.h" |
||||
|
#include "storm-dft/parser/DFTJsonParser.h" |
||||
|
#include "storm-dft/storage/dft/DftJsonExporter.h" |
||||
|
|
||||
|
#include "storm-dft/modelchecker/dft/DFTModelChecker.h" |
||||
|
#include "storm-dft/modelchecker/dft/DFTASFChecker.h" |
||||
|
|
||||
|
#include "storm-dft/transformations/DftToGspnTransformator.h" |
||||
|
#include "storm-gspn/api/storm-gspn.h" |
||||
|
|
||||
|
namespace storm { |
||||
|
namespace api { |
||||
|
|
||||
|
/*! |
||||
|
* Load DFT from Galileo file. |
||||
|
* |
||||
|
* @param file File containing DFT description in Galileo format. |
||||
|
* |
||||
|
* @return DFT. |
||||
|
*/ |
||||
|
template<typename ValueType> |
||||
|
std::shared_ptr<storm::storage::DFT<ValueType>> loadDFTGalileoFile(std::string const& file) { |
||||
|
return std::make_shared<storm::storage::DFT<ValueType>>(storm::parser::DFTGalileoParser<ValueType>::parseDFT(file)); |
||||
|
} |
||||
|
|
||||
|
/*! |
||||
|
* Load DFT from JSON string. |
||||
|
* |
||||
|
* @param jsonString String containing DFT description in JSON format. |
||||
|
* |
||||
|
* @return DFT. |
||||
|
*/ |
||||
|
template<typename ValueType> |
||||
|
std::shared_ptr<storm::storage::DFT<ValueType>> loadDFTJsonString(std::string const& jsonString) { |
||||
|
storm::parser::DFTJsonParser<ValueType> parser; |
||||
|
return std::make_shared<storm::storage::DFT<ValueType>>(parser.parseJsonFromString(jsonString)); |
||||
|
} |
||||
|
|
||||
|
/*! |
||||
|
* Load DFT from JSON file. |
||||
|
* |
||||
|
* @param file File containing DFT description in JSON format. |
||||
|
* |
||||
|
* @return DFT. |
||||
|
*/ |
||||
|
template<typename ValueType> |
||||
|
std::shared_ptr<storm::storage::DFT<ValueType>> loadDFTJsonFile(std::string const& file) { |
||||
|
storm::parser::DFTJsonParser<ValueType> parser; |
||||
|
return std::make_shared<storm::storage::DFT<ValueType>>(parser.parseJsonFromFile(file)); |
||||
|
} |
||||
|
|
||||
|
/*! |
||||
|
* Analyse the given DFT according to the given properties. |
||||
|
* First the Markov model is built from the DFT and then this model is checked against the given properties. |
||||
|
* |
||||
|
* @param dft DFT. |
||||
|
* @param properties PCTL formulas capturing the properties to check. |
||||
|
* @param symred Flag whether symmetry reduction should be used. |
||||
|
* @param allowModularisation Flag whether modularisation should be applied if possible. |
||||
|
* @param enableDC Flag whether Don't Care propagation should be used. |
||||
|
* |
||||
|
* @return Result. |
||||
|
*/ |
||||
|
template <typename ValueType> |
||||
|
typename storm::modelchecker::DFTModelChecker<ValueType>::dft_results analyzeDFT(storm::storage::DFT<ValueType> const& dft, std::vector<std::shared_ptr<storm::logic::Formula const>> const& properties, bool symred, bool allowModularisation, bool enableDC, bool printOutput) { |
||||
|
storm::modelchecker::DFTModelChecker<ValueType> modelChecker; |
||||
|
typename storm::modelchecker::DFTModelChecker<ValueType>::dft_results results = modelChecker.check(dft, properties, symred, allowModularisation, enableDC, 0.0); |
||||
|
if (printOutput) { |
||||
|
modelChecker.printTimings(); |
||||
|
modelChecker.printResults(); |
||||
|
} |
||||
|
return results; |
||||
|
} |
||||
|
|
||||
|
/*! |
||||
|
* Approximate the analysis result of the given DFT according to the given properties. |
||||
|
* First the Markov model is built from the DFT and then this model is checked against the given properties. |
||||
|
* |
||||
|
* @param dft DFT. |
||||
|
* @param properties PCTL formulas capturing the properties to check. |
||||
|
* @param symred Flag whether symmetry reduction should be used. |
||||
|
* @param allowModularisation Flag whether modularisation should be applied if possible. |
||||
|
* @param enableDC Flag whether Don't Care propagation should be used. |
||||
|
* @param approximationError Allowed approximation error. |
||||
|
* |
||||
|
* @return Result. |
||||
|
*/ |
||||
|
template <typename ValueType> |
||||
|
typename storm::modelchecker::DFTModelChecker<ValueType>::dft_results analyzeDFTApprox(storm::storage::DFT<ValueType> const& dft, std::vector<std::shared_ptr<storm::logic::Formula const>> const& properties, bool symred, bool allowModularisation, bool enableDC, double approximationError, bool printOutput) { |
||||
|
storm::modelchecker::DFTModelChecker<ValueType> modelChecker; |
||||
|
typename storm::modelchecker::DFTModelChecker<ValueType>::dft_results results = modelChecker.check(dft, properties, symred, allowModularisation, enableDC, approximationError); |
||||
|
if (printOutput) { |
||||
|
modelChecker.printTimings(); |
||||
|
modelChecker.printResults(); |
||||
|
} |
||||
|
return results; |
||||
|
} |
||||
|
|
||||
|
/*! |
||||
|
* Export DFT to JSON file. |
||||
|
* |
||||
|
* @param dft DFT. |
||||
|
* @param file File. |
||||
|
*/ |
||||
|
template<typename ValueType> |
||||
|
void exportDFTToJsonFile(storm::storage::DFT<ValueType> const& dft, std::string const& file); |
||||
|
|
||||
|
/*! |
||||
|
* Export DFT to JSON string. |
||||
|
* |
||||
|
* @param dft DFT. |
||||
|
*/ |
||||
|
template<typename ValueType> |
||||
|
std::string exportDFTToJsonString(storm::storage::DFT<ValueType> const& dft); |
||||
|
|
||||
|
/*! |
||||
|
* Export DFT to SMT encoding. |
||||
|
* |
||||
|
* @param dft DFT. |
||||
|
* @param file File. |
||||
|
*/ |
||||
|
template<typename ValueType> |
||||
|
void exportDFTToSMT(storm::storage::DFT<ValueType> const& dft, std::string const& file); |
||||
|
|
||||
|
/*! |
||||
|
* Transform DFT to GSPN. |
||||
|
* |
||||
|
* @param dft DFT. |
||||
|
*/ |
||||
|
template<typename ValueType> |
||||
|
void transformToGSPN(storm::storage::DFT<ValueType> const& dft); |
||||
|
|
||||
|
} |
||||
|
} |
Some files were not shown because too many files changed in this diff
Write
Preview
Loading…
Cancel
Save
Reference in new issue