Storm
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
StandardMaPcaaWeightVectorChecker.h
Go to the documentation of this file.
1#ifndef STORM_MODELCHECKER_MULTIOBJECTIVE_PCAA_SPARSEMAPCAAWEIGHTVECTORCHECKER_H_
2#define STORM_MODELCHECKER_MULTIOBJECTIVE_PCAA_SPARSEMAPCAAWEIGHTVECTORCHECKER_H_
3
4#include <type_traits>
5#include <vector>
6
11
12namespace storm {
13namespace modelchecker {
14namespace multiobjective {
15
22template<class SparseMaModelType>
24 public:
25 typedef typename SparseMaModelType::ValueType ValueType;
26
28
30
31 protected:
32 virtual void initializeModelTypeSpecificData(SparseMaModelType const& model) override;
34 storm::storage::SparseMatrix<ValueType> const& transitions) const override;
36 storm::storage::SparseMatrix<ValueType> const& transitions) const override;
37
38 private:
39 /*
40 * Stores (digitized) time bounds in descending order
41 */
42 typedef std::map<uint_fast64_t, storm::storage::BitVector, std::greater<uint_fast64_t>> TimeBoundMap;
43
44 /*
45 * Stores the ingredients of a sub model
46 */
47 struct SubModel {
48 storm::storage::BitVector states; // The states that are part of this sub model
49 storm::storage::BitVector choices; // The choices that are part of this sub model
50
51 storm::storage::SparseMatrix<ValueType> toMS; // Transitions to Markovian states
52 storm::storage::SparseMatrix<ValueType> toPS; // Transitions to probabilistic states
53
54 std::vector<ValueType> weightedRewardVector;
55 std::vector<std::vector<ValueType>> objectiveRewardVectors;
56
57 std::vector<ValueType> weightedSolutionVector;
58 std::vector<std::vector<ValueType>> objectiveSolutionVectors;
59
60 std::vector<ValueType> auxChoiceValues; // stores auxiliary values for every choice
61
62 uint_fast64_t getNumberOfStates() const {
63 return toMS.getRowGroupCount();
64 };
65 uint_fast64_t getNumberOfChoices() const {
66 return toMS.getRowCount();
67 };
68 };
69
70 /*
71 * Stores the data that is relevant to invoke the minMaxSolver and retrieve the result.
72 */
73 struct MinMaxSolverData {
74 std::unique_ptr<Environment> env;
75 std::unique_ptr<storm::solver::MinMaxLinearEquationSolver<ValueType>> solver;
76 std::vector<ValueType> b;
77 };
78
79 struct LinEqSolverData {
80 std::unique_ptr<Environment> env;
81 bool acyclic;
82 std::unique_ptr<storm::solver::LinearEquationSolverFactory<ValueType>> factory;
83 std::unique_ptr<storm::solver::LinearEquationSolver<ValueType>> solver;
84 std::vector<ValueType> b;
85 };
86
92 virtual void boundedPhase(Environment const& env, std::vector<ValueType> const& weightVector, std::vector<ValueType>& weightedRewardVector) override;
93
99 SubModel createSubModel(bool createMS, std::vector<ValueType> const& weightedRewardVector) const;
100
104 template<typename VT = ValueType, typename std::enable_if<storm::NumberTraits<VT>::SupportsExponential, int>::type = 0>
105 VT getDigitizationConstant(std::vector<ValueType> const& weightVector) const;
106 template<typename VT = ValueType, typename std::enable_if<!storm::NumberTraits<VT>::SupportsExponential, int>::type = 0>
107 VT getDigitizationConstant(std::vector<ValueType> const& weightVector) const;
108
112 template<typename VT = ValueType, typename std::enable_if<storm::NumberTraits<VT>::SupportsExponential, int>::type = 0>
113 void digitize(SubModel& subModel, VT const& digitizationConstant) const;
114 template<typename VT = ValueType, typename std::enable_if<!storm::NumberTraits<VT>::SupportsExponential, int>::type = 0>
115 void digitize(SubModel& subModel, VT const& digitizationConstant) const;
116
117 /*
118 * Fills the given map with the digitized time bounds. Also sets the offsetsToUnderApproximation / offsetsToOverApproximation values
119 * according to the digitization error
120 */
121 template<typename VT = ValueType, typename std::enable_if<storm::NumberTraits<VT>::SupportsExponential, int>::type = 0>
122 void digitizeTimeBounds(TimeBoundMap& upperTimeBounds, VT const& digitizationConstant);
123 template<typename VT = ValueType, typename std::enable_if<!storm::NumberTraits<VT>::SupportsExponential, int>::type = 0>
124 void digitizeTimeBounds(TimeBoundMap& upperTimeBounds, VT const& digitizationConstant);
125
129 std::unique_ptr<MinMaxSolverData> initMinMaxSolver(Environment const& env, SubModel const& PS, bool acyclic,
130 std::vector<ValueType> const& weightVector) const;
131
135 template<typename VT = ValueType, typename std::enable_if<storm::NumberTraits<VT>::SupportsExponential, int>::type = 0>
136 std::unique_ptr<LinEqSolverData> initLinEqSolver(Environment const& env, SubModel const& PS, bool acyclic) const;
137 template<typename VT = ValueType, typename std::enable_if<!storm::NumberTraits<VT>::SupportsExponential, int>::type = 0>
138 std::unique_ptr<LinEqSolverData> initLinEqSolver(Environment const& env, SubModel const& PS, bool acyclic) const;
139
140 /*
141 * Updates the reward vectors within the split model,
142 * the reward vector of the reduced PStoPS model, and
143 * objectives that are considered at the current time epoch.
144 */
145 void updateDataToCurrentEpoch(SubModel& MS, SubModel& PS, MinMaxSolverData& minMax, storm::storage::BitVector& consideredObjectives,
146 uint_fast64_t const& currentEpoch, std::vector<ValueType> const& weightVector, TimeBoundMap::iterator& upperTimeBoundIt,
147 TimeBoundMap const& upperTimeBounds);
148
149 /*
150 * Performs a step for the probabilistic states, that is
151 * * Compute an optimal scheduler for the weighted reward sum
152 * * Compute the values for the individual objectives w.r.t. that scheduler
153 *
154 * The resulting values represent the rewards at probabilistic states that are obtained at the current time epoch.
155 */
156 void performPSStep(Environment const& env, SubModel& PS, SubModel const& MS, MinMaxSolverData& minMax, LinEqSolverData& linEq,
157 std::vector<uint_fast64_t>& optimalChoicesAtCurrentEpoch, storm::storage::BitVector const& consideredObjectives,
158 std::vector<ValueType> const& weightVector) const;
159
160 /*
161 * Performs a step for the Markovian states, that is
162 * * Compute values for the weighted reward sum as well as for the individual objectives
163 *
164 * The resulting values represent the rewards at Markovian states that are obtained after one (digitized) time unit has passed.
165 */
166 void performMSStep(Environment const& env, SubModel& MS, SubModel const& PS, storm::storage::BitVector const& consideredObjectives,
167 std::vector<ValueType> const& weightVector) const;
168
169 // Data regarding the given Markov automaton
170 storm::storage::BitVector markovianStates;
171 std::vector<ValueType> exitRates;
172};
173
174} // namespace multiobjective
175} // namespace modelchecker
176} // namespace storm
177
178#endif /* STORM_MODELCHECKER_MULTIOBJECTIVE_PCAA_SPARSEMAPCAAWEIGHTVECTORCHECKER_H_ */
Helper class for model checking queries that depend on the long run behavior of the (nondeterministic...
Helper Class that takes preprocessed Pcaa data and a weight vector and ...
virtual void initializeModelTypeSpecificData(SparseMaModelType const &model) override
virtual storm::modelchecker::helper::SparseNondeterministicInfiniteHorizonHelper< ValueType > createNondetInfiniteHorizonHelper(storm::storage::SparseMatrix< ValueType > const &transitions) const override
virtual storm::modelchecker::helper::SparseNondeterministicInfiniteHorizonHelper< ValueType > createDetInfiniteHorizonHelper(storm::storage::SparseMatrix< ValueType > const &transitions) const override
Helper Class that takes preprocessed Pcaa data and a weight vector and ...
A bit vector that is internally represented as a vector of 64-bit values.
Definition BitVector.h:18
A class that holds a possibly non-square matrix in the compressed row storage format.
index_type getRowGroupCount() const
Returns the number of row groups in the matrix.
index_type getRowCount() const
Returns the number of rows of the matrix.
LabParser.cpp.
Definition cli.cpp:18