Storm 1.11.1.1
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
RegionCheckResult.cpp
Go to the documentation of this file.
2
3#include <map>
4
8
9namespace storm {
10namespace modelchecker {
11
12template<typename ValueType>
14 std::vector<std::pair<storm::storage::ParameterRegion<ValueType>, storm::modelchecker::RegionResult>> const& regionResults)
15 : regionResults(regionResults) {
16 auto overallArea = storm::utility::zero<typename storm::storage::ParameterRegion<ValueType>::CoefficientType>();
17 for (auto const& res : this->regionResults) {
18 overallArea += res.first.area();
19 }
20 initFractions(overallArea);
21}
22
23template<typename ValueType>
26 : regionResults(std::move(regionResults)) {
27 auto overallArea = storm::utility::zero<typename storm::storage::ParameterRegion<ValueType>::CoefficientType>();
28 for (auto const& res : this->regionResults) {
29 overallArea += res.first.area();
30 }
31 initFractions(overallArea);
32}
33
34template<typename ValueType>
35std::unique_ptr<CheckResult> RegionCheckResult<ValueType>::clone() const {
36 return std::make_unique<RegionCheckResult<ValueType>>(this->regionResults);
37}
38
39template<typename ValueType>
41 return true;
42}
43
44template<typename ValueType>
48
49template<typename ValueType>
50std::vector<std::pair<storm::storage::ParameterRegion<ValueType>, storm::modelchecker::RegionResult>> const& RegionCheckResult<ValueType>::getRegionResults()
51 const {
52 return regionResults;
53}
54
55template<typename ValueType>
59
60template<typename ValueType>
64
65template<typename ValueType>
69
70template<typename ValueType>
71std::ostream& RegionCheckResult<ValueType>::writeToStream(std::ostream& out) const {
72 writeCondensedToStream(out);
73 out << "\nRegion results: \n";
74 for (auto const& res : this->regionResults) {
75 out << res.first.toString() << ": \t" << res.second << '\n';
76 }
77 return out;
78}
79
80template<typename ValueType>
81std::ostream& RegionCheckResult<ValueType>::writeCondensedToStream(std::ostream& out) const {
82 double satPercent = storm::utility::convertNumber<double>(satFraction) * 100.0;
83 double unsatPercent = storm::utility::convertNumber<double>(unsatFraction) * 100.0;
84 double illDefinedPercent = storm::utility::convertNumber<double>(illDefinedFraction) * 100.0;
85 auto oneHundred = storm::utility::convertNumber<typename storm::storage::ParameterRegion<ValueType>::CoefficientType>(100.0);
86 auto one = storm::utility::convertNumber<typename storm::storage::ParameterRegion<ValueType>::CoefficientType>(1.0);
87 out << " Fraction of satisfied area: " << satPercent << "%\n";
88 out << "Fraction of unsatisfied area: " << unsatPercent << "%\n";
89 if (illDefinedPercent > 0) {
90 out << "Fraction of ill-defined area: " << illDefinedPercent << "%\n";
91 }
92 out << " Unknown fraction: " << (100.0 - satPercent - unsatPercent - illDefinedPercent) << "%\n";
93 out << " Total number of regions: " << regionResults.size() << '\n';
94 std::map<storm::modelchecker::RegionResult, uint_fast64_t> counters;
95 for (auto const& res : this->regionResults) {
96 ++counters[res.second];
97 }
98 for (auto const& counter : counters) {
99 out << std::setw(28) << counter.first << ": " << counter.second << '\n';
100 }
101 return out;
102}
103
104template<typename ValueType>
105std::ostream& RegionCheckResult<ValueType>::writeIllustrationToStream(std::ostream& out) const {
106 STORM_LOG_WARN("Writing illustration of region check result to a stream is not implemented.");
107 return out;
108}
109
110template<typename ValueType>
112 auto satArea = storm::utility::zero<typename storm::storage::ParameterRegion<ValueType>::CoefficientType>();
113 auto unsatArea = storm::utility::zero<typename storm::storage::ParameterRegion<ValueType>::CoefficientType>();
114 auto illDefinedArea = storm::utility::zero<typename storm::storage::ParameterRegion<ValueType>::CoefficientType>();
115 for (auto const& res : this->regionResults) {
117 satArea += res.first.area();
118 } else if (res.second == storm::modelchecker::RegionResult::AllViolated) {
119 unsatArea += res.first.area();
120 } else if (res.second == storm::modelchecker::RegionResult::AllIllDefined) {
121 illDefinedArea += res.first.area();
122 }
123 }
124 satFraction = satArea / overallArea;
125 unsatFraction = unsatArea / overallArea;
126 illDefinedFraction = illDefinedArea / overallArea;
127}
128
129template<typename ValueType>
131 // Filtering has no effect as we only store the result w.r.t. a single state anyway.
132 // Hence, this is intentionally left empty.
133}
134
135#ifdef STORM_HAVE_CARL
137#endif
138} // namespace modelchecker
139} // namespace storm
storm::storage::ParameterRegion< ValueType >::CoefficientType const & getIllDefinedFraction() const
virtual std::ostream & writeCondensedToStream(std::ostream &out) const
virtual void initFractions(typename storm::storage::ParameterRegion< ValueType >::CoefficientType const &overallArea)
virtual std::ostream & writeIllustrationToStream(std::ostream &out) const
virtual std::ostream & writeToStream(std::ostream &out) const override
std::vector< std::pair< storm::storage::ParameterRegion< ValueType >, storm::modelchecker::RegionResult > > const & getRegionResults() const
storm::storage::ParameterRegion< ValueType >::CoefficientType const & getSatFraction() const
storm::storage::ParameterRegion< ValueType >::CoefficientType const & getUnsatFraction() const
RegionCheckResult(std::vector< std::pair< storm::storage::ParameterRegion< ValueType >, storm::modelchecker::RegionResult > > const &regionResults)
virtual std::unique_ptr< CheckResult > clone() const override
virtual void filter(QualitativeCheckResult const &filter) override
Filters the current result wrt.
std::vector< std::pair< storm::storage::ParameterRegion< ValueType >, storm::modelchecker::RegionResult > > regionResults
storm::utility::parametric::CoefficientType< ParametricType >::type CoefficientType
#define STORM_LOG_WARN(message)
Definition logging.h:25
RegionResult
The results for a single Parameter Region.
@ AllSat
the formula is satisfied for all well-defined parameters in the given region
@ AllViolated
the formula is violated for all well-defined parameters in the given region
@ AllIllDefined
the formula is ill-defined for all parameters in the given region
LabParser.cpp.