Storm
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
ExplorationInformation.cpp
Go to the documentation of this file.
2
5
7
8namespace storm {
9namespace modelchecker {
10namespace exploration_detail {
11
12template<typename StateType, typename ValueType>
14 : unexploredMarker(unexploredMarker),
15 optimizationDirection(direction),
16 localPrecomputation(false),
17 numberOfExplorationStepsUntilPrecomputation(100000),
18 numberOfSampledPathsUntilPrecomputation(),
19 nextStateHeuristic(storm::settings::modules::ExplorationSettings::NextStateHeuristic::DifferenceProbabilitySum) {
21 localPrecomputation = settings.isLocalPrecomputationSet();
22 numberOfExplorationStepsUntilPrecomputation = settings.getNumberOfExplorationStepsUntilPrecomputation();
24 numberOfSampledPathsUntilPrecomputation = settings.getNumberOfSampledPathsUntilPrecomputation();
25 }
26
27 nextStateHeuristic = settings.getNextStateHeuristic();
28}
29
30template<typename StateType, typename ValueType>
32 StateType const& state) const {
33 return unexploredStates.find(state);
34}
35
36template<typename StateType, typename ValueType>
40
41template<typename StateType, typename ValueType>
45
46template<typename StateType, typename ValueType>
48 stateToRowGroupMapping.push_back(unexploredMarker);
49 unexploredStates[stateId] = compressedState;
50}
51
52template<typename StateType, typename ValueType>
54 stateToRowGroupMapping[state] = rowGroup;
55}
56
57template<typename StateType, typename ValueType>
59 stateToRowGroupMapping[state] = rowGroupIndices.size() - 1;
60 return stateToRowGroupMapping[state];
61}
62
63template<typename StateType, typename ValueType>
65 return rowGroupIndices.size() - 1;
66}
67
68template<typename StateType, typename ValueType>
70 rowGroupIndices.push_back(action);
71}
72
73template<typename StateType, typename ValueType>
75 newRowGroup(matrix.size());
76}
77
78template<typename StateType, typename ValueType>
80 rowGroupIndices.push_back(matrix.size());
81}
82
83template<typename StateType, typename ValueType>
85 matrix.emplace_back(std::move(matrix[action]));
86}
87
88template<typename StateType, typename ValueType>
90 return matrix.size();
91}
92
93template<typename StateType, typename ValueType>
95 return unexploredStates.size();
96}
97
98template<typename StateType, typename ValueType>
100 return stateToRowGroupMapping.size();
101}
102
103template<typename StateType, typename ValueType>
104StateType const& ExplorationInformation<StateType, ValueType>::getRowGroup(StateType const& state) const {
105 return stateToRowGroupMapping[state];
106}
107
108template<typename StateType, typename ValueType>
110 return unexploredMarker;
111}
112
113template<typename StateType, typename ValueType>
115 return stateToRowGroupMapping[state] == unexploredMarker;
116}
117
118template<typename StateType, typename ValueType>
120 return terminalStates.find(state) != terminalStates.end();
121}
122
123template<typename StateType, typename ValueType>
125 StateType const& group) const {
126 return rowGroupIndices[group];
127}
128
129template<typename StateType, typename ValueType>
130std::size_t ExplorationInformation<StateType, ValueType>::getRowGroupSize(StateType const& group) const {
131 return rowGroupIndices[group + 1] - rowGroupIndices[group];
132}
133
134template<typename StateType, typename ValueType>
136 return getRowGroupSize(group) == 1;
137}
138
139template<typename StateType, typename ValueType>
141 terminalStates.insert(state);
142}
143
144template<typename StateType, typename ValueType>
145std::vector<storm::storage::MatrixEntry<StateType, ValueType>>& ExplorationInformation<StateType, ValueType>::getRowOfMatrix(ActionType const& row) {
146 return matrix[row];
147}
148
149template<typename StateType, typename ValueType>
150std::vector<storm::storage::MatrixEntry<StateType, ValueType>> const& ExplorationInformation<StateType, ValueType>::getRowOfMatrix(
151 ActionType const& row) const {
152 return matrix[row];
153}
154
155template<typename StateType, typename ValueType>
157 matrix.resize(matrix.size() + count);
158}
159
160template<typename StateType, typename ValueType>
162 return optimizationDirection == storm::OptimizationDirection::Maximize;
163}
164
165template<typename StateType, typename ValueType>
167 return !maximize();
168}
169
170template<typename StateType, typename ValueType>
172 std::size_t& numberExplorationStepsSinceLastPrecomputation) const {
173 bool result = numberExplorationStepsSinceLastPrecomputation > numberOfExplorationStepsUntilPrecomputation;
174 if (result) {
175 numberExplorationStepsSinceLastPrecomputation = 0;
176 }
177 return result;
178}
179
180template<typename StateType, typename ValueType>
181bool ExplorationInformation<StateType, ValueType>::performPrecomputationExcessiveSampledPaths(std::size_t& numberOfSampledPathsSinceLastPrecomputation) const {
182 if (!numberOfSampledPathsUntilPrecomputation) {
183 return false;
184 } else {
185 bool result = numberOfSampledPathsSinceLastPrecomputation > numberOfSampledPathsUntilPrecomputation.get();
186 if (result) {
187 numberOfSampledPathsSinceLastPrecomputation = 0;
188 }
189 return result;
190 }
191}
192
193template<typename StateType, typename ValueType>
195 return localPrecomputation;
196}
197
198template<typename StateType, typename ValueType>
200 return !useLocalPrecomputation();
201}
202
203template<typename StateType, typename ValueType>
207
208template<typename StateType, typename ValueType>
212
213template<typename StateType, typename ValueType>
217
218template<typename StateType, typename ValueType>
222
223template<typename StateType, typename ValueType>
227
228template<typename StateType, typename ValueType>
230 optimizationDirection = direction;
231}
232
234} // namespace exploration_detail
235} // namespace modelchecker
236} // namespace storm
ExplorationInformation(storm::OptimizationDirection const &direction, ActionType const &unexploredMarker=std::numeric_limits< ActionType >::max())
void addUnexploredState(StateType const &stateId, storm::generator::CompressedState const &compressedState)
std::vector< storm::storage::MatrixEntry< StateType, ValueType > > & getRowOfMatrix(ActionType const &row)
void setOptimizationDirection(storm::OptimizationDirection const &direction)
storm::settings::modules::ExplorationSettings::NextStateHeuristic const & getNextStateHeuristic() const
bool performPrecomputationExcessiveSampledPaths(std::size_t &numberOfSampledPathsSinceLastPrecomputation) const
void assignStateToRowGroup(StateType const &state, ActionType const &rowGroup)
storm::OptimizationDirection const & getOptimizationDirection() const
bool performPrecomputationExcessiveExplorationSteps(std::size_t &numberExplorationStepsSinceLastPrecomputation) const
ActionType const & getStartRowOfGroup(StateType const &group) const
This class represents the exploration settings.
uint_fast64_t getNumberOfSampledPathsUntilPrecomputation() const
Retrieves the number of paths to sample until a precomputation is triggered.
bool isLocalPrecomputationSet() const
Retrieves whether local precomputation is to be used.
uint_fast64_t getNumberOfExplorationStepsUntilPrecomputation() const
Retrieves the number of exploration steps to perform until a precomputation is triggered.
NextStateHeuristic getNextStateHeuristic() const
Retrieves the selected next-state heuristic.
A bit vector that is internally represented as a vector of 64-bit values.
Definition BitVector.h:18
size_t size() const
Retrieves the number of bits this bit vector can store.
SettingsType const & getModule()
Get module.
LabParser.cpp.
Definition cli.cpp:18