Storm
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
ValidatingSparseParameterLiftingModelChecker.cpp
Go to the documentation of this file.
2
9
10namespace storm {
11namespace modelchecker {
12
13template<typename SparseModelType, typename ImpreciseType, typename PreciseType>
18
19template<typename SparseModelType, typename ImpreciseType, typename PreciseType>
22 STORM_PRINT_AND_LOG("Validating Parameter Lifting Model Checker detected " << numOfWrongRegions << " regions where the imprecise method was wrong.\n");
23 }
24}
25
26template<typename SparseModelType, typename ImpreciseType, typename PreciseType>
28 std::shared_ptr<storm::models::ModelBase> parametricModel, CheckTask<storm::logic::Formula, typename SparseModelType::ValueType> const& checkTask) const {
29 return getImpreciseChecker().canHandle(parametricModel, checkTask) && getPreciseChecker().canHandle(parametricModel, checkTask);
30}
31
32template<typename SparseModelType, typename ImpreciseType, typename PreciseType>
35 RegionResult const& initialResult, bool sampleVerticesOfRegion,
37 localMonotonicityResult) {
38 RegionResult currentResult = getImpreciseChecker().analyzeRegion(env, region, hypothesis, initialResult, false);
39
40 if (currentResult == RegionResult::AllSat || currentResult == RegionResult::AllViolated) {
41 applyHintsToPreciseChecker();
42
43 storm::solver::OptimizationDirection parameterOptDir = getPreciseChecker().getCurrentCheckTask().getOptimizationDirection();
44 if (currentResult == RegionResult::AllViolated) {
45 parameterOptDir = storm::solver::invert(parameterOptDir);
46 }
47
48 bool preciseResult = getPreciseChecker()
49 .check(env, region, parameterOptDir)
50 ->asExplicitQualitativeCheckResult()[*getPreciseChecker().getConsideredParametricModel().getInitialStates().begin()];
51 bool preciseResultAgrees = preciseResult == (currentResult == RegionResult::AllSat);
52
53 if (!preciseResultAgrees) {
54 // Imprecise result is wrong!
55 currentResult = RegionResult::Unknown;
56 ++numOfWrongRegions;
57
58 // Check the other direction in case no hypothesis was given
59 if (hypothesis == RegionResultHypothesis::Unknown) {
60 parameterOptDir = storm::solver::invert(parameterOptDir);
61 preciseResult = getPreciseChecker()
62 .check(env, region, parameterOptDir)
63 ->asExplicitQualitativeCheckResult()[*getPreciseChecker().getConsideredParametricModel().getInitialStates().begin()];
64 if (preciseResult && parameterOptDir == getPreciseChecker().getCurrentCheckTask().getOptimizationDirection()) {
65 currentResult = RegionResult::AllSat;
66 } else if (!preciseResult && parameterOptDir == storm::solver::invert(getPreciseChecker().getCurrentCheckTask().getOptimizationDirection())) {
67 currentResult = RegionResult::AllViolated;
68 }
69 }
70 }
71 }
72
73 if (sampleVerticesOfRegion && currentResult != RegionResult::AllSat && currentResult != RegionResult::AllViolated) {
74 currentResult = getPreciseChecker().sampleVertices(env, region, currentResult);
75 }
76
77 return currentResult;
78}
79
82
83} // namespace modelchecker
84} // namespace storm
storm::storage::ParameterRegion< ParametricType >::VariableType VariableType
virtual RegionResult analyzeRegion(Environment const &env, storm::storage::ParameterRegion< typename SparseModelType::ValueType > const &region, RegionResultHypothesis const &hypothesis=RegionResultHypothesis::Unknown, RegionResult const &initialResult=RegionResult::Unknown, bool sampleVerticesOfRegion=false, std::shared_ptr< storm::analysis::LocalMonotonicityResult< typename RegionModelChecker< typename SparseModelType::ValueType >::VariableType > > localMonotonicityResult=nullptr) override
Analyzes the given region by means of parameter lifting.
virtual bool canHandle(std::shared_ptr< storm::models::ModelBase > parametricModel, CheckTask< storm::logic::Formula, typename SparseModelType::ValueType > const &checkTask) const override
#define STORM_PRINT_AND_LOG(message)
Definition macros.h:68
RegionResult
The results for a single Parameter Region.
@ AllSat
the formula is satisfied for all parameters in the given region
@ AllViolated
the formula is violated for all parameters in the given region
@ Unknown
the result is unknown
RegionResultHypothesis
hypothesis for the result for a single Parameter Region
SettingsType const & getModule()
Get module.
OptimizationDirection constexpr invert(OptimizationDirection d)
LabParser.cpp.
Definition cli.cpp:18