Storm 1.11.1.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 return std::any_of(objectives.begin(), objectives.end(), [](Objective<typename SparseModelType::ValueType> const& obj) {
76 if (obj.formula->isRewardOperatorFormula() && obj.formula->getSubformula().isCumulativeRewardFormula()) {
77 auto const& subf = obj.formula->getSubformula().asCumulativeRewardFormula();
78 return subf.isMultiDimensional() || subf.getTimeBoundReference().isRewardBound();
79 } else if (obj.formula->isProbabilityOperatorFormula() && obj.formula->getSubformula().isBoundedUntilFormula()) {
80 auto const& subf = obj.formula->getSubformula().asBoundedUntilFormula();
81 return subf.isMultiDimensional() || subf.getTimeBoundReference().isRewardBound();
82 } else {
83 return false;
84 }
85 });
86 }
87
88 void printToStream(std::ostream& out) const {
89 out << "\n---------------------------------------------------------------------------------------------------------------------------------------\n";
90 out << " Multi-objective Query \n";
91 out << "---------------------------------------------------------------------------------------------------------------------------------------\n";
92 out << "\nOriginal Formula: \n";
93 out << "--------------------------------------------------------------\n";
94 out << "\t" << originalFormula << '\n';
95 out << "\nThe query considers " << objectives.size() << " objectives:\n";
96 out << "--------------------------------------------------------------\n";
97 for (auto const& obj : objectives) {
98 obj.printToStream(out);
99 out << '\n';
100 }
101 out << "Number of Long-Run-Average Reward Objectives (after preprocessing): " << getNumberOfLongRunAverageRewardFormulas() << ".\n";
102 out << "Number of Total Reward Objectives (after preprocessing): " << getNumberOfTotalRewardFormulas() << ".\n";
103 out << "--------------------------------------------------------------\n";
104 out << "\nOriginal Model Information:\n";
105 originalModel.printModelInformationToStream(out);
106 out << "\nPreprocessed Model Information:\n";
107 preprocessedModel->printModelInformationToStream(out);
108 out << "\n---------------------------------------------------------------------------------------------------------------------------------------\n";
109 }
110
111 friend std::ostream& operator<<(std::ostream& out, SparseMultiObjectivePreprocessorResult<SparseModelType> const& ret) {
112 ret.printToStream(out);
113 return out;
114 }
115};
116} // namespace preprocessing
117} // namespace multiobjective
118} // namespace modelchecker
119} // namespace storm
A bit vector that is internally represented as a vector of 64-bit values.
Definition BitVector.h:16
std::shared_ptr< storm::logic::OperatorFormula const > formula
Definition Objective.h:20
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)