From 0e70cfc6170fc93a7fd4bf2dec4cfc90e7ed3172 Mon Sep 17 00:00:00 2001 From: TimQu Date: Wed, 27 Jun 2018 09:45:53 +0200 Subject: [PATCH] added setting to print intermediate results during the computation --- .../MultiObjectiveModelCheckerEnvironment.cpp | 10 ++++++++++ .../MultiObjectiveModelCheckerEnvironment.h | 4 ++++ src/storm/settings/modules/MultiObjectiveSettings.cpp | 6 ++++++ src/storm/settings/modules/MultiObjectiveSettings.h | 7 +++++++ 4 files changed, 27 insertions(+) diff --git a/src/storm/environment/modelchecker/MultiObjectiveModelCheckerEnvironment.cpp b/src/storm/environment/modelchecker/MultiObjectiveModelCheckerEnvironment.cpp index 38ffc9e11..01ef9c0cf 100644 --- a/src/storm/environment/modelchecker/MultiObjectiveModelCheckerEnvironment.cpp +++ b/src/storm/environment/modelchecker/MultiObjectiveModelCheckerEnvironment.cpp @@ -23,6 +23,8 @@ namespace storm { if (multiobjectiveSettings.hasSchedulerRestriction()) { schedulerRestriction = multiobjectiveSettings.getSchedulerRestriction(); } + + printResults = multiobjectiveSettings.isPrintResultsSet(); } MultiObjectiveModelCheckerEnvironment::~MultiObjectiveModelCheckerEnvironment() { @@ -116,4 +118,12 @@ namespace storm { void MultiObjectiveModelCheckerEnvironment::unsetSchedulerRestriction() { schedulerRestriction = boost::none; } + + bool MultiObjectiveModelCheckerEnvironment::isPrintResultsSet() const { + return printResults; + } + + void MultiObjectiveModelCheckerEnvironment::setPrintResults(bool value) { + printResults = value; + } } \ No newline at end of file diff --git a/src/storm/environment/modelchecker/MultiObjectiveModelCheckerEnvironment.h b/src/storm/environment/modelchecker/MultiObjectiveModelCheckerEnvironment.h index 42ce713a8..a04b6c94b 100644 --- a/src/storm/environment/modelchecker/MultiObjectiveModelCheckerEnvironment.h +++ b/src/storm/environment/modelchecker/MultiObjectiveModelCheckerEnvironment.h @@ -42,12 +42,16 @@ namespace storm { void setSchedulerRestriction(storm::storage::SchedulerClass const& value); void unsetSchedulerRestriction(); + bool isPrintResultsSet() const; + void setPrintResults(bool value); + private: storm::modelchecker::multiobjective::MultiObjectiveMethod method; boost::optional plotPathUnderApprox, plotPathOverApprox, plotPathParetoPoints; storm::RationalNumber precision; boost::optional maxSteps; boost::optional schedulerRestriction; + bool printResults; }; } diff --git a/src/storm/settings/modules/MultiObjectiveSettings.cpp b/src/storm/settings/modules/MultiObjectiveSettings.cpp index 00d719f14..e1d780d6b 100644 --- a/src/storm/settings/modules/MultiObjectiveSettings.cpp +++ b/src/storm/settings/modules/MultiObjectiveSettings.cpp @@ -17,6 +17,7 @@ namespace storm { const std::string MultiObjectiveSettings::precisionOptionName = "precision"; const std::string MultiObjectiveSettings::maxStepsOptionName = "maxsteps"; const std::string MultiObjectiveSettings::schedulerRestrictionOptionName = "schedrest"; + const std::string MultiObjectiveSettings::printResultsOptionName = "printres"; MultiObjectiveSettings::MultiObjectiveSettings() : ModuleSettings(moduleName) { std::vector methods = {"pcaa", "constraintbased"}; @@ -31,6 +32,7 @@ namespace storm { this->addOption(storm::settings::OptionBuilder(moduleName, schedulerRestrictionOptionName, false, "Restricts the class of considered schedulers to non-randomized schedulers with the provided memory pattern.") .addArgument(storm::settings::ArgumentBuilder::createStringArgument("memorypattern", "The Pattern of the memory.").addValidatorString(ArgumentValidatorFactory::createMultipleChoiceValidator(memoryPatterns)).build()) .addArgument(storm::settings::ArgumentBuilder::createUnsignedIntegerArgument("memorystates", "The Number of memory states (only if supported by the pattern).").setDefaultValueUnsignedInteger(0).build()).build()); + this->addOption(storm::settings::OptionBuilder(moduleName, printResultsOptionName, true, "Prints intermediate results of the computation to standard output.").build(); } storm::modelchecker::multiobjective::MultiObjectiveMethod MultiObjectiveSettings::getMultiObjectiveMethod() const { @@ -93,6 +95,10 @@ namespace storm { return result; } + bool MultiObjectiveSettings::isPrintResultsSet() const { + return this->getOption(printResultsOptionName).getHasOptionBeenSet(); + } + bool MultiObjectiveSettings::check() const { std::shared_ptr> validator = ArgumentValidatorFactory::createWritableFileValidator(); diff --git a/src/storm/settings/modules/MultiObjectiveSettings.h b/src/storm/settings/modules/MultiObjectiveSettings.h index b2718ca04..265c77e3e 100644 --- a/src/storm/settings/modules/MultiObjectiveSettings.h +++ b/src/storm/settings/modules/MultiObjectiveSettings.h @@ -68,6 +68,12 @@ namespace storm { */ storm::storage::SchedulerClass getSchedulerRestriction() const; + + /*! + * Retrieves whether output of intermediate results is enabled. + */ + bool isPrintResultsSet() const; + /*! * Checks whether the settings are consistent. If they are inconsistent, an exception is thrown. @@ -85,6 +91,7 @@ namespace storm { const static std::string precisionOptionName; const static std::string maxStepsOptionName; const static std::string schedulerRestrictionOptionName; + const static std::string printResultsOptionName; }; } // namespace modules