Storm 1.13.0.1
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
GenerateMonitorVerifier.h
Go to the documentation of this file.
1#pragma once
2#include <sys/types.h>
3#include <cstdint>
4#include <utility>
8
9namespace storm::generator {
10
11/*
12 * Based on the paper "Learning Verified Monitors for Hidden Markov Models" ATVA25 (https://doi.org/10.1007/978-3-032-08707-2_9)
13 */
14
15/*
16 * Result of GenerateMonitorVerifier.
17 * It contains the product POMDP, where the states are pairs of states of the monitor and the HMM, and the observations are pairs of step number and accepting
18 * label. It also contains a mapping from the observation pairs to the observation number and a mapping from the observation number to the default action for
19 * that observation.
20 */
21template<typename ValueType>
23 public:
24 MonitorVerifier(const storm::models::sparse::Pomdp<ValueType>& product, const std::map<std::pair<uint32_t, bool>, uint32_t>& observationMap,
25 std::map<uint32_t, std::string> observationDefaultAction);
26
27 std::map<std::pair<uint32_t, bool>, uint32_t> const& getObservationMap();
28 const std::map<uint32_t, std::string>& getObservationDefaultAction();
30
31 private:
33 std::map<std::pair<uint32_t, bool>, uint32_t> observationMap;
34 std::map<uint32_t, std::string> observationDefaultAction;
35};
36
37/*
38 * This class generates a product of a HMM and a monitor. The HMM is represented as a DTMC where observations are encoded as labels. Risk values must be
39 * provided via setRisk() before calling createProduct(). The monitor is represented as an MDP where the actions correspond to the observations of the HMM and
40 * the states are labeled with the acceptingLabel. The monitor is unrolled and the steps are labeled with the stepPrefix and then a number. The states at the
41 * horizon after unrolling are labeled with the horizonLabel. Restart semantics decides if states which failed the condition are directed to the initial state
42 * or to a sink state.
43 *
44 */
45template<typename ValueType>
47 public:
48 struct Options {
49 std::string acceptingLabel = "accepting";
50 std::string stepPrefix = "step";
51 std::string horizonLabel = "horizon";
53 };
55 std::shared_ptr<storm::expressions::ExpressionManager>& exprManager, Options const& options);
56 std::shared_ptr<MonitorVerifier<ValueType>> createProduct();
57 void setRisk(std::vector<ValueType> const& risk);
58
59 private:
62 std::vector<ValueType> risk;
63 std::shared_ptr<storm::expressions::ExpressionManager>& exprManager;
66 Options options;
67};
68
69} // namespace storm::generator
std::shared_ptr< MonitorVerifier< ValueType > > createProduct()
void setRisk(std::vector< ValueType > const &risk)
GenerateMonitorVerifier(storm::models::sparse::Dtmc< ValueType > const &mc, storm::models::sparse::Mdp< ValueType > const &monitor, std::shared_ptr< storm::expressions::ExpressionManager > &exprManager, Options const &options)
MonitorVerifier(const storm::models::sparse::Pomdp< ValueType > &product, const std::map< std::pair< uint32_t, bool >, uint32_t > &observationMap, std::map< uint32_t, std::string > observationDefaultAction)
std::map< std::pair< uint32_t, bool >, uint32_t > const & getObservationMap()
const storm::models::sparse::Pomdp< ValueType > & getProduct()
const std::map< uint32_t, std::string > & getObservationDefaultAction()
This class represents a discrete-time Markov chain.
Definition Dtmc.h:13
This class represents a (discrete-time) Markov decision process.
Definition Mdp.h:13
This class represents a partially observable Markov decision process.
Definition Pomdp.h:13