Storm
A Modern Probabilistic Model Checker
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
BeliefExplorationPomdpModelChecker.h
Go to the documentation of this file.
5
8
9namespace storm {
10class Environment;
11
12namespace models {
13namespace sparse {
14template<class ValueType, typename RewardModelType>
15class Pomdp;
16}
17} // namespace models
18namespace logic {
19class Formula;
20}
21
22namespace pomdp {
23namespace modelchecker {
24
32template<typename ValueType>
34 // values generated by memoryless schedulers during pre-processing
36 // values for clipping compensation
38 // values generated by a finite memory schedulers. Each scheduler is represented by a vector of maps representing (memory node x state) -> value
39 std::vector<std::vector<std::unordered_map<uint64_t, ValueType>>> fmSchedulerValueList;
40};
49template<typename PomdpModelType, typename BeliefValueType = typename PomdpModelType::ValueType, typename BeliefMDPType = typename PomdpModelType::ValueType>
51 public:
52 typedef BeliefMDPType ValueType;
53 typedef typename PomdpModelType::RewardModelType RewardModelType;
57
58 /* Struct Definition(s) */
70
74 struct Result {
75 Result(ValueType lower, ValueType upper);
78 ValueType diff(bool relative = false) const;
79 bool updateLowerBound(ValueType const& value);
80 bool updateUpperBound(ValueType const& value);
81 std::shared_ptr<storm::models::sparse::Model<ValueType>> schedulerAsMarkovChain;
82 std::vector<storm::storage::Scheduler<ValueType>> cutoffSchedulers;
83 };
84
85 /* Functions */
86
92 explicit BeliefExplorationPomdpModelChecker(std::shared_ptr<PomdpModelType> pomdp, Options options = Options());
93
102 Result check(storm::Environment const& env, storm::logic::Formula const& formula, storm::Environment const& preProcEnv,
103 std::vector<std::vector<std::unordered_map<uint64_t, ValueType>>> const& additionalUnderApproximationBounds =
104 std::vector<std::vector<std::unordered_map<uint64_t, ValueType>>>());
105 Result check(storm::logic::Formula const& formula, storm::Environment const& preProcEnv,
106 std::vector<std::vector<std::unordered_map<uint64_t, ValueType>>> const& additionalUnderApproximationBounds =
107 std::vector<std::vector<std::unordered_map<uint64_t, ValueType>>>());
108 Result check(storm::logic::Formula const& formula,
109 std::vector<std::vector<std::unordered_map<uint64_t, ValueType>>> const& additionalUnderApproximationBounds =
110 std::vector<std::vector<std::unordered_map<uint64_t, ValueType>>>());
111 Result check(storm::Environment const& env, storm::logic::Formula const& formula,
112 std::vector<std::vector<std::unordered_map<uint64_t, ValueType>>> const& additionalUnderApproximationBounds =
113 std::vector<std::vector<std::unordered_map<uint64_t, ValueType>>>());
114
119 void printStatisticsToStream(std::ostream& stream) const;
120
126 void precomputeValueBounds(const logic::Formula& formula, storm::Environment const& preProcEnv);
127
139 void unfoldInteractively(storm::Environment const& env, std::set<uint32_t> const& targetObservations, bool min, std::optional<std::string> rewardModelName,
141 void unfoldInteractively(std::set<uint32_t> const& targetObservations, bool min, std::optional<std::string> rewardModelName,
143
147 void pauseUnfolding();
148
152 void continueUnfolding();
153
157 void terminateUnfolding();
158
163 bool isResultReady();
164
169 bool isExploring();
170
175 bool hasConverged();
176
182
187 std::shared_ptr<ExplorerType> getInteractiveBeliefExplorer();
188
189 void setFMSchedValueList(std::vector<std::vector<std::unordered_map<uint64_t, ValueType>>> valueList);
190
195 int64_t getStatus();
196
197 private:
198 /* Struct Definition(s) */
199
203 enum class UnfoldingControl { Run, Pause, Terminate };
204
208 struct Statistics {
209 Statistics();
210 std::optional<uint64_t> refinementSteps;
212
213 bool beliefMdpDetectedToBeFinite;
214 bool refinementFixpointDetected;
215
216 std::optional<uint64_t> overApproximationStates;
217 bool overApproximationBuildAborted;
218 storm::utility::Stopwatch overApproximationBuildTime;
219 storm::utility::Stopwatch overApproximationCheckTime;
220 std::optional<BeliefValueType> overApproximationMaxResolution;
221
222 std::optional<uint64_t> underApproximationStates;
223 bool underApproximationBuildAborted;
224 storm::utility::Stopwatch underApproximationBuildTime;
225 storm::utility::Stopwatch underApproximationCheckTime;
226 std::optional<uint64_t> underApproximationStateLimit;
227 std::optional<uint64_t> nrClippingAttempts;
228 std::optional<uint64_t> nrClippedStates;
229 std::optional<uint64_t> nrTruncatedStates;
231 storm::utility::Stopwatch clippingPreTime;
232
233 bool aborted;
234 };
235
239 struct HeuristicParameters {
240 ValueType gapThreshold;
241 ValueType observationThreshold;
242 uint64_t sizeThreshold;
243 ValueType optimalChoiceValueEpsilon;
244 };
245
246 /* Functions */
247
251 PomdpModelType const& pomdp() const;
252
260 void refineReachability(storm::Environment const& env, std::set<uint32_t> const& targetObservations, bool min, std::optional<std::string> rewardModelName,
261 storm::pomdp::modelchecker::POMDPValueBounds<ValueType> const& valueBounds, Result& result);
262
276 bool buildOverApproximation(storm::Environment const& env, std::set<uint32_t> const& targetObservations, bool min, bool computeRewards, bool refine,
277 HeuristicParameters const& heuristicParameters, std::vector<BeliefValueType>& observationResolutionVector,
278 std::shared_ptr<BeliefManagerType>& beliefManager, std::shared_ptr<ExplorerType>& overApproximation);
279
293 bool buildUnderApproximation(storm::Environment const& env, std::set<uint32_t> const& targetObservations, bool min, bool computeRewards, bool refine,
294 HeuristicParameters const& heuristicParameters, std::shared_ptr<BeliefManagerType>& beliefManager,
295 std::shared_ptr<ExplorerType>& underApproximation, bool interactive);
296
306 void clipToGrid(uint64_t clippingStateId, bool computeRewards, bool min, std::shared_ptr<BeliefManagerType>& beliefManager,
307 std::shared_ptr<ExplorerType>& beliefExplorer);
308
318 bool clipToGridExplicitly(uint64_t clippingStateId, bool computeRewards, std::shared_ptr<BeliefManagerType>& beliefManager,
319 std::shared_ptr<ExplorerType>& beliefExplorer, uint64_t localActionIndex);
320
325 BeliefValueType rateObservation(typename ExplorerType::SuccessorObservationInformation const& info, BeliefValueType const& observationResolution,
326 BeliefValueType const& maxResolution);
327
334 std::vector<BeliefValueType> getObservationRatings(std::shared_ptr<ExplorerType> const& overApproximation,
335 std::vector<BeliefValueType> const& observationResolutionVector);
336
343 typename PomdpModelType::ValueType getGap(typename PomdpModelType::ValueType const& l, typename PomdpModelType::ValueType const& u);
344
349 void setUnfoldingControl(UnfoldingControl newUnfoldingControl);
350
351 /* Variables */
352
353 Statistics statistics;
354 Options options;
355
356 std::shared_ptr<PomdpModelType> inputPomdp;
357 std::shared_ptr<PomdpModelType> preprocessedPomdp;
358
361
363
364 std::shared_ptr<ExplorerType> interactiveUnderApproximationExplorer;
365
366 Status unfoldingStatus;
367 UnfoldingControl unfoldingControl;
368 Result interactiveResult = Result(-storm::utility::infinity<ValueType>(), storm::utility::infinity<ValueType>());
369};
370
371} // namespace modelchecker
372} // namespace pomdp
373} // namespace storm
This class represents a partially observable Markov decision process.
Definition Pomdp.h:15
Model checker for checking reachability queries on POMDPs using approximations based on exploration o...
int64_t getStatus()
Get the current status of the interactive unfolding.
storm::builder::BeliefMdpExplorer< PomdpModelType, BeliefValueType > ExplorerType
bool hasConverged()
Indicates whether the interactive unfolding has coonverged, i.e.
storm::storage::BeliefManager< PomdpModelType, BeliefValueType > BeliefManagerType
bool isExploring()
Indicates whether the interactive unfolding is currently in the process of exploring the belief MDP.
std::shared_ptr< ExplorerType > getInteractiveBeliefExplorer()
Get a pointer to the belief explorer used in the interactive unfolding.
void setFMSchedValueList(std::vector< std::vector< std::unordered_map< uint64_t, ValueType > > > valueList)
void unfoldInteractively(storm::Environment const &env, std::set< uint32_t > const &targetObservations, bool min, std::optional< std::string > rewardModelName, storm::pomdp::modelchecker::POMDPValueBounds< ValueType > const &valueBounds, Result &result)
Allows to generate an under-approximation using a controllable unfolding.
bool isResultReady()
Indicates whether there is a result after an interactive unfolding was paused.
Result check(storm::Environment const &env, storm::logic::Formula const &formula, storm::Environment const &preProcEnv, std::vector< std::vector< std::unordered_map< uint64_t, ValueType > > > const &additionalUnderApproximationBounds=std::vector< std::vector< std::unordered_map< uint64_t, ValueType > > >())
Performs model checking of the given POMDP with regards to a formula using the previously specified o...
Result getInteractiveResult()
Get the latest saved result obtained by the interactive unfolding.
void printStatisticsToStream(std::ostream &stream) const
Prints statistics of the process to a given output stream.
void precomputeValueBounds(const logic::Formula &formula, storm::Environment const &preProcEnv)
Uses model checking on the underlying MDP to generate values used for cut-offs and for clipping compe...
void continueUnfolding()
Continues a previously paused interactive unfolding.
A class that provides convenience operations to display run times.
Definition Stopwatch.h:14
LabParser.cpp.
Definition cli.cpp:18
std::shared_ptr< storm::models::sparse::Model< ValueType > > schedulerAsMarkovChain
Structure for storing values on the POMDP used for cut-offs and clipping.
std::vector< std::vector< std::unordered_map< uint64_t, ValueType > > > fmSchedulerValueList
storm::pomdp::storage::ExtremePOMDPValueBound< ValueType > extremePomdpValueBound
storm::pomdp::storage::PreprocessingPomdpValueBounds< ValueType > trivialPomdpValueBounds
Struct to store the extreme bound values needed for the reward correction values when clipping is use...
Struct for storing precomputed values bounding the actual values on the POMDP.