Storm 1.14.0.1
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
BeliefBasedModelChecker.cpp
Go to the documentation of this file.
2
20#include "storm/utility/graph.h"
22
23#include <sstream>
24
25namespace storm::pomdp::beliefs {
26
27void validateRewardModelSelection(PropertyInformation const& propertyInformation, std::vector<std::string> const& rewardModelNames) {
28 STORM_LOG_THROW(!rewardModelNames.empty(), storm::exceptions::IllegalArgumentException,
29 "Reward-aware belief exploration requires at least one selected reward model.");
30 for (auto const& rewardBound : propertyInformation.rewardBounds) {
31 // TODO: we can lift this if the handling of empty reward models is made consistent in storm-main
32 STORM_LOG_THROW(!rewardBound.rewardModelName.empty(), storm::exceptions::NotSupportedException,
33 "For POMDPs, reward-bounded formulae must explicitly name a reward model for each bound.");
35 !(propertyInformation.dir == storm::OptimizationDirection::Minimize && rewardBound.lowerBound.has_value() && rewardBound.upperBound.has_value()),
36 storm::exceptions::NotSupportedException,
37 "Reward-bounded probability minimisation does not support dimensions with both lower and upper reward bounds.");
38 }
39 STORM_LOG_THROW(rewardModelNames.size() >= propertyInformation.rewardBounds.size(), storm::exceptions::IllegalArgumentException,
40 "The selected reward models must include all reward-bounded dimensions first.");
41 for (std::size_t i = 0; i < propertyInformation.rewardBounds.size(); ++i) {
43 rewardModelNames[i] == propertyInformation.rewardBounds[i].rewardModelName, storm::exceptions::IllegalArgumentException,
44 "Selected reward model " << i << " must match the corresponding reward bound '" << propertyInformation.rewardBounds[i].rewardModelName << "'.");
45 }
46}
47
48template<typename PomdpModelType, typename BeliefValueType, typename BeliefMdpValueType>
50 STORM_LOG_THROW(inputPomdp.isCanonic(), storm::exceptions::IllegalArgumentException, "Belief-based model checking requires a canonic POMDP.");
51}
52
54template<typename PomdpModelType, typename BeliefType, typename BeliefMdpValueType, typename InfoType>
57 switch (options.getTerminationCriterion()) {
59 return [&info, maxSize = options.maxExplorationSize.value()]() { return info.discoveredBeliefs.getNumberOfBeliefIds() > maxSize; };
61 return [&swExplore, maxDuration = options.maxExplorationTime.value()]() { return swExplore.getTimeInSeconds() > static_cast<double>(maxDuration); };
63 return [&info, &swExplore, maxSize = options.maxExplorationSize.value(), maxDuration = options.maxExplorationTime.value()]() {
64 return info.discoveredBeliefs.getNumberOfBeliefIds() > maxSize || swExplore.getTimeInSeconds() > static_cast<double>(maxDuration);
65 };
66 case NONE:
67 // Unlimited unfolding (useful for known finite belief MDPs)
68 return []() { return false; };
69 default:
70 STORM_LOG_ERROR("Unknown termination criterion for belief exploration.");
71 return []() { return false; };
72 }
73}
74
80template<typename PomdpModelType, typename BeliefType, typename BeliefMdpValueType>
84 using PomdpValueType = typename PomdpModelType::ValueType;
86 if (options.cutZeroGap) {
87 // Terminate only if the preprocessing bounds have exactly zero gap.
88 return [&propertyInformation, &valueBounds](BeliefType const& belief) -> std::optional<BeliefMdpValueType> {
89 if (propertyInformation.targetObservations.contains(belief.observation())) {
91 } else {
92 auto smallestUpper = storm::utility::infinity<PomdpValueType>();
93 for (auto const& valueList : valueBounds.upper) {
94 smallestUpper = std::min(smallestUpper, belief.template getWeightedSum<PomdpValueType>(valueList));
95 }
96 PomdpValueType largestLower = -storm::utility::infinity<PomdpValueType>();
97 for (auto const& valueList : valueBounds.lower) {
98 largestLower = storm::utility::max(largestLower, belief.template getWeightedSum<PomdpValueType>(valueList));
99 }
100 if (storm::utility::abs<PomdpValueType>(smallestUpper - largestLower) <= storm::utility::zero<PomdpValueType>()) {
101 if constexpr (std::is_same_v<PomdpValueType, BeliefMdpValueType>) {
102 return propertyInformation.dir == solver::OptimizationDirection::Maximize ? largestLower : smallestUpper;
103 } else {
105 propertyInformation.dir == solver::OptimizationDirection::Maximize ? largestLower : smallestUpper);
106 }
107 }
108 return std::nullopt;
109 }
110 };
111 } else {
112 return [&propertyInformation](BeliefType const& belief) -> std::optional<BeliefMdpValueType> {
113 if (propertyInformation.targetObservations.contains(belief.observation())) {
115 } else {
116 return std::nullopt;
117 }
118 };
119 }
121 return [](BeliefType const& belief) -> std::optional<BeliefMdpValueType> {
122 // Reward-aware exploration deliberately has no terminal beliefs. Reaching a target observation does not decide
123 // a reward-bounded property: lower bounds may require further reward accumulation, and the reward vector is
124 // encoded only on the transition. The belief MDP builder consequently receives ordinary explored/frontier edges.
125 return std::nullopt;
126 };
127 } else if (options.cutZeroGap) {
128 // Terminate only if the preprocessing bounds have exactly zero gap.
129 return [&propertyInformation, &valueBounds](BeliefType const& belief) -> std::optional<BeliefMdpValueType> {
130 if (propertyInformation.targetObservations.contains(belief.observation())) {
132 } else {
133 auto smallestUpper = storm::utility::infinity<PomdpValueType>();
134 for (auto const& valueList : valueBounds.upper) {
135 smallestUpper = std::min(smallestUpper, belief.template getWeightedSum<PomdpValueType>(valueList));
136 }
137 PomdpValueType largestLower = -storm::utility::infinity<PomdpValueType>();
138 for (auto const& valueList : valueBounds.lower) {
139 largestLower = storm::utility::max(largestLower, belief.template getWeightedSum<PomdpValueType>(valueList));
140 }
141 if (storm::utility::abs<PomdpValueType>(smallestUpper - largestLower) <= storm::utility::zero<PomdpValueType>()) {
142 if constexpr (std::is_same_v<PomdpValueType, BeliefMdpValueType>) {
143 return propertyInformation.dir == solver::OptimizationDirection::Maximize ? largestLower : smallestUpper;
144 } else {
146 propertyInformation.dir == solver::OptimizationDirection::Maximize ? largestLower : smallestUpper);
147 }
148 }
149 return std::nullopt;
150 }
151 };
152 } else {
153 return [&propertyInformation](BeliefType const& belief) -> std::optional<BeliefMdpValueType> {
154 if (propertyInformation.targetObservations.contains(belief.observation())) {
156 } else {
157 return std::nullopt;
158 }
159 };
160 }
161}
162
168template<typename PomdpModelType, typename BeliefType, typename BeliefMdpValueType, typename InfoType>
169std::pair<std::shared_ptr<models::sparse::Mdp<BeliefMdpValueType>>, std::unordered_map<uint64_t, BeliefId>> buildBeliefMdpFromInfo(
171 InfoType const& info) {
172 using PomdpValueType = typename PomdpModelType::ValueType;
173 std::function<std::unordered_map<std::string, BeliefMdpValueType>(BeliefType const&)> computeCutOffValueMap =
174 [&valueBounds, &propertyInformation](BeliefType const& belief) {
175 // Add addtional cut-off sources here
176 uint64_t const nrCutoffPolicies =
177 propertyInformation.dir == storm::OptimizationDirection::Minimize ? valueBounds.upper.size() : valueBounds.lower.size();
178 std::unordered_map<std::string, BeliefMdpValueType> result;
179 for (uint64_t i = 0; i < nrCutoffPolicies; ++i) {
180 auto val = belief.template getWeightedSum<PomdpValueType>(
181 propertyInformation.dir == storm::OptimizationDirection::Minimize ? valueBounds.upper.at(i) : valueBounds.lower.at(i));
182 if constexpr (std::is_same_v<PomdpValueType, BeliefMdpValueType>) {
183 result["__sched_" + std::to_string(i)] = val;
184 } else {
185 result["__sched_" + std::to_string(i)] = storm::utility::convertNumber<BeliefMdpValueType>(val);
186 }
187 }
188 return result;
189 };
190 return buildBeliefMdp(info, propertyInformation, computeCutOffValueMap);
191}
192
193template<typename PomdpModelType, typename BeliefType, typename BeliefMdpValueType, typename AbstractionType,
196 storm::Environment const& env, PomdpModelType const& pomdp, PropertyInformation const& propertyInformation,
199 BeliefBasedModelCheckerStatistics statistics;
202 "Unexpected kind of property.");
203
204 STORM_LOG_INFO("Exploring the belief space.");
205
206 // First, explore the beliefs and its successors
207 using BeliefExplorationType = BeliefExploration<BeliefMdpValueType, PomdpModelType, BeliefType>;
208 storm::utility::Stopwatch swExplore(true);
209 BeliefExplorationType exploration(pomdp);
210
211 auto info = exploration.template initializeExploration<InfoType>(pomdp.getNrObservations(), options.explorationQueueOrder);
212 info.generateChoiceLabeling = options.buildChoiceLabeling;
213
214 // Determine terminationCallback based on options
215 typename BeliefExplorationType::TerminationCallback terminationCallback =
217
218 // Determine terminalBeliefCallback based on options
219 typename BeliefExplorationType::TerminalBeliefCallback terminalBeliefCallback =
221
222 if constexpr (std::is_same_v<InfoType, ClippingExplorationInformation<BeliefMdpValueType, BeliefType>>) {
223 STORM_LOG_ASSERT(options.useClipping, "Clipping exploration information requires clipping to be enabled.");
225 exploration.resumeClippingExploration(info, terminalBeliefCallback, terminationCallback, propertyInformation.rewardModelName.value(), abstraction);
226 } else {
227 exploration.resumeClippingExploration(info, terminalBeliefCallback, terminationCallback, storm::NullRef, abstraction);
228 }
229 STORM_LOG_TRACE("Starting clipping phase.");
230 STORM_LOG_ASSERT(options.clippingResolutions.has_value(), "Clipping requested, but no resolution vector given.");
231 std::vector<uint64_t> resolutions(options.clippingResolutions.value());
233 STORM_LOG_ASSERT(valueBounds.extremeBounds.has_value(),
234 "Clipping for expected total reachability reward requires extreme value bounds to be given.");
235 ClippingBeliefAbstraction<BeliefType> clippingAbstraction(
236 env, std::move(resolutions), std::move(valueBounds.extremeBounds->template copyValues<typename BeliefType::ValueType>()));
237 exploration.resumeClippingExploration(
238 info, terminalBeliefCallback, []() { return false; }, propertyInformation.rewardModelName.value(), storm::OptionalRef(clippingAbstraction));
239 } else {
240 ClippingBeliefAbstraction<BeliefType> clippingAbstraction(env, std::move(resolutions));
241 exploration.resumeClippingExploration(
242 info, terminalBeliefCallback, []() { return false; }, storm::NullRef, storm::OptionalRef(clippingAbstraction));
243 }
244 STORM_LOG_TRACE("Finished clipping phase.");
245 } else {
247 exploration.resumeExploration(info, terminalBeliefCallback, terminationCallback, propertyInformation.rewardModelName.value(), abstraction);
248 } else {
249 exploration.resumeExploration(info, terminalBeliefCallback, terminationCallback, storm::NullRef, abstraction);
250 }
251 }
252 swExplore.stop();
253 bool earlyExplorationStop = info.queue.hasNext();
254 statistics.completedExploration = !earlyExplorationStop;
255 statistics.discoveredBeliefs = info.discoveredBeliefs.getNumberOfBeliefIds();
256 statistics.exploredBeliefs = info.exploredBeliefs.size();
257 statistics.explorationTimeMilliseconds = swExplore.getTimeInMilliseconds();
258 if (earlyExplorationStop) {
259 STORM_LOG_INFO("Exploration stopped before all beliefs were explored. " << info.discoveredBeliefs.getNumberOfBeliefIds() << " beliefs discovered. "
260 << info.exploredBeliefs.size() << " beliefs explored.");
261 }
262
263 // Second, build the Belief MDP from the exploration information
264 STORM_LOG_INFO("Constructing the belief MDP.");
265 storm::utility::Stopwatch swBuild(true);
266 auto [beliefMdp, stateToBeliefMap] =
268 swBuild.stop();
269 {
270 std::stringstream stream;
271 beliefMdp->printModelInformationToStream(stream);
272 STORM_LOG_INFO("Constructed belief MDP:\n" << stream.str());
273 }
274 statistics.beliefMdpStates = beliefMdp->getNumberOfStates();
275 statistics.beliefMdpChoices = beliefMdp->getNumberOfChoices();
276 statistics.beliefMdpTransitions = beliefMdp->getNumberOfTransitions();
277 statistics.beliefMdpBuildTimeMilliseconds = swBuild.getTimeInMilliseconds();
278
279 // Finally, perform model checking on the belief MDP.
280 storm::utility::Stopwatch swCheck(true);
281 auto formula = createFormulaForBeliefMdp(propertyInformation);
282 storm::modelchecker::CheckTask<storm::logic::Formula, BeliefMdpValueType> task(*formula, true);
283 std::unique_ptr<storm::modelchecker::CheckResult> res(storm::api::verifyWithSparseEngine<BeliefMdpValueType>(env, beliefMdp, task));
284 swCheck.stop();
285 statistics.beliefMdpAnalysisTimeMilliseconds = swCheck.getTimeInMilliseconds();
286 STORM_LOG_INFO("Time for exploring beliefs: " << swExplore << ".");
287 STORM_LOG_INFO("Time for building the belief MDP: " << swBuild << ".");
288 STORM_LOG_INFO("Time for analyzing the belief MDP: " << swCheck << ".");
289 STORM_LOG_ASSERT(res, "Model checking of belief MDP did not return any result.");
290 STORM_LOG_ASSERT(res->isExplicitQuantitativeCheckResult(), "Model checking of belief MDP did not return result of expected type.");
291 STORM_LOG_ASSERT(beliefMdp->getInitialStates().getNumberOfSetBits() == 1, "Unexpected number of initial states for belief Mdp.");
292 auto const initState = beliefMdp->getInitialStates().getNextSetIndex(0);
293 return {res->asExplicitQuantitativeCheckResult<BeliefMdpValueType>()[initState], !earlyExplorationStop, std::move(statistics)};
294}
295
296template<typename PomdpModelType, typename BeliefType, typename BeliefMdpValueType>
298 storm::Environment const& env, PomdpModelType const& pomdp, PropertyInformation const& propertyInformation,
303 BeliefBasedModelCheckerStatistics statistics;
304 STORM_LOG_ASSERT(propertyInformation.kind == PropertyInformation::Kind::RewardBoundedReachabilityProbability, "Unexpected kind of property.");
305 STORM_LOG_THROW(!options.useClipping, storm::exceptions::NotSupportedException, "Grid clipping is not supported for reward-bounded POMDP properties.");
306 STORM_LOG_ASSERT(rewardSplitter.getNumberOfSetRewardModels() != 0, "rewardSplitter must have a reward model set for reward-aware belief MDP construction.");
307
308 STORM_LOG_INFO("Exploring the belief space.");
309
310 // First, explore the beliefs and its successors
311 using BeliefExplorationType = BeliefExploration<BeliefMdpValueType, PomdpModelType, BeliefType>;
312 storm::utility::Stopwatch swExplore(true);
313 BeliefExplorationType exploration(pomdp);
315 auto info = exploration.template initializeExploration<InfoType>(pomdp.getNrObservations(), options.explorationQueueOrder);
316 info.generateChoiceLabeling = options.buildChoiceLabeling;
317
318 // Determine terminationCallback based on options
319 typename BeliefExplorationType::TerminationCallback terminationCallback =
321
322 // Determine terminalBeliefCallback based on options
323 typename BeliefExplorationType::TerminalBeliefCallback terminalBeliefCallback =
325
326 exploration.resumeRewardAwareExploration(info, terminalBeliefCallback, terminationCallback, rewardSplitter, abstraction);
327 swExplore.stop();
328 bool const earlyExplorationStop = info.queue.hasNext();
329 statistics.completedExploration = !earlyExplorationStop;
330 statistics.discoveredBeliefs = info.discoveredBeliefs.getNumberOfBeliefIds();
331 statistics.exploredBeliefs = info.exploredBeliefs.size();
332 statistics.explorationTimeMilliseconds = swExplore.getTimeInMilliseconds();
333 if (earlyExplorationStop) {
334 STORM_LOG_INFO("Exploration stopped before all beliefs were explored. " << info.discoveredBeliefs.getNumberOfBeliefIds() << " beliefs discovered. "
335 << info.exploredBeliefs.size() << " beliefs explored.");
336 }
337
338 // Second, build the Belief MDP from the exploration information
339 STORM_LOG_INFO("Constructing the belief MDP.");
340 storm::utility::Stopwatch swBuild(true);
341 auto [beliefMdp, stateToBeliefMap] =
343 swBuild.stop();
344 {
345 std::stringstream stream;
346 beliefMdp->printModelInformationToStream(stream);
347 STORM_LOG_INFO("Constructed belief MDP:\n" << stream.str());
348 }
349 statistics.beliefMdpStates = beliefMdp->getNumberOfStates();
350 statistics.beliefMdpChoices = beliefMdp->getNumberOfChoices();
351 statistics.beliefMdpTransitions = beliefMdp->getNumberOfTransitions();
352 statistics.beliefMdpBuildTimeMilliseconds = swBuild.getTimeInMilliseconds();
353
354 // Finally, perform model checking on the belief MDP.
355 auto formula = createFormulaForBeliefMdp(propertyInformation);
356 STORM_LOG_INFO("Analyzing property '" << *formula << "' on the belief MDP.");
357 storm::utility::Stopwatch swCheck(true);
358 std::shared_ptr<storm::models::sparse::Mdp<BeliefMdpValueType>> processedMdp = beliefMdp;
360 std::vector<std::string> rewardModelNames;
361 for (auto const& bnd : propertyInformation.rewardBounds) {
362 rewardModelNames.push_back(bnd.rewardModelName);
363 }
364 processedMdp = storm::transformer::transformTransitionToActionRewards<BeliefMdpValueType>(processedMdp, rewardModelNames)
365 .model->template as<storm::models::sparse::Mdp<BeliefMdpValueType>>();
366 double increase = static_cast<double>(processedMdp->getNumberOfStates()) / static_cast<double>(beliefMdp->getNumberOfStates());
367 STORM_LOG_INFO("Transformation of transition rewards resulted in a model with " << processedMdp->getNumberOfStates() << " states. " << increase
368 << " times more states than the original belief MDP.");
369
370 // Cut away states that can not reach the target
371 auto targetStates = processedMdp->getStateLabeling().getStates("target");
372 storm::storage::BitVector allStates(targetStates.size(), true);
373 storm::storage::BitVector probGreaterZeroStates;
374 if (storm::solver::maximize(propertyInformation.dir)) {
375 probGreaterZeroStates = storm::utility::graph::performProbGreater0E(processedMdp->getBackwardTransitions(), allStates, targetStates);
376 } else {
377 probGreaterZeroStates =
378 storm::utility::graph::performProbGreater0A(processedMdp->getTransitionMatrix(), processedMdp->getTransitionMatrix().getRowGroupIndices(),
379 processedMdp->getBackwardTransitions(), allStates, targetStates);
380 }
381 auto mergingResult = storm::transformer::GoalStateMerger<BeliefMdpValueType>(*processedMdp)
382 .mergeTargetAndSinkStates(probGreaterZeroStates, ~probGreaterZeroStates, ~allStates, rewardModelNames);
383 processedMdp = mergingResult.model->template as<storm::models::sparse::Mdp<BeliefMdpValueType>>();
384 STORM_LOG_INFO("Merging of sink states resulted in a model with " << processedMdp->getNumberOfStates() << " states.");
385 }
386 if (processedMdp != beliefMdp) {
387 statistics.processedMdpStates = processedMdp->getNumberOfStates();
388 statistics.processedMdpChoices = processedMdp->getNumberOfChoices();
389 statistics.processedMdpTransitions = processedMdp->getNumberOfTransitions();
390 }
391 storm::modelchecker::CheckTask<storm::logic::Formula, BeliefMdpValueType> task(*formula, true);
392 std::unique_ptr<storm::modelchecker::CheckResult> res(storm::api::verifyWithSparseEngine<BeliefMdpValueType>(env, processedMdp, task));
393 swCheck.stop();
394 statistics.beliefMdpAnalysisTimeMilliseconds = swCheck.getTimeInMilliseconds();
395 STORM_LOG_INFO("Time for exploring beliefs: " << swExplore << ".");
396 STORM_LOG_INFO("Time for building the belief MDP: " << swBuild << ".");
397 STORM_LOG_INFO("Time for analyzing the belief MDP: " << swCheck << ".");
398 STORM_LOG_ASSERT(res, "Model checking of belief MDP did not return any result.");
399 STORM_LOG_ASSERT(res->isExplicitQuantitativeCheckResult(), "Model checking of belief MDP did not return result of expected type.");
400 STORM_LOG_ASSERT(processedMdp->getInitialStates().getNumberOfSetBits() == 1, "Unexpected number of initial states for (processed) belief Mdp.");
401 auto const initState = processedMdp->getInitialStates().getNextSetIndex(0);
402 return {res->asExplicitQuantitativeCheckResult<BeliefMdpValueType>()[initState], !earlyExplorationStop, std::move(statistics)};
403}
404
405template<typename PomdpModelType, typename BeliefValueType, typename BeliefMdpValueType>
419
420template<typename PomdpModelType, typename BeliefValueType, typename BeliefMdpValueType>
422 storm::Environment const& env, PropertyInformation const& propertyInformation,
423 storm::pomdp::beliefs::BeliefBasedModelCheckerOptions<BeliefMdpValueType> const& options, uint64_t resolution, bool useDynamic,
425 STORM_LOG_THROW(options.getTerminationCriterion() == NONE, storm::exceptions::NotSupportedException,
426 "Belief discretization does not support exploration size or time limits.");
429 return checkUnfoldOrDiscretize<PomdpModelType, Belief<BeliefValueType>, BeliefMdpValueType>(env, inputPomdp, propertyInformation, options, valueBounds,
430 storm::OptionalRef(abstraction));
431}
432
433template<typename PomdpModelType, typename BeliefValueType, typename BeliefMdpValueType>
435 storm::Environment const& env, PropertyInformation const& propertyInformation,
437 storage::BeliefExplorationBounds<typename PomdpModelType::ValueType> const& valueBounds, std::vector<std::string> const& relevantRewardModelNames) {
438 validateRewardModelSelection(propertyInformation, relevantRewardModelNames);
440 rewardBoundedBeliefSplitter.setRewardModels(relevantRewardModelNames);
441 return checkRewardAwareUnfoldOrDiscretize<PomdpModelType, Belief<BeliefValueType>, BeliefMdpValueType>(env, inputPomdp, propertyInformation, options,
442 valueBounds, rewardBoundedBeliefSplitter);
443}
444
445template<typename PomdpModelType, typename BeliefValueType, typename BeliefMdpValueType>
447 storm::Environment const& env, PropertyInformation const& propertyInformation,
448 storm::pomdp::beliefs::BeliefBasedModelCheckerOptions<BeliefMdpValueType> const& options, uint64_t resolution, bool useDynamic,
449 storage::BeliefExplorationBounds<typename PomdpModelType::ValueType> const& valueBounds, std::vector<std::string> const& relevantRewardModelNames) {
450 STORM_LOG_THROW(options.getTerminationCriterion() == NONE, storm::exceptions::NotSupportedException,
451 "Belief discretization does not support exploration size or time limits.");
452 validateRewardModelSelection(propertyInformation, relevantRewardModelNames);
456 rewardBoundedBeliefSplitter.setRewardModels(relevantRewardModelNames);
458 env, inputPomdp, propertyInformation, options, valueBounds, rewardBoundedBeliefSplitter, abstraction);
459}
460
462template class BeliefBasedModelChecker<storm::models::sparse::Pomdp<double>, storm::RationalNumber, double>;
463template class BeliefBasedModelChecker<storm::models::sparse::Pomdp<storm::RationalNumber>, storm::RationalNumber, storm::RationalNumber>;
464template class BeliefBasedModelChecker<storm::models::sparse::Pomdp<storm::RationalNumber>, storm::RationalNumber, double>;
465template class BeliefBasedModelChecker<storm::models::sparse::Pomdp<double>, double, storm::RationalNumber>;
466// Currently we don't consider this combination as having rational numbers in models, but floats in beliefs does not really help us
467// template class BeliefBasedModelChecker<storm::models::sparse::Pomdp<storm::RationalNumber>, double, storm::RationalNumber>;
468} // namespace storm::pomdp::beliefs
Helper class that optionally holds a reference to an object of type T.
Definition OptionalRef.h:48
Builds and checks a finite belief MDP approximation of a POMDP.
BeliefBasedModelChecker(PomdpModelType const &pomdp)
Creates a checker for a canonic POMDP.
BeliefBasedModelCheckerResult< BeliefMdpValueType > checkRewardAwareDiscretize(storm::Environment const &env, PropertyInformation const &propertyInformation, storm::pomdp::beliefs::BeliefBasedModelCheckerOptions< BeliefMdpValueType > const &options, uint64_t resolution, bool useDynamic, storage::BeliefExplorationBounds< typename PomdpModelType::ValueType > const &valueBounds, std::vector< std::string > const &relevantRewardModelNames)
Combines reward-aware exploration with Freudenthal triangulation discretization.
BeliefBasedModelCheckerResult< BeliefMdpValueType > checkDiscretize(storm::Environment const &env, PropertyInformation const &propertyInformation, storm::pomdp::beliefs::BeliefBasedModelCheckerOptions< BeliefMdpValueType > const &options, uint64_t resolution, bool useDynamic, storage::BeliefExplorationBounds< PomdpValueType > const &valueBounds)
Explores the belief space and discretises beliefs using the Freudenthal triangualtion approximation.
BeliefBasedModelCheckerResult< BeliefMdpValueType > checkUnfold(storm::Environment const &env, PropertyInformation const &propertyInformation, BeliefBasedModelCheckerOptions< BeliefMdpValueType > const &options, storage::BeliefExplorationBounds< PomdpValueType > const &valueBounds)
Explores the belief MDP by unfolding the belief space.
BeliefBasedModelCheckerResult< BeliefMdpValueType > checkRewardAwareUnfold(storm::Environment const &env, PropertyInformation const &propertyInformation, storm::pomdp::beliefs::BeliefBasedModelCheckerOptions< BeliefMdpValueType > const &options, storage::BeliefExplorationBounds< typename PomdpModelType::ValueType > const &valueBounds, std::vector< std::string > const &relevantRewardModelNames)
Explores a reward-aware belief MDP, splitting beliefs before successor generation by their reward vec...
std::function< std::optional< BeliefMdpValueType >(BeliefType const &)> TerminalBeliefCallback
Approximates a belief by clipping it to an observation-specific grid point.
Abstracts a belief by triangulating it using the Freudenthal triangulation.
Abstracts a given belief by splitting it into sub-beliefs based on the (state-action) reward of the P...
void setRewardModels(std::vector< std::string > const &rewardModelNames)
Selects a nonempty list of reward models used to form reward vectors.
A class that provides convenience operations to display run times.
Definition Stopwatch.h:13
SecondType getTimeInSeconds() const
Gets the measured time in seconds.
Definition Stopwatch.cpp:13
#define STORM_LOG_INFO(message)
Definition logging.h:34
#define STORM_LOG_TRACE(message)
Definition logging.h:22
#define STORM_LOG_ERROR(message)
Definition logging.h:36
#define STORM_LOG_ASSERT(cond, message)
Definition macros.h:9
#define STORM_LOG_THROW(cond, exception, message)
Definition macros.h:39
std::unique_ptr< storm::modelchecker::CheckResult > verifyWithSparseEngine(storm::Environment const &env, std::shared_ptr< storm::models::sparse::Dtmc< ValueType > > const &dtmc, storm::modelchecker::CheckTask< storm::logic::Formula, ValueType > const &task, bool preferEliminationChecker=false)
std::pair< std::shared_ptr< models::sparse::Mdp< BeliefMdpValueType > >, std::unordered_map< uint64_t, BeliefId > > buildBeliefMdpFromInfo(PropertyInformation const &propertyInformation, storm::pomdp::storage::PreprocessingPomdpValueBounds< typename PomdpModelType::ValueType > const &valueBounds, InfoType const &info)
Converts exploration information into a finite MDP.
BeliefBasedModelCheckerResult< BeliefMdpValueType > checkUnfoldOrDiscretize(storm::Environment const &env, PomdpModelType const &pomdp, PropertyInformation const &propertyInformation, storm::pomdp::beliefs::BeliefBasedModelCheckerOptions< BeliefMdpValueType > const &options, storage::BeliefExplorationBounds< typename PomdpModelType::ValueType > const &valueBounds, storm::OptionalRef< AbstractionType > abstraction={})
BeliefBasedModelCheckerResult< BeliefMdpValueType > checkRewardAwareUnfoldOrDiscretize(storm::Environment const &env, PomdpModelType const &pomdp, PropertyInformation const &propertyInformation, storm::pomdp::beliefs::BeliefBasedModelCheckerOptions< BeliefMdpValueType > const &options, storage::BeliefExplorationBounds< typename PomdpModelType::ValueType > const &valueBounds, RewardBoundedBeliefSplitter< BeliefMdpValueType, PomdpModelType, BeliefType > &rewardSplitter, storm::OptionalRef< FreudenthalTriangulationBeliefAbstraction< BeliefType > > abstraction={})
void validateRewardModelSelection(PropertyInformation const &propertyInformation, std::vector< std::string > const &rewardModelNames)
BeliefExploration< BeliefMdpValueType, PomdpModelType, BeliefType >::TerminationCallback getTerminationCallback(storm::pomdp::beliefs::BeliefBasedModelCheckerOptions< BeliefMdpValueType > const &options, InfoType &info, storm::utility::Stopwatch &swExplore)
Creates the callback that ends exploration and turns the queued beliefs into the frontier.
std::shared_ptr< storm::logic::Formula const > createFormulaForBeliefMdp(PropertyInformation const &propertyInformation)
ExplorationInformation< BeliefMdpValueType, BeliefType, std::optional< BeliefMdpValueType >, std::optional< BeliefMdpValueType > > ClippingExplorationInformation
Exploration information that stores optional clipping probability and reward-adjustment metadata.
ExplorationInformation< BeliefMdpValueType, BeliefType > StandardExplorationInformation
Exploration information without transition metadata.
BeliefExploration< BeliefMdpValueType, PomdpModelType, BeliefType >::TerminalBeliefCallback getTerminalBeliefCallback(PropertyInformation const &propertyInformation, storm::pomdp::beliefs::BeliefBasedModelCheckerOptions< BeliefMdpValueType > const &options, storm::pomdp::storage::PreprocessingPomdpValueBounds< typename PomdpModelType::ValueType > const &valueBounds)
Creates a callback that recognizes property targets and optional zero-gap cut-offs as terminal belief...
std::pair< std::shared_ptr< models::sparse::Mdp< BeliefMdpValueType > >, std::unordered_map< uint64_t, BeliefId > > buildBeliefMdp(ExplorationInformation< BeliefMdpValueType, BeliefType, ExtraTransitionData... > const &explorationInformation, PropertyInformation const &propertyInformation, std::function< std::unordered_map< std::string, BeliefMdpValueType >(BeliefType const &)> const &computeCutOffValueMap)
Builds a belief MDP from the given exploration information and property information.
ExplorationInformation< BeliefMdpValueType, BeliefType, std::vector< BeliefMdpValueType > > RewardAwareExplorationInformation
Exploration information that stores a reward vector on each transition.
bool constexpr maximize(OptimizationDirection d)
TransitionToActionRewardTransformerReturnType< ValueType, RewardModelType > transformTransitionToActionRewards(std::shared_ptr< storm::models::sparse::Model< ValueType, RewardModelType > > originalModel, std::vector< std::string > const &relevantRewardModelNames)
Replaces transition branch rewards from all given reward models and replaces them by equivalent state...
storm::storage::BitVector performProbGreater0A(storm::storage::SparseMatrix< T > const &transitionMatrix, std::vector< uint_fast64_t > const &nondeterministicChoiceIndices, storm::storage::SparseMatrix< T > const &backwardTransitions, storm::storage::BitVector const &phiStates, storm::storage::BitVector const &psiStates, bool useStepBound, uint_fast64_t maximalSteps, boost::optional< storm::storage::BitVector > const &choiceConstraint)
Computes the sets of states that have probability greater 0 of satisfying phi until psi under any pos...
Definition graph.cpp:881
storm::storage::BitVector performProbGreater0E(storm::storage::SparseMatrix< T > const &backwardTransitions, storm::storage::BitVector const &phiStates, storm::storage::BitVector const &psiStates, bool useStepBound, uint_fast64_t maximalSteps)
Computes the sets of states that have probability greater 0 of satisfying phi until psi under at leas...
Definition graph.cpp:674
ValueType max(ValueType const &first, ValueType const &second)
ValueType abs(ValueType const &number)
ValueType zero()
Definition constants.cpp:26
ValueType infinity()
Definition constants.cpp:31
ValueType one()
Definition constants.cpp:21
TargetType convertNumber(SourceType const &number)
OptionalRef(T &) -> OptionalRef< T >
deduction guides
constexpr NullRefType NullRef
Definition OptionalRef.h:31
bool cutZeroGap
Cut non-target beliefs only when their preprocessing lower and upper bounds have exactly zero gap.
explorationTerminationCriterion getTerminationCriterion() const
Get the termination criterion for the exploration.
Auxiliary struct used to identify cases where no abstraction of beliefs shall be applied.
Property data consumed by the belief MDP construction.
std::set< BeliefObservationType > targetObservations
Struct for storing precomputed values bounding the actual values on the POMDP.
std::optional< ExtremePOMDPValueBound< POMDPValueType > > extremeBounds
std::optional< PreprocessingPomdpValueBounds< POMDPValueType > > preprocessingBounds
Struct for storing precomputed values bounding the actual values on the POMDP.
std::vector< std::vector< POMDPValueType > > lower
std::vector< std::vector< POMDPValueType > > upper