Storm
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
NondeterministicMemoryStructure.cpp
Go to the documentation of this file.
3
6
7namespace storm {
8namespace storage {
9
10NondeterministicMemoryStructure::NondeterministicMemoryStructure(std::vector<storm::storage::BitVector> const& transitions, uint64_t initialState)
11 : transitions(transitions), initialState(initialState) {
12 STORM_LOG_THROW(this->initialState < this->transitions.size(), storm::exceptions::InvalidArgumentException,
13 "Initial state " << this->initialState << " of nondeterministic memory structure is invalid.");
14 for (auto const& t : this->transitions) {
15 STORM_LOG_THROW(t.size() == this->transitions.size(), storm::exceptions::InvalidArgumentException,
16 "Invalid dimension of transition matrix of nondeterministic memory structure.");
17 STORM_LOG_THROW(!t.empty(), storm::exceptions::InvalidArgumentException,
18 "Invalid transition matrix of nondeterministic memory structure: No deadlock states allowed.");
19 }
20}
21
23 return transitions.size();
24}
25
27 return initialState;
28}
29
31 return transitions.at(state);
32}
33
35 return getTransitions(state).getNumberOfSetBits();
36}
37
38std::vector<storm::storage::BitVector> const& NondeterministicMemoryStructure::getTransitions() const {
39 return transitions;
40}
41
43 std::string result = "NondeterministicMemoryStructure with " + std::to_string(getNumberOfStates()) + " states.\n";
44 result += "Initial state is " + std::to_string(getInitialState()) + ". Transitions are \n";
45
46 // header
47 result += " |";
48 for (uint64_t state = 0; state < getNumberOfStates(); ++state) {
49 if (state < 10) {
50 result += " ";
51 }
52 result += std::to_string(state);
53 }
54 result += "\n";
55 result += "--|";
56 for (uint64_t state = 0; state < getNumberOfStates(); ++state) {
57 result += "--";
58 }
59 result += "\n";
60
61 // transition matrix entries
62 for (uint64_t state = 0; state < getNumberOfStates(); ++state) {
63 if (state < 10) {
64 result += " ";
65 }
66 result += std::to_string(state) + "|";
67 for (uint64_t statePrime = 0; statePrime < getNumberOfStates(); ++statePrime) {
68 result += " ";
69 if (getTransitions(state).get(statePrime)) {
70 result += "1";
71 } else {
72 result += "0";
73 }
74 }
75 result += "\n";
76 }
77 return result;
78}
79} // namespace storage
80} // namespace storm
A bit vector that is internally represented as a vector of 64-bit values.
Definition BitVector.h:18
NondeterministicMemoryStructure(std::vector< storm::storage::BitVector > const &transitions, uint64_t initialState)
std::vector< storm::storage::BitVector > const & getTransitions() const
#define STORM_LOG_THROW(cond, exception, message)
Definition macros.h:30
LabParser.cpp.
Definition cli.cpp:18