Browse Source
building markov automata from prism code
building markov automata from prism code
Former-commit-id: 791c49c7cf
tempestpy_adaptions
TimQu
9 years ago
14 changed files with 369 additions and 21 deletions
-
70src/builder/ExplicitModelBuilder.cpp
-
19src/builder/ExplicitModelBuilder.h
-
4src/generator/PrismNextStateGenerator.cpp
-
51src/models/sparse/MarkovAutomaton.cpp
-
41src/models/sparse/MarkovAutomaton.h
-
10src/storage/BitVector.cpp
-
11src/storage/BitVector.h
-
64src/storage/SparseMatrix.cpp
-
8src/storage/SparseMatrix.h
-
2src/utility/ModelInstantiator.h
-
26test/functional/builder/ExplicitPrismModelBuilderTest.cpp
-
19test/functional/builder/hybrid_states.ma
-
15test/functional/builder/simple.ma
-
50test/functional/builder/stream2.ma
@ -0,0 +1,19 @@ |
|||
|
|||
ma |
|||
|
|||
module hybrid_states |
|||
|
|||
s : [0..4]; |
|||
|
|||
[] (s=0) -> 0.8 : (s'=0) + 0.2 : (s'=2); |
|||
[] (s=0) -> 1 : (s' = 1); |
|||
<> (s=0) -> 3 : (s' = 1); |
|||
<> (s=1) -> 9 : (s'=0) + 1 : (s'=3); |
|||
<> (s=2) -> 12 : (s'=4); |
|||
[] (s=3) -> 1 : true; |
|||
[] (s=3) -> 1 : (s'=4); |
|||
<> (s=3) -> 2 : (s'=3) + 2 : (s'=4); |
|||
[] (s=4) -> 1 : true; |
|||
<> (s=4) -> 3 : (s'=3); |
|||
|
|||
endmodule |
@ -0,0 +1,15 @@ |
|||
|
|||
ma |
|||
|
|||
module simple |
|||
|
|||
s : [0..4]; |
|||
|
|||
|
|||
[alpha] (s=0) -> 1 : (s' = 1); |
|||
[beta] (s=0) -> 0.8 : (s'=0) + 0.2 : (s'=2); |
|||
<> (s=1) -> 9 : (s'=0) + 1 : (s'=3); |
|||
<> (s=2) -> 12 : (s'=4); |
|||
<> (s>2) -> 1 : true; |
|||
|
|||
endmodule |
@ -0,0 +1,50 @@ |
|||
|
|||
ma |
|||
|
|||
const int N = 2; // num packages |
|||
|
|||
const double inRate = 4; |
|||
const double processingRate = 5; |
|||
|
|||
module streamingclient |
|||
|
|||
s : [0..3]; // current state: |
|||
// 0: decide whether to start |
|||
// 1: buffering |
|||
// 2: running |
|||
// 3: done |
|||
|
|||
n : [0..N]; // number of received packages |
|||
k : [0..N]; // number of processed packages |
|||
|
|||
[buffer] s=0 & n<N -> 1 : (s'=1); |
|||
[start] s=0 & k<n -> 1 : (s'=2) & (k'=k+1); |
|||
|
|||
<> s=1 -> inRate : (n'=n+1) & (s'=0); |
|||
|
|||
<> s=2 & n<N & k<n -> inRate : (n'=n+1) + processingRate : (k'=k+1); |
|||
<> s=2 & n<N & k=n -> inRate : (n'=n+1) + processingRate : (s'=0); |
|||
<> s=2 & n=N & k<n -> processingRate : (k'=k+1); |
|||
<> s=2 & n=N & k=N -> processingRate : (s'=3); |
|||
|
|||
<> s=3 -> 1 : true; |
|||
endmodule |
|||
|
|||
// All packages received and buffer empty |
|||
label "done" = (s=3); |
|||
|
|||
rewards "buffering" |
|||
s=1 : 1; |
|||
endrewards |
|||
|
|||
rewards "initialbuffering" |
|||
s=1 & k = 0: 1; |
|||
endrewards |
|||
|
|||
rewards "intermediatebuffering" |
|||
s=1 & k > 0: 1; |
|||
endrewards |
|||
|
|||
rewards "numRestarts" |
|||
[start] k > 0 : 1; |
|||
endrewards |
Write
Preview
Loading…
Cancel
Save
Reference in new issue