Storm 1.11.1.1
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
StandardPcaaWeightVectorChecker.h
Go to the documentation of this file.
1#pragma once
2
16
17namespace storm {
18namespace modelchecker {
19namespace multiobjective {
20
27template<class SparseModelType>
29 public:
30 typedef typename SparseModelType::ValueType ValueType;
32 typename std::conditional<std::is_same<SparseModelType, storm::models::sparse::MarkovAutomaton<ValueType>>::value,
35
36 /*
37 * Creates a weight vextor checker.
38 *
39 * @param model The (preprocessed) model
40 * @param objectives The (preprocessed) objectives
41 * @param possibleECActions Overapproximation of the actions that are part of an EC
42 * @param possibleBottomStates The states for which it is posible to not collect further reward with prob. 1
43 *
44 */
46
52 virtual void check(Environment const& env, std::vector<ValueType> weightVector) override;
53
54 virtual std::vector<ValueType> getAchievablePoint() const override;
55 ValueType getOptimalWeightedSum() const override;
56
63
64 protected:
66 virtual void initializeModelTypeSpecificData(SparseModelType const& model) = 0;
68 storm::storage::SparseMatrix<ValueType> const& transitions) const = 0;
70
71 void infiniteHorizonWeightedPhase(Environment const& env, std::vector<ValueType> const& weightedActionRewardVector,
72 boost::optional<std::vector<ValueType>> const& weightedStateRewardVector, std::vector<ValueType> const& weightVector);
73
79 void unboundedWeightedPhase(Environment const& env, std::vector<ValueType> const& weightedRewardVector, std::vector<ValueType> const& weightVector);
80
85 void unboundedIndividualPhase(Environment const& env, std::vector<ValueType> const& weightVector);
86
91
96
106 virtual void boundedPhase(Environment const& env, std::vector<ValueType> const& weightVector, std::vector<ValueType>& weightedRewardVector) = 0;
107
108 void updateEcQuotient(std::vector<ValueType> const& weightedRewardVector);
109
110 void setBoundsToSolver(storm::solver::AbstractEquationSolver<ValueType>& solver, bool requiresLower, bool requiresUpper, uint64_t objIndex,
111 storm::storage::SparseMatrix<ValueType> const& transitions, storm::storage::BitVector const& rowsWithSumLessOne,
112 std::vector<ValueType> const& rewards) const;
113 void setBoundsToSolver(storm::solver::AbstractEquationSolver<ValueType>& solver, bool requiresLower, bool requiresUpper,
114 std::vector<ValueType> const& weightVector, storm::storage::BitVector const& objectiveFilter,
115 storm::storage::SparseMatrix<ValueType> const& transitions, storm::storage::BitVector const& rowsWithSumLessOne,
116 std::vector<ValueType> const& rewards) const;
117 void computeAndSetBoundsToSolver(storm::solver::AbstractEquationSolver<ValueType>& solver, bool requiresLower, bool requiresUpper,
118 storm::storage::SparseMatrix<ValueType> const& transitions, storm::storage::BitVector const& rowsWithSumLessOne,
119 std::vector<ValueType> const& rewards) const;
120
124 void transformEcqSolutionToOriginalModel(std::vector<ValueType> const& ecqSolution, std::vector<uint_fast64_t> const& ecqOptimalChoices,
125 std::map<uint64_t, uint64_t> const& ecqStateToOptimalMecMap, std::vector<ValueType>& originalSolution,
126 std::vector<uint_fast64_t>& originalOptimalChoices) const;
127
128 // Data regarding the given model
129 // The transition matrix of the considered model
131 // The initial state of the considered model
132 uint64_t initialState;
133 // Overapproximation of the set of choices that are part of an end component.
135 // The actions that have reward assigned for at least one objective without upper timeBound
137 // The states for which there is a scheduler yielding reward 0 for each total reward objective
139 // stores the state action rewards for each objective.
140 std::vector<std::vector<ValueType>> actionRewards;
141 // stores the state rewards for each objective.
142 // These are only relevant for LRA objectives for MAs (otherwise, they appear within the action rewards). For other objectives/models, the corresponding
143 // vector will be empty.
144 std::vector<std::vector<ValueType>> stateRewards;
145
146 // stores the indices of the objectives for which we need to compute the long run average values
148 // stores the indices of the objectives for which there is no upper time bound
150
151 // Memory for the solution of the most recent call of check(..)
152 // becomes true after the first call of check(..)
154 // The result for the weighted reward vector (for all states of the model)
155 std::vector<ValueType> weightedResult;
156 // The results for the individual objectives (w.r.t. all states of the model)
157 std::vector<std::vector<ValueType>> objectiveResults;
158 // Stores for each objective the offset between the computed result (w.r.t. the initial state) and a known achievable value (handling approximation errors)
159 std::vector<ValueType> offsetsToAchievablePoint;
160 // Stores an offset that is added to the weighted sum in order to obtain a sound upper bound (handling approximation errors)
162 // The scheduler choices that optimize the weighted rewards of undounded objectives.
163 std::vector<uint64_t> optimalChoices;
164
165 struct EcQuotient {
167 std::vector<uint_fast64_t> ecqToOriginalChoiceMapping;
168 std::vector<uint_fast64_t> originalToEcqStateMapping;
169 std::vector<storm::storage::FlatSetStateContainer> ecqToOriginalStateMapping;
171 storm::storage::BitVector origReward0Choices; // includes total and LRA rewards
172 storm::storage::BitVector origTotalReward0Choices; // considers just total rewards
174
175 std::vector<ValueType> auxStateValues;
176 std::vector<ValueType> auxChoiceValues;
177 };
178 boost::optional<EcQuotient> ecQuotient;
179
180 // Merge results
183
188 boost::optional<LraMecDecomposition> lraMecDecomposition;
189};
190
191} // namespace multiobjective
192} // namespace modelchecker
193} // namespace storm
Helper class for model checking queries that depend on the long run behavior of the (nondeterministic...
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 ...
ValueType getOptimalWeightedSum() const override
Retrieves the optimal weighted sum of the objective values (or an upper bound thereof).
void unboundedWeightedPhase(Environment const &env, std::vector< ValueType > const &weightedRewardVector, std::vector< ValueType > const &weightVector)
Determines the scheduler that optimizes the weighted reward vector of the unbounded objectives.
virtual void boundedPhase(Environment const &env, std::vector< ValueType > const &weightVector, std::vector< ValueType > &weightedRewardVector)=0
For each time epoch (starting with the maximal stepBound occurring in the objectives),...
virtual storm::modelchecker::helper::SparseNondeterministicInfiniteHorizonHelper< ValueType > createNondetInfiniteHorizonHelper(storm::storage::SparseMatrix< ValueType > const &transitions) const =0
void computeAndSetBoundsToSolver(storm::solver::AbstractEquationSolver< ValueType > &solver, bool requiresLower, bool requiresUpper, storm::storage::SparseMatrix< ValueType > const &transitions, storm::storage::BitVector const &rowsWithSumLessOne, std::vector< ValueType > const &rewards) const
virtual DeterministicInfiniteHorizonHelperType createDetInfiniteHorizonHelper(storm::storage::SparseMatrix< ValueType > const &transitions) const =0
virtual std::vector< ValueType > getAchievablePoint() const override
Retrieves the result of the individual objectives at the initial state of the given model.
void infiniteHorizonWeightedPhase(Environment const &env, std::vector< ValueType > const &weightedActionRewardVector, boost::optional< std::vector< ValueType > > const &weightedStateRewardVector, std::vector< ValueType > const &weightVector)
virtual void check(Environment const &env, std::vector< ValueType > weightVector) override
void transformEcqSolutionToOriginalModel(std::vector< ValueType > const &ecqSolution, std::vector< uint_fast64_t > const &ecqOptimalChoices, std::map< uint64_t, uint64_t > const &ecqStateToOptimalMecMap, std::vector< ValueType > &originalSolution, std::vector< uint_fast64_t > &originalOptimalChoices) const
Transforms the results of a min-max-solver that considers a reduced model (without end components) to...
typename std::conditional< std::is_same< SparseModelType, storm::models::sparse::MarkovAutomaton< ValueType > >::value, storm::modelchecker::helper::SparseNondeterministicInfiniteHorizonHelper< ValueType >, storm::modelchecker::helper::SparseDeterministicInfiniteHorizonHelper< ValueType > >::type DeterministicInfiniteHorizonHelperType
virtual void initializeModelTypeSpecificData(SparseModelType const &model)=0
virtual storm::storage::Scheduler< ValueType > computeScheduler() const override
Retrieves a scheduler that induces the current values Note that check(..) has to be called before ret...
void updateEcQuotient(std::vector< ValueType > const &weightedRewardVector)
void initialize(preprocessing::SparseMultiObjectivePreprocessorResult< SparseModelType > const &preprocessorResult)
void unboundedIndividualPhase(Environment const &env, std::vector< ValueType > const &weightVector)
Computes the values of the objectives that do not have a stepBound w.r.t.
void setBoundsToSolver(storm::solver::AbstractEquationSolver< ValueType > &solver, bool requiresLower, bool requiresUpper, uint64_t objIndex, storm::storage::SparseMatrix< ValueType > const &transitions, storm::storage::BitVector const &rowsWithSumLessOne, std::vector< ValueType > const &rewards) const
A bit vector that is internally represented as a vector of 64-bit values.
Definition BitVector.h:16
This class represents the decomposition of a nondeterministic model into its maximal end components.
This class defines which action is chosen in a particular state of a non-deterministic model.
Definition Scheduler.h:18
A class that holds a possibly non-square matrix in the compressed row storage format.