Storm 1.14.0.1
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
StandardMaPcaaWeightVectorChecker.h
Go to the documentation of this file.
1#pragma once
2
3#include <type_traits>
4#include <vector>
5
10
11namespace storm {
12namespace modelchecker {
13namespace multiobjective {
14
21template<class SparseMaModelType>
23 public:
24 typedef typename SparseMaModelType::ValueType ValueType;
25
27
29
30 protected:
31 virtual void initializeModelTypeSpecificData(SparseMaModelType const& model) override;
33 storm::storage::SparseMatrix<ValueType> const& transitions) const override;
35 storm::storage::SparseMatrix<ValueType> const& transitions) const override;
36
37 virtual ValueType getWeightedPrecisionUnboundedPhase() const override;
38 virtual ValueType getWeightedPrecisionBoundedPhase() const override;
39 virtual bool smallPrecisionsAreChallenging() const override;
40
41 private:
42 /*
43 * Stores (digitized) time bounds in descending order
44 */
45 typedef std::map<uint_fast64_t, storm::storage::BitVector, std::greater<uint_fast64_t>> TimeBoundMap;
46
47 /*
48 * Stores the ingredients of a sub model
49 */
50 struct SubModel {
51 storm::storage::BitVector states; // The states that are part of this sub model
52 storm::storage::BitVector choices; // The choices that are part of this sub model
53
54 storm::storage::SparseMatrix<ValueType> toMS; // Transitions to Markovian states
55 storm::storage::SparseMatrix<ValueType> toPS; // Transitions to probabilistic states
56
57 std::vector<ValueType> weightedRewardVector;
58 std::vector<std::vector<ValueType>> objectiveRewardVectors;
59
60 std::vector<ValueType> weightedSolutionVector;
61 std::vector<std::vector<ValueType>> objectiveSolutionVectors;
62
63 std::vector<ValueType> auxChoiceValues; // stores auxiliary values for every choice
64
65 uint_fast64_t getNumberOfStates() const {
66 return toMS.getRowGroupCount();
67 }
68 uint_fast64_t getNumberOfChoices() const {
69 return toMS.getRowCount();
70 }
71 };
72
73 /*
74 * Stores the data that is relevant to invoke the minMaxSolver and retrieve the result.
75 */
76 struct MinMaxSolverData {
77 std::unique_ptr<Environment> env;
78 std::unique_ptr<storm::solver::MinMaxLinearEquationSolver<ValueType>> solver;
79 std::vector<ValueType> b;
80 };
81
82 struct LinEqSolverData {
83 std::unique_ptr<Environment> env;
84 bool acyclic;
85 std::unique_ptr<storm::solver::LinearEquationSolverFactory<ValueType>> factory;
86 std::unique_ptr<storm::solver::LinearEquationSolver<ValueType>> solver;
87 std::vector<ValueType> b;
88 };
89
95 virtual void boundedPhase(Environment const& env, std::vector<ValueType> const& weightVector, std::vector<ValueType>& weightedRewardVector) override;
96
102 SubModel createSubModel(bool createMS, std::vector<ValueType> const& weightedRewardVector) const;
103
107 template<typename VT = ValueType, typename std::enable_if<storm::NumberTraits<VT>::SupportsExponential, int>::type = 0>
108 VT getDigitizationConstant(std::vector<ValueType> const& weightVector) const;
109 template<typename VT = ValueType, typename std::enable_if<!storm::NumberTraits<VT>::SupportsExponential, int>::type = 0>
110 VT getDigitizationConstant(std::vector<ValueType> const& weightVector) const;
111
115 template<typename VT = ValueType, typename std::enable_if<storm::NumberTraits<VT>::SupportsExponential, int>::type = 0>
116 void digitize(SubModel& subModel, VT const& digitizationConstant) const;
117 template<typename VT = ValueType, typename std::enable_if<!storm::NumberTraits<VT>::SupportsExponential, int>::type = 0>
118 void digitize(SubModel& subModel, VT const& digitizationConstant) const;
119
124 void digitizeTimeBounds(TimeBoundMap& upperTimeBounds, ValueType const& digitizationConstant, std::vector<ValueType> const& weightVector);
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
Helper class for model checking queries that depend on the long run behavior of the (nondeterministic...
StandardMaPcaaWeightVectorChecker(preprocessing::SparseMultiObjectivePreprocessorResult< SparseMaModelType > const &preprocessorResult)
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
StandardPcaaWeightVectorChecker(preprocessing::SparseMultiObjectivePreprocessorResult< SparseMaModelType > const &preprocessorResult)
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.