34template<
typename ValueType>
37 std::ofstream outfile;
40 if (monSettings.isExportMonotonicitySet()) {
45 STORM_LOG_THROW(regions.size() <= 1, storm::exceptions::InvalidArgumentException,
"Monotonicity analysis only allowed on single region.");
46 if (!monSettings.isMonSolutionSet()) {
48 env, model, formulas, regions, monSettings.getNumberOfSamples(),
50 if (monSettings.isExportMonotonicitySet()) {
51 monotonicityHelper.checkMonotonicityInBuild(outfile, monSettings.isUsePLABoundsSet(), monSettings.getDotOutputFilename());
53 monotonicityHelper.checkMonotonicityInBuild(std::cout, monSettings.isUsePLABoundsSet(), monSettings.getDotOutputFilename());
63 std::function<std::unique_ptr<storm::modelchecker::CheckResult>(std::shared_ptr<storm::logic::Formula const>
const& formula)> verificationCallback;
64 std::function<void(std::unique_ptr<storm::modelchecker::CheckResult>
const&)> postprocessingCallback;
67 verificationCallback = [&](std::shared_ptr<storm::logic::Formula const>
const& formula) {
68 std::unique_ptr<storm::modelchecker::CheckResult> result =
74 auto const checkResult = verificationCallback(property.getRawFormula());
75 auto const result = checkResult->asExplicitQuantitativeCheckResult<ValueType>().getFiniteValueVector();
78 auto states = model->getInitialStates();
79 for (
auto state : states) {
80 valuation += result[state];
87 if (res.first && res.second) {
89 }
else if (res.first) {
91 }
else if (res.second) {
97 if (monSettings.isExportMonotonicitySet()) {
105 if (monSettings.isExportMonotonicitySet()) {
109 monotonicityWatch.
stop();
110 STORM_PRINT(
"\nTotal time for monotonicity checking: " << monotonicityWatch <<
".\n\n");
static std::pair< bool, bool > checkDerivative(ValueType const &derivative, storage::ParameterRegion< ValueType > const ®)
Checks if a derivative >=0 or/and <=0.
void addMonotonicityResult(VariableType var, Monotonicity mon)
Adds a new variable with a given Monotonicity to the map.
std::string toString() const
Constructs a string output of all variables and their corresponding Monotonicity.
Base class for all sparse models.
A class that provides convenience operations to display run times.
void stop()
Stop stopwatch and add measured time to total time.
#define STORM_LOG_THROW(cond, exception, message)
storm::modelchecker::CheckTask< storm::logic::Formula, ValueType > createTask(std::shared_ptr< const storm::logic::Formula > const &formula, bool onlyInitialStatesRelevant=false)
std::vector< std::shared_ptr< storm::logic::Formula const > > extractFormulasFromProperties(std::vector< storm::jani::Property > const &properties)
std::unique_ptr< storm::modelchecker::CheckResult > verifyWithSparseEngine(storm::Environment const &env, std::shared_ptr< storm::models::sparse::Dtmc< ValueType > > const &dtmc, storm::modelchecker::CheckTask< storm::logic::Formula, ValueType > const &task, bool preferEliminationChecker=false)
bool preferEliminationChecker()
Returns whether the settings request to prefer the dedicated elimination model checker.
void closeFile(std::ofstream &stream)
Close the given file after writing.
void openFile(std::string const &filepath, std::ofstream &filestream, bool append=false, bool silent=false)
Open the given file for writing.
std::set< storm::RationalFunctionVariable > getProbabilityParameters(Model< storm::RationalFunction > const &model)
Get all probability parameters occurring on transitions.
void analyzeMonotonicity(storm::Environment const &env, std::shared_ptr< storm::models::sparse::Model< ValueType > > const &model, cli::SymbolicInput const &input, std::vector< storm::storage::ParameterRegion< ValueType > > const ®ions)
SettingsType const & getModule()
Get module.
#define STORM_PRINT(message)
Define the macros that print information to stdout and optionally also log it.