Storm 1.14.0.1
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
ExplorationInformation.cpp
Go to the documentation of this file.
2
4
6
7namespace storm {
8namespace modelchecker {
9namespace exploration_detail {
10
11template<typename StateType, typename ValueType>
13 ActionType const& unexploredMarker)
14 : unexploredMarker(unexploredMarker),
15 optimizationDirection(direction),
16 localPrecomputation(false),
17 numberOfExplorationStepsUntilPrecomputation(100000),
18 numberOfSampledPathsUntilPrecomputation(),
21 numberOfExplorationStepsUntilPrecomputation = env.getStepsUntilPrecomputation();
23 numberOfSampledPathsUntilPrecomputation = env.getSampledPathsUntilPrecomputation().value();
24 }
25 nextStateHeuristic = env.getNextStateHeuristic();
26}
27
28template<typename StateType, typename ValueType>
30 StateType const& state) const {
31 return unexploredStates.find(state);
32}
33
34template<typename StateType, typename ValueType>
38
39template<typename StateType, typename ValueType>
43
44template<typename StateType, typename ValueType>
46 stateToRowGroupMapping.push_back(unexploredMarker);
47 unexploredStates[stateId] = compressedState;
48}
49
50template<typename StateType, typename ValueType>
52 stateToRowGroupMapping[state] = rowGroup;
53}
54
55template<typename StateType, typename ValueType>
57 stateToRowGroupMapping[state] = rowGroupIndices.size() - 1;
58 return stateToRowGroupMapping[state];
59}
60
61template<typename StateType, typename ValueType>
63 return rowGroupIndices.size() - 1;
64}
65
66template<typename StateType, typename ValueType>
68 rowGroupIndices.push_back(action);
69}
70
71template<typename StateType, typename ValueType>
75
76template<typename StateType, typename ValueType>
78 rowGroupIndices.push_back(matrix.size());
79}
80
81template<typename StateType, typename ValueType>
83 matrix.emplace_back(std::move(matrix[action]));
84}
85
86template<typename StateType, typename ValueType>
88 return matrix.size();
89}
90
91template<typename StateType, typename ValueType>
93 return unexploredStates.size();
94}
95
96template<typename StateType, typename ValueType>
98 return stateToRowGroupMapping.size();
99}
100
101template<typename StateType, typename ValueType>
102StateType const& ExplorationInformation<StateType, ValueType>::getRowGroup(StateType const& state) const {
103 return stateToRowGroupMapping[state];
104}
105
106template<typename StateType, typename ValueType>
108 return unexploredMarker;
109}
110
111template<typename StateType, typename ValueType>
113 return stateToRowGroupMapping[state] == unexploredMarker;
114}
115
116template<typename StateType, typename ValueType>
118 return terminalStates.find(state) != terminalStates.end();
119}
120
121template<typename StateType, typename ValueType>
123 StateType const& group) const {
124 return rowGroupIndices[group];
125}
126
127template<typename StateType, typename ValueType>
128std::size_t ExplorationInformation<StateType, ValueType>::getRowGroupSize(StateType const& group) const {
129 return rowGroupIndices[group + 1] - rowGroupIndices[group];
130}
131
132template<typename StateType, typename ValueType>
134 return getRowGroupSize(group) == 1;
135}
136
137template<typename StateType, typename ValueType>
139 terminalStates.insert(state);
140}
141
142template<typename StateType, typename ValueType>
143std::vector<storm::storage::MatrixEntry<StateType, ValueType>>& ExplorationInformation<StateType, ValueType>::getRowOfMatrix(ActionType const& row) {
144 return matrix[row];
145}
146
147template<typename StateType, typename ValueType>
148std::vector<storm::storage::MatrixEntry<StateType, ValueType>> const& ExplorationInformation<StateType, ValueType>::getRowOfMatrix(
149 ActionType const& row) const {
150 return matrix[row];
151}
152
153template<typename StateType, typename ValueType>
155 matrix.resize(matrix.size() + count);
156}
157
158template<typename StateType, typename ValueType>
160 return optimizationDirection == storm::OptimizationDirection::Maximize;
161}
162
163template<typename StateType, typename ValueType>
167
168template<typename StateType, typename ValueType>
170 std::size_t& numberExplorationStepsSinceLastPrecomputation) const {
171 bool result = numberExplorationStepsSinceLastPrecomputation > numberOfExplorationStepsUntilPrecomputation;
172 if (result) {
173 numberExplorationStepsSinceLastPrecomputation = 0;
174 }
175 return result;
176}
177
178template<typename StateType, typename ValueType>
179bool ExplorationInformation<StateType, ValueType>::performPrecomputationExcessiveSampledPaths(std::size_t& numberOfSampledPathsSinceLastPrecomputation) const {
180 if (!numberOfSampledPathsUntilPrecomputation) {
181 return false;
182 } else {
183 bool result = numberOfSampledPathsSinceLastPrecomputation > numberOfSampledPathsUntilPrecomputation.get();
184 if (result) {
185 numberOfSampledPathsSinceLastPrecomputation = 0;
186 }
187 return result;
188 }
189}
190
191template<typename StateType, typename ValueType>
193 return localPrecomputation;
194}
195
196template<typename StateType, typename ValueType>
200
201template<typename StateType, typename ValueType>
205
206template<typename StateType, typename ValueType>
210
211template<typename StateType, typename ValueType>
215
216template<typename StateType, typename ValueType>
220
221template<typename StateType, typename ValueType>
225
226template<typename StateType, typename ValueType>
228 optimizationDirection = direction;
229}
230
232} // namespace exploration_detail
233} // namespace modelchecker
234} // namespace storm
storm::modelchecker::exploration_detail::NextStateHeuristic getNextStateHeuristic() const
storm::modelchecker::exploration_detail::PrecomputationType getPrecomputationType() const
std::optional< uint64_t > const & getSampledPathsUntilPrecomputation() const
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::modelchecker::exploration_detail::NextStateHeuristic const & getNextStateHeuristic() const
bool performPrecomputationExcessiveSampledPaths(std::size_t &numberOfSampledPathsSinceLastPrecomputation) const
void assignStateToRowGroup(StateType const &state, ActionType const &rowGroup)
storm::OptimizationDirection const & getOptimizationDirection() const
ExplorationInformation(ExplorationEnvironment const &env, storm::OptimizationDirection const &direction, ActionType const &unexploredMarker=std::numeric_limits< ActionType >::max())
bool performPrecomputationExcessiveExplorationSteps(std::size_t &numberExplorationStepsSinceLastPrecomputation) const
ActionType const & getStartRowOfGroup(StateType const &group) const
size_t size() const
Retrieves the number of bits this bit vector can store.
storm::storage::BitVector CompressedState
solver::OptimizationDirection OptimizationDirection