Storm 1.10.0.1
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
SparseMultiObjectivePreprocessorResult.h
Go to the documentation of this file.
1#pragma once
2
3#include <boost/optional.hpp>
4#include <memory>
5#include <vector>
6
12
14
15namespace storm {
16namespace modelchecker {
17namespace multiobjective {
18namespace preprocessing {
19
20template<class SparseModelType>
23
24 // Original data
26 SparseModelType const& originalModel;
27
28 // Mapping of incorporated memory to model+memory
29 std::optional<storm::storage::SparseModelMemoryProductReverseData> memoryIncorporationReverseData;
30
31 // The preprocessed model and objectives
32 std::shared_ptr<SparseModelType> preprocessedModel;
33 std::vector<Objective<typename SparseModelType::ValueType>> objectives;
34
35 // Data about the query
37
38 // Indices of the objectives that can potentially yield infinite reward
40
45
47 uint64_t count = 0;
48 for (auto const& obj : objectives) {
49 if (obj.formula->isRewardOperatorFormula() && obj.formula->getSubformula().isTotalRewardFormula()) {
50 ++count;
51 }
52 }
53 return count;
54 }
55
59
61 uint64_t count = 0;
62 for (auto const& obj : objectives) {
63 if (obj.formula->isRewardOperatorFormula() && obj.formula->getSubformula().isLongRunAverageRewardFormula()) {
64 ++count;
65 }
66 }
67 return count;
68 }
69
73
75 // Trivial objectives are either total reward formulas, LRA reward formulas or single-dimensional step or time bounded cumulative reward formulas
76 for (auto const& obj : objectives) {
77 if (obj.formula->isRewardOperatorFormula() && obj.formula->getSubformula().isTotalRewardFormula()) {
78 continue;
79 }
80 if (obj.formula->isRewardOperatorFormula() && obj.formula->getSubformula().isLongRunAverageRewardFormula()) {
81 continue;
82 }
83 if (obj.formula->isRewardOperatorFormula() && obj.formula->getSubformula().isCumulativeRewardFormula()) {
84 auto const& subf = obj.formula->getSubformula().asCumulativeRewardFormula();
85 if (!subf.isMultiDimensional() && (subf.getTimeBoundReference().isTimeBound() || subf.getTimeBoundReference().isStepBound())) {
86 continue;
87 }
88 }
89 // Reaching this point means that the objective is considered as non-trivial
90 return false;
91 }
92 return true;
93 }
94
95 void printToStream(std::ostream& out) const {
96 out << "\n---------------------------------------------------------------------------------------------------------------------------------------\n";
97 out << " Multi-objective Query \n";
98 out << "---------------------------------------------------------------------------------------------------------------------------------------\n";
99 out << "\nOriginal Formula: \n";
100 out << "--------------------------------------------------------------\n";
101 out << "\t" << originalFormula << '\n';
102 out << "\nThe query considers " << objectives.size() << " objectives:\n";
103 out << "--------------------------------------------------------------\n";
104 for (auto const& obj : objectives) {
105 obj.printToStream(out);
106 out << '\n';
107 }
108 out << "Number of Long-Run-Average Reward Objectives (after preprocessing): " << getNumberOfLongRunAverageRewardFormulas() << ".\n";
109 out << "Number of Total Reward Objectives (after preprocessing): " << getNumberOfTotalRewardFormulas() << ".\n";
110 out << "--------------------------------------------------------------\n";
111 out << "\nOriginal Model Information:\n";
112 originalModel.printModelInformationToStream(out);
113 out << "\nPreprocessed Model Information:\n";
114 preprocessedModel->printModelInformationToStream(out);
115 out << "\n---------------------------------------------------------------------------------------------------------------------------------------\n";
116 }
117
118 friend std::ostream& operator<<(std::ostream& out, SparseMultiObjectivePreprocessorResult<SparseModelType> const& ret) {
119 ret.printToStream(out);
120 return out;
121 }
122};
123} // namespace preprocessing
124} // namespace multiobjective
125} // namespace modelchecker
126} // namespace storm
A bit vector that is internally represented as a vector of 64-bit values.
Definition BitVector.h:16
LabParser.cpp.
std::optional< storm::storage::SparseModelMemoryProductReverseData > memoryIncorporationReverseData
SparseMultiObjectivePreprocessorResult(storm::logic::MultiObjectiveFormula const &originalFormula, SparseModelType const &originalModel)
friend std::ostream & operator<<(std::ostream &out, SparseMultiObjectivePreprocessorResult< SparseModelType > const &ret)