#pragma once #include #include "storm/modelchecker/parametric/RegionCheckResult.h" #include "storm/modelchecker/parametric/SparseInstantiationModelChecker.h" #include "storm/modelchecker/parametric/SparseParameterLiftingModelChecker.h" #include "storm/modelchecker/CheckTask.h" #include "storm/storage/ParameterRegion.h" #include "storm/utility/Stopwatch.h" #include "storm/utility/NumberTraits.h" namespace storm { namespace modelchecker{ namespace parametric{ struct RegionCheckerSettings { RegionCheckerSettings(); bool applyExactValidation; }; template class RegionChecker { static_assert(storm::NumberTraits::IsExact, "Specified type for exact computations is not exact."); public: typedef typename storm::storage::ParameterRegion::CoefficientType CoefficientType; RegionChecker(SparseModelType const& parametricModel); virtual ~RegionChecker() = default; RegionCheckerSettings const& getSettings() const; void setSettings(RegionCheckerSettings const& newSettings); void specifyFormula(CheckTask const& checkTask); /*! * Analyzes the given region by means of parameter lifting. * We first check whether there is one point in the region for which the property is satisfied/violated. * If the given initialResults already indicates that there is such a point, this step is skipped. * Then, we check whether ALL points in the region violate/satisfy the property * */ RegionCheckResult analyzeRegion(storm::storage::ParameterRegion const& region, RegionCheckResult const& initialResult = RegionCheckResult::Unknown, bool sampleVerticesOfRegion = false); /*! * Similar to analyze region but additionaly invokes exact parameter lifting to validate results AllSat or AllViolated */ RegionCheckResult analyzeRegionExactValidation(storm::storage::ParameterRegion const& region, RegionCheckResult const& initialResult = RegionCheckResult::Unknown); /*! * Iteratively refines the region until parameter lifting yields a conclusive result (AllSat or AllViolated). * The refinement stops as soon as the fraction of the area of the subregions with inconclusive result is less then the given threshold */ std::vector, RegionCheckResult>> performRegionRefinement(storm::storage::ParameterRegion const& region, CoefficientType const& threshold); static std::string visualizeResult(std::vector, RegionCheckResult>> const& result, storm::storage::ParameterRegion const& parameterSpace, typename storm::storage::ParameterRegion::VariableType const& x, typename storm::storage::ParameterRegion::VariableType const& y); protected: SparseModelType const& getConsideredParametricModel() const; virtual void initializeUnderlyingCheckers() = 0; virtual void simplifyParametricModel(CheckTask const& checkTask) = 0; virtual void applyHintsToExactChecker() = 0; SparseModelType const& parametricModel; RegionCheckerSettings settings; std::unique_ptr> currentCheckTask; std::shared_ptr currentFormula; std::shared_ptr simplifiedModel; std::unique_ptr> parameterLiftingChecker; std::unique_ptr> exactParameterLiftingChecker; // todo: use template argument instead of rational number //std::unique_ptr> exactParameterLiftingChecker; std::unique_ptr> instantiationChecker; mutable storm::utility::Stopwatch initializationStopwatch, instantiationCheckerStopwatch, parameterLiftingCheckerStopwatch; }; } //namespace parametric } //namespace modelchecker } //namespace storm