Storm 1.11.1.1
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
RegionModelChecker.cpp
Go to the documentation of this file.
1#include <vector>
2
8
9namespace storm::modelchecker {
10
11template<typename ParametricType>
13 RegionResultHypothesis const& hypothesis, bool sampleVerticesOfRegion) {
14 AnnotatedRegion<ParametricType> annotatedRegion{region};
15 monotonicityBackend->initializeMonotonicity(env, annotatedRegion);
16 return analyzeRegion(env, annotatedRegion, hypothesis, sampleVerticesOfRegion);
17}
18
19template<typename ParametricType>
22 AnnotatedRegion<ParametricType> annotatedRegion{region};
23 monotonicityBackend->initializeMonotonicity(env, annotatedRegion);
24 return getBoundAtInitState(env, annotatedRegion, dirForParameters);
25}
26
27template<typename ParametricType>
28std::unique_ptr<storm::modelchecker::RegionCheckResult<ParametricType>> RegionModelChecker<ParametricType>::analyzeRegions(
29 Environment const& env, std::vector<storm::storage::ParameterRegion<ParametricType>> const& regions, std::vector<RegionResultHypothesis> const& hypotheses,
30 bool sampleVerticesOfRegion) {
31 STORM_LOG_THROW(regions.size() == hypotheses.size(), storm::exceptions::InvalidArgumentException,
32 "The number of regions and the number of hypotheses do not match");
33 std::vector<std::pair<storm::storage::ParameterRegion<ParametricType>, storm::modelchecker::RegionResult>> result;
34 auto hypothesisIt = hypotheses.begin();
35 for (auto const& region : regions) {
36 storm::modelchecker::RegionResult regionRes = analyzeRegion(env, region, *hypothesisIt, sampleVerticesOfRegion);
37 result.emplace_back(region, regionRes);
38 ++hypothesisIt;
39 }
40 return std::make_unique<storm::modelchecker::RegionCheckResult<ParametricType>>(std::move(result));
41}
42
43template<typename ParametricType>
47
48template<typename ParametricType>
53
54template<typename ParametricType>
56 return specifiedRegionSplitEstimateKind;
57}
58
59template<typename ParametricType>
60std::vector<typename RegionModelChecker<ParametricType>::CoefficientType> RegionModelChecker<ParametricType>::obtainRegionSplitEstimates(
61 std::set<VariableType> const& relevantParameters) const {
62 STORM_LOG_ASSERT(specifiedRegionSplitEstimateKind.has_value(), "Unable to obtain region split estimates because they wre not requested.");
63 STORM_LOG_ASSERT(specifiedRegionSplitEstimateKind.value() == RegionSplitEstimateKind::Distance, "requested region split estimate kind not supported");
64 STORM_LOG_ASSERT(lastCheckedRegion.has_value(), "Unable to obtain region split estimates because no region was checked.");
65 std::vector<CoefficientType> result;
66 result.reserve(relevantParameters.size());
67 for (auto const& p : relevantParameters) {
68 result.push_back(lastCheckedRegion->getDifference(p));
69 }
70 return result;
71}
72
73template<typename ParametricType>
74void RegionModelChecker<ParametricType>::specifySplitEstimates(std::optional<RegionSplitEstimateKind> splitEstimates,
75 [[maybe_unused]] CheckTask<storm::logic::Formula, ParametricType> const& checkTask) {
76 STORM_LOG_ASSERT(!splitEstimates.has_value() || isRegionSplitEstimateKindSupported(splitEstimates.value(), checkTask),
77 "specified region split estimate kind not supported");
78 specifiedRegionSplitEstimateKind = splitEstimates;
79}
80
81template<typename ParametricType>
84 if (backend) {
85 STORM_LOG_ASSERT(isMonotonicitySupported(*backend, checkTask), "specified monotonicity backend not supported");
86 monotonicityBackend = backend;
87 } else {
88 monotonicityBackend = std::make_shared<MonotonicityBackend<ParametricType>>();
89 }
90}
91
93} // 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