Storm 1.11.1.1
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
RegionModelChecker.cpp
Go to the documentation of this file.
2
3#include <vector>
4
9
10namespace storm::modelchecker {
11
12template<typename ParametricType>
14 RegionResultHypothesis const& hypothesis, bool sampleVerticesOfRegion) {
15 AnnotatedRegion<ParametricType> annotatedRegion{region};
16 monotonicityBackend->initializeMonotonicity(env, annotatedRegion);
17 return analyzeRegion(env, annotatedRegion, hypothesis, sampleVerticesOfRegion);
18}
19
20template<typename ParametricType>
23 AnnotatedRegion<ParametricType> annotatedRegion{region};
24 monotonicityBackend->initializeMonotonicity(env, annotatedRegion);
25 return getBoundAtInitState(env, annotatedRegion, dirForParameters);
26}
27
28template<typename ParametricType>
29std::unique_ptr<storm::modelchecker::RegionCheckResult<ParametricType>> RegionModelChecker<ParametricType>::analyzeRegions(
30 Environment const& env, std::vector<storm::storage::ParameterRegion<ParametricType>> const& regions, std::vector<RegionResultHypothesis> const& hypotheses,
31 bool sampleVerticesOfRegion) {
32 STORM_LOG_THROW(regions.size() == hypotheses.size(), storm::exceptions::InvalidArgumentException,
33 "The number of regions and the number of hypotheses do not match");
34 std::vector<std::pair<storm::storage::ParameterRegion<ParametricType>, storm::modelchecker::RegionResult>> result;
35 auto hypothesisIt = hypotheses.begin();
36 for (auto const& region : regions) {
37 storm::modelchecker::RegionResult regionRes = analyzeRegion(env, region, *hypothesisIt, sampleVerticesOfRegion);
38 result.emplace_back(region, regionRes);
39 ++hypothesisIt;
40 }
41 return std::make_unique<storm::modelchecker::RegionCheckResult<ParametricType>>(std::move(result));
42}
43
44template<typename ParametricType>
48
49template<typename ParametricType>
54
55template<typename ParametricType>
57 return specifiedRegionSplitEstimateKind;
58}
59
60template<typename ParametricType>
61std::vector<typename RegionModelChecker<ParametricType>::CoefficientType> RegionModelChecker<ParametricType>::obtainRegionSplitEstimates(
62 std::set<VariableType> const& relevantParameters) const {
63 STORM_LOG_ASSERT(specifiedRegionSplitEstimateKind.has_value(), "Unable to obtain region split estimates because they wre not requested.");
64 STORM_LOG_ASSERT(specifiedRegionSplitEstimateKind.value() == RegionSplitEstimateKind::Distance, "requested region split estimate kind not supported");
65 STORM_LOG_ASSERT(lastCheckedRegion.has_value(), "Unable to obtain region split estimates because no region was checked.");
66 std::vector<CoefficientType> result;
67 result.reserve(relevantParameters.size());
68 for (auto const& p : relevantParameters) {
69 result.push_back(lastCheckedRegion->getDifference(p));
70 }
71 return result;
72}
74template<typename ParametricType>
75void RegionModelChecker<ParametricType>::specifySplitEstimates(std::optional<RegionSplitEstimateKind> splitEstimates,
76 [[maybe_unused]] CheckTask<storm::logic::Formula, ParametricType> const& checkTask) {
77 STORM_LOG_ASSERT(!splitEstimates.has_value() || isRegionSplitEstimateKindSupported(splitEstimates.value(), checkTask),
78 "specified region split estimate kind not supported");
79 specifiedRegionSplitEstimateKind = splitEstimates;
80}
81
82template<typename ParametricType>
85 if (backend) {
86 STORM_LOG_ASSERT(isMonotonicitySupported(*backend, checkTask), "specified monotonicity backend not supported");
87 monotonicityBackend = backend;
88 } else {
89 monotonicityBackend = std::make_shared<MonotonicityBackend<ParametricType>>();
90 }
91}
92
94} // namespace storm::modelchecker
virtual bool isRegionSplitEstimateKindSupported(RegionSplitEstimateKind kind, CheckTask< storm::logic::Formula, ParametricType > const &checkTask) const
virtual CoefficientType getBoundAtInitState(Environment const &env, AnnotatedRegion< ParametricType > &region, storm::solver::OptimizationDirection const &dirForParameters)=0
Over-approximates the value within the given region.
virtual RegionSplitEstimateKind getDefaultRegionSplitEstimateKind(CheckTask< storm::logic::Formula, ParametricType > const &checkTask) const
virtual void specifyMonotonicity(std::shared_ptr< MonotonicityBackend< ParametricType > > backend, CheckTask< storm::logic::Formula, ParametricType > const &checkTask)
virtual RegionResult analyzeRegion(Environment const &env, AnnotatedRegion< ParametricType > &region, RegionResultHypothesis const &hypothesis=RegionResultHypothesis::Unknown, bool sampleVerticesOfRegion=false)=0
Analyzes the given region.
virtual std::vector< CoefficientType > obtainRegionSplitEstimates(std::set< VariableType > const &relevantParameters) const
Returns an estimate of the benefit of splitting the last checked region with respect to each of the g...
virtual void specifySplitEstimates(std::optional< RegionSplitEstimateKind > splitEstimates, CheckTask< storm::logic::Formula, ParametricType > const &checkTask)
storm::storage::ParameterRegion< ParametricType >::CoefficientType CoefficientType
std::optional< RegionSplitEstimateKind > getSpecifiedRegionSplitEstimateKind() const
std::unique_ptr< storm::modelchecker::RegionCheckResult< ParametricType > > analyzeRegions(Environment const &env, std::vector< storm::storage::ParameterRegion< ParametricType > > const &regions, std::vector< RegionResultHypothesis > const &hypotheses, bool sampleVerticesOfRegion=false)
Analyzes the given regions.
#define STORM_LOG_ASSERT(cond, message)
Definition macros.h:11
#define STORM_LOG_THROW(cond, exception, message)
Definition macros.h:30
RegionResult
The results for a single Parameter Region.
RegionResultHypothesis
hypothesis for the result for a single Parameter Region