Storm 1.11.1.1
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 virtual ValueType getWeightedPrecisionUnboundedPhase() const override;
39 virtual ValueType getWeightedPrecisionBoundedPhase() const override;
40 virtual bool smallPrecisionsAreChallenging() const override;
41
42 private:
43 /*
44 * Stores (digitized) time bounds in descending order
45 */
46 typedef std::map<uint_fast64_t, storm::storage::BitVector, std::greater<uint_fast64_t>> TimeBoundMap;
47
48 /*
49 * Stores the ingredients of a sub model
50 */
51 struct SubModel {
52 storm::storage::BitVector states; // The states that are part of this sub model
53 storm::storage::BitVector choices; // The choices that are part of this sub model
54
55 storm::storage::SparseMatrix<ValueType> toMS; // Transitions to Markovian states
56 storm::storage::SparseMatrix<ValueType> toPS; // Transitions to probabilistic states
57
58 std::vector<ValueType> weightedRewardVector;
59 std::vector<std::vector<ValueType>> objectiveRewardVectors;
60
61 std::vector<ValueType> weightedSolutionVector;
62 std::vector<std::vector<ValueType>> objectiveSolutionVectors;
63
64 std::vector<ValueType> auxChoiceValues; // stores auxiliary values for every choice
65
66 uint_fast64_t getNumberOfStates() const {
67 return toMS.getRowGroupCount();
68 };
69 uint_fast64_t getNumberOfChoices() const {
70 return toMS.getRowCount();
71 };
72 };
73
74 /*
75 * Stores the data that is relevant to invoke the minMaxSolver and retrieve the result.
76 */
77 struct MinMaxSolverData {
78 std::unique_ptr<Environment> env;
79 std::unique_ptr<storm::solver::MinMaxLinearEquationSolver<ValueType>> solver;
80 std::vector<ValueType> b;
81 };
82
83 struct LinEqSolverData {
84 std::unique_ptr<Environment> env;
85 bool acyclic;
86 std::unique_ptr<storm::solver::LinearEquationSolverFactory<ValueType>> factory;
87 std::unique_ptr<storm::solver::LinearEquationSolver<ValueType>> solver;
88 std::vector<ValueType> b;
89 };
90
96 virtual void boundedPhase(Environment const& env, std::vector<ValueType> const& weightVector, std::vector<ValueType>& weightedRewardVector) override;
97
103 SubModel createSubModel(bool createMS, std::vector<ValueType> const& weightedRewardVector) const;
104
108 template<typename VT = ValueType, typename std::enable_if<storm::NumberTraits<VT>::SupportsExponential, int>::type = 0>
109 VT getDigitizationConstant(std::vector<ValueType> const& weightVector) const;
110 template<typename VT = ValueType, typename std::enable_if<!storm::NumberTraits<VT>::SupportsExponential, int>::type = 0>
111 VT getDigitizationConstant(std::vector<ValueType> const& weightVector) const;
112
116 template<typename VT = ValueType, typename std::enable_if<storm::NumberTraits<VT>::SupportsExponential, int>::type = 0>
117 void digitize(SubModel& subModel, VT const& digitizationConstant) const;
118 template<typename VT = ValueType, typename std::enable_if<!storm::NumberTraits<VT>::SupportsExponential, int>::type = 0>
119 void digitize(SubModel& subModel, VT const& digitizationConstant) const;
120
125 void digitizeTimeBounds(TimeBoundMap& upperTimeBounds, ValueType const& digitizationConstant, std::vector<ValueType> const& weightVector);
126
130 std::unique_ptr<MinMaxSolverData> initMinMaxSolver(Environment const& env, SubModel const& PS, bool acyclic,
131 std::vector<ValueType> const& weightVector) const;
132
136 template<typename VT = ValueType, typename std::enable_if<storm::NumberTraits<VT>::SupportsExponential, int>::type = 0>
137 std::unique_ptr<LinEqSolverData> initLinEqSolver(Environment const& env, SubModel const& PS, bool acyclic) const;
138 template<typename VT = ValueType, typename std::enable_if<!storm::NumberTraits<VT>::SupportsExponential, int>::type = 0>
139 std::unique_ptr<LinEqSolverData> initLinEqSolver(Environment const& env, SubModel const& PS, bool acyclic) const;
140
141 /*
142 * Updates the reward vectors within the split model,
143 * the reward vector of the reduced PStoPS model, and
144 * objectives that are considered at the current time epoch.
145 */
146 void updateDataToCurrentEpoch(SubModel& MS, SubModel& PS, MinMaxSolverData& minMax, storm::storage::BitVector& consideredObjectives,
147 uint_fast64_t const& currentEpoch, std::vector<ValueType> const& weightVector, TimeBoundMap::iterator& upperTimeBoundIt,
148 TimeBoundMap const& upperTimeBounds);
149
150 /*
151 * Performs a step for the probabilistic states, that is
152 * * Compute an optimal scheduler for the weighted reward sum
153 * * Compute the values for the individual objectives w.r.t. that scheduler
154 *
155 * The resulting values represent the rewards at probabilistic states that are obtained at the current time epoch.
156 */
157 void performPSStep(Environment const& env, SubModel& PS, SubModel const& MS, MinMaxSolverData& minMax, LinEqSolverData& linEq,
158 std::vector<uint_fast64_t>& optimalChoicesAtCurrentEpoch, storm::storage::BitVector const& consideredObjectives,
159 std::vector<ValueType> const& weightVector) const;
160
161 /*
162 * Performs a step for the Markovian states, that is
163 * * Compute values for the weighted reward sum as well as for the individual objectives
164 *
165 * The resulting values represent the rewards at Markovian states that are obtained after one (digitized) time unit has passed.
166 */
167 void performMSStep(Environment const& env, SubModel& MS, SubModel const& PS, storm::storage::BitVector const& consideredObjectives,
168 std::vector<ValueType> const& weightVector) const;
169
170 // Data regarding the given Markov automaton
171 storm::storage::BitVector markovianStates;
172 std::vector<ValueType> exitRates;
173};
174
175} // namespace multiobjective
176} // namespace modelchecker
177} // namespace storm
178
179#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 bool smallPrecisionsAreChallenging() const override
Returns whether achieving precise values (i.e.
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:16
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.