Storm 1.14.0.1
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
BeliefExplorationBounds.h
Go to the documentation of this file.
1#pragma once
2
3#include <algorithm>
4#include <optional>
5#include <vector>
6
12
13namespace storm {
14namespace pomdp {
15namespace storage {
19template<typename POMDPValueType>
21 // Vectors containing upper and lower bound values for the POMDP states
22 std::vector<std::vector<POMDPValueType>> lower;
23 std::vector<std::vector<POMDPValueType>> upper;
24 std::vector<storm::storage::Scheduler<POMDPValueType>> lowerSchedulers;
25 std::vector<storm::storage::Scheduler<POMDPValueType>> upperSchedulers;
26
33 template<typename OutputValueType>
34 OutputValueType getLowerBound(uint64_t scheduler_id, uint64_t const& state) {
35 STORM_LOG_ASSERT(!lower.empty(), "requested a lower bound but none were available");
36 return storm::utility::convertNumber<OutputValueType>(lower[scheduler_id][state]);
37 }
38
44 template<typename OutputValueType>
45 OutputValueType getUpperBound(uint64_t scheduler_id, uint64_t const& state) {
46 STORM_LOG_ASSERT(!upper.empty(), "requested an upper bound but none were available");
47 return storm::utility::convertNumber<OutputValueType>(upper[scheduler_id][state]);
48 }
49
55 template<typename OutputValueType>
56 OutputValueType getHighestLowerBound(uint64_t const& state) {
57 STORM_LOG_ASSERT(!lower.empty(), "requested a lower bound but none were available");
58 auto it = lower.begin();
59 POMDPValueType result = (*it)[state];
60 for (++it; it != lower.end(); ++it) {
61 result = std::max(result, (*it)[state]);
62 }
64 }
65
70 template<typename OutputValueType>
71 OutputValueType getSmallestUpperBound(uint64_t const& state) {
72 STORM_LOG_ASSERT(!upper.empty(), "requested an upper bound but none were available");
73 auto it = upper.begin();
74 POMDPValueType result = (*it)[state];
75 for (++it; it != upper.end(); ++it) {
76 result = std::min(result, (*it)[state]);
77 }
79 }
80
81 template<typename OutputValueType>
84 for (auto const& vec : lower) {
86 }
87 for (auto const& vec : upper) {
89 }
90 for (auto const& sched : lowerSchedulers) {
91 convertedBounds.lowerSchedulers.push_back(sched.template toValueType<OutputValueType>());
92 }
93 for (auto const& sched : upperSchedulers) {
94 convertedBounds.upperSchedulers.push_back(sched.template toValueType<OutputValueType>());
95 }
96 return convertedBounds;
97 }
98};
99
103template<typename POMDPValueType>
105 bool min;
106 std::vector<POMDPValueType> values;
113 template<typename OutputValueType>
114 OutputValueType getValueForState(uint64_t const& state) {
115 STORM_LOG_ASSERT(!values.empty(), "requested an extreme bound but none were available");
117 }
118 template<typename OutputValueType>
119 std::vector<OutputValueType> copyValues() const {
121 }
122
123 template<typename OutputValueType>
126 convertedBounds.values = copyValues<OutputValueType>();
127 convertedBounds.min = min;
128 convertedBounds.isInfinite = isInfinite;
129 return convertedBounds;
130 }
131};
132
136template<typename POMDPValueType>
138 std::optional<PreprocessingPomdpValueBounds<POMDPValueType>> preprocessingBounds = std::nullopt;
139 std::optional<ExtremePOMDPValueBound<POMDPValueType>> extremeBounds = std::nullopt;
140};
141
142} // namespace storage
143} // namespace pomdp
144} // namespace storm
A bit vector that is internally represented as a vector of 64-bit values.
Definition BitVector.h:16
#define STORM_LOG_ASSERT(cond, message)
Definition macros.h:9
std::vector< TargetType > convertNumericVector(std::vector< SourceType > const &oldVector)
Converts the given vector to the given ValueType Assumes that both, TargetType and SourceType are num...
Definition vector.h:970
TargetType convertNumber(SourceType const &number)
Struct for storing precomputed values bounding the actual values on the POMDP.
std::optional< ExtremePOMDPValueBound< POMDPValueType > > extremeBounds
std::optional< PreprocessingPomdpValueBounds< POMDPValueType > > preprocessingBounds
Struct to store the extreme bound values needed for the reward correction values when clipping is use...
OutputValueType getValueForState(uint64_t const &state)
Get the extreme bound value for a given state.
ExtremePOMDPValueBound< OutputValueType > toValueType()
std::vector< OutputValueType > copyValues() const
Struct for storing precomputed values bounding the actual values on the POMDP.
PreprocessingPomdpValueBounds< OutputValueType > toValueType()
OutputValueType getSmallestUpperBound(uint64_t const &state)
Picks the smallest precomputed upper bound for a given state of the POMDP.
OutputValueType getHighestLowerBound(uint64_t const &state)
Picks the largest precomputed lower bound for a given state of the POMDP.
std::vector< storm::storage::Scheduler< PomdpValueType > > lowerSchedulers
OutputValueType getLowerBound(uint64_t scheduler_id, uint64_t const &state)
Picks the precomputed lower bound for a given scheduler index and state of the POMDP.
OutputValueType getUpperBound(uint64_t scheduler_id, uint64_t const &state)
Picks the precomputed upper bound for a given scheduler index and state of the POMDP.
std::vector< storm::storage::Scheduler< PomdpValueType > > upperSchedulers