18template<
typename SparseModelType,
typename ImpreciseType,
typename PreciseType>
20 : numOfWrongRegions(0) {
24template<
typename SparseModelType,
typename ImpreciseType,
typename PreciseType>
27 STORM_PRINT_AND_LOG(
"Validating Parameter Lifting Model Checker detected " << numOfWrongRegions <<
" regions where the imprecise method was wrong.\n");
31template<
typename SparseModelType,
typename ImpreciseType,
typename PreciseType>
34 return impreciseChecker.canHandle(parametricModel, checkTask) && preciseChecker.canHandle(parametricModel, checkTask);
37template<
typename SparseModelType,
typename ImpreciseType,
typename PreciseType>
41 bool allowModelSimplifications,
bool graphPreserving) {
43 "Combination of model " << parametricModel->getType() <<
" and formula '" << checkTask.
getFormula() <<
"' is not supported.");
44 STORM_LOG_THROW(graphPreserving, storm::exceptions::NotImplementedException,
"Non-graph-preserving regions not implemented for validating PLA");
48 auto specifyUnderlyingCheckers = [&](
auto pm,
auto const& ct) {
55 if (allowModelSimplifications) {
56 auto dtmcOrMdp = parametricModel->template as<SparseModelType>();
57 if constexpr (IsMDP) {
59 if (!simplifier.simplify(checkTask.
getFormula())) {
60 STORM_LOG_THROW(
false, storm::exceptions::UnexpectedException,
"Simplifying the model was not successfull.");
62 auto simplifiedTask = checkTask.
substituteFormula(*simplifier.getSimplifiedFormula());
63 specifyUnderlyingCheckers(simplifier.getSimplifiedModel(), simplifiedTask);
66 if (!simplifier.simplify(checkTask.
getFormula())) {
67 STORM_LOG_THROW(
false, storm::exceptions::UnexpectedException,
"Simplifying the model was not successfull.");
69 auto simplifiedTask = checkTask.
substituteFormula(*simplifier.getSimplifiedFormula());
70 specifyUnderlyingCheckers(simplifier.getSimplifiedModel(), simplifiedTask);
73 specifyUnderlyingCheckers(parametricModel, checkTask);
77template<
typename SparseModelType,
typename ImpreciseType,
typename PreciseType>
81 bool sampleVerticesOfRegion) {
83 auto impreciseAnnotatedRegion =
region;
84 RegionResult currentResult = impreciseChecker.analyzeRegion(env, impreciseAnnotatedRegion, hypothesis,
false);
87 applyHintsToPreciseChecker();
95 preciseChecker.check(env,
region, parameterOptDir)
96 ->template asExplicitQualitativeCheckResult<PreciseType>()[*preciseChecker.getConsideredParametricModel().getInitialStates().begin()];
99 if (!preciseResultAgrees) {
108 preciseChecker.check(env,
region, parameterOptDir)
109 ->template asExplicitQualitativeCheckResult<PreciseType>()[*preciseChecker.getConsideredParametricModel().getInitialStates().begin()];
110 if (preciseResult && parameterOptDir == preciseChecker.getCurrentCheckTask().getOptimizationDirection()) {
112 }
else if (!preciseResult && parameterOptDir ==
storm::solver::invert(preciseChecker.getCurrentCheckTask().getOptimizationDirection())) {
120 currentResult = preciseChecker.sampleVertices(env,
region.region, currentResult);
123 return currentResult;
126template<
typename SparseModelType,
typename ImpreciseType,
typename PreciseType>
127typename ValidatingSparseParameterLiftingModelChecker<SparseModelType, ImpreciseType, PreciseType>::CoefficientType
130 return preciseChecker.getBoundAtInitState(env,
region, dirForParameters);
133template<
typename SparseModelType,
typename ImpreciseType,
typename PreciseType>
134std::pair<typename ValidatingSparseParameterLiftingModelChecker<SparseModelType, ImpreciseType, PreciseType>::CoefficientType,
135 typename ValidatingSparseParameterLiftingModelChecker<SparseModelType, ImpreciseType, PreciseType>::Valuation>
138 return preciseChecker.getAndEvaluateGoodPoint(env,
region, dirForParameters);
141template<
typename SparseModelType,
typename ImpreciseType,
typename PreciseType>
146 preciseChecker.isMonotonicitySupported(backend, checkTask);
149template<
typename SparseModelType,
typename ImpreciseType,
typename PreciseType>
150void ValidatingSparseParameterLiftingModelChecker<SparseModelType, ImpreciseType, PreciseType>::applyHintsToPreciseChecker() {
151 if (impreciseChecker.getCurrentMaxScheduler()) {
152 preciseChecker.getCurrentMaxScheduler() = impreciseChecker.getCurrentMaxScheduler()->template toValueType<PreciseType>();
154 if (impreciseChecker.getCurrentMinScheduler()) {
155 preciseChecker.getCurrentMinScheduler() = impreciseChecker.getCurrentMinScheduler()->template toValueType<PreciseType>();
157 if constexpr (IsMDP) {
158 if (impreciseChecker.getCurrentPlayer1Scheduler()) {
159 preciseChecker.getCurrentPlayer1Scheduler() = impreciseChecker.getCurrentPlayer1Scheduler()->template toValueType<PreciseType>();
CheckTask< NewFormulaType, ValueType > substituteFormula(NewFormulaType const &newFormula) const
Copies the check task from the source while replacing the formula with the new one.
FormulaType const & getFormula() const
Retrieves the formula from this task.
virtual bool requiresInteractionWithRegionModelChecker() const
Returns true, if a region model checker needs to implement specific methods to properly use this back...
virtual void specifyMonotonicity(std::shared_ptr< MonotonicityBackend< SparseModelType::ValueType > > backend, CheckTask< storm::logic::Formula, SparseModelType::ValueType > const &checkTask)
std::shared_ptr< MonotonicityBackend< SparseModelType::ValueType > > monotonicityBackend
virtual void specifySplitEstimates(std::optional< RegionSplitEstimateKind > splitEstimates, CheckTask< storm::logic::Formula, SparseModelType::ValueType > const &checkTask)
virtual RegionResult analyzeRegion(Environment const &env, AnnotatedRegion< ParametricType > ®ion, RegionResultHypothesis const &hypothesis=RegionResultHypothesis::Unknown, bool sampleVerticesOfRegion=false) override
Analyzes the given region.
virtual CoefficientType getBoundAtInitState(Environment const &env, AnnotatedRegion< ParametricType > ®ion, storm::solver::OptimizationDirection const &dirForParameters) override
Over-approximates the value within the given region.
virtual ~ValidatingSparseParameterLiftingModelChecker()
virtual void specify(Environment const &env, std::shared_ptr< storm::models::ModelBase > parametricModel, CheckTask< storm::logic::Formula, ParametricType > const &checkTask, std::optional< RegionSplitEstimateKind > generateRegionSplitEstimates=std::nullopt, std::shared_ptr< MonotonicityBackend< ParametricType > > monotonicityBackend={}, bool allowModelSimplifications=true, bool graphPreserving=true) override
ValidatingSparseParameterLiftingModelChecker()
virtual bool isMonotonicitySupported(MonotonicityBackend< ParametricType > const &backend, CheckTask< storm::logic::Formula, ParametricType > const &checkTask) const override
Returns whether this region model checker can work together with the given monotonicity backend.
virtual std::pair< CoefficientType, Valuation > getAndEvaluateGoodPoint(Environment const &env, AnnotatedRegion< ParametricType > ®ion, storm::solver::OptimizationDirection const &dirForParameters) override
Heuristically finds a point within the region and computes the value at the initial state for that po...
virtual bool canHandle(std::shared_ptr< storm::models::ModelBase > parametricModel, CheckTask< storm::logic::Formula, typename SparseModelType::ValueType > const &checkTask) const override
#define STORM_LOG_THROW(cond, exception, message)
#define STORM_PRINT_AND_LOG(message)
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
@ 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)