From 1f1b60e6de9a857641100a3856187504504007ca Mon Sep 17 00:00:00 2001 From: dehnert Date: Wed, 1 Oct 2014 12:47:05 +0200 Subject: [PATCH 1/3] Added macros that can be used for printing and warnings. Included Dennis' fix for model checking of Markov automata. Added check methods to the settings modules that check whether the specified options are non-contradictive. Former-commit-id: 18c168795833961d1fd50a8fe4866fc73c6bf984 --- .../SparseMarkovAutomatonCslModelChecker.h | 4 +- src/settings/SettingsManager.cpp | 9 ++++ src/settings/SettingsManager.h | 5 +++ .../CounterexampleGeneratorSettings.cpp | 15 ++++++- .../modules/CounterexampleGeneratorSettings.h | 4 +- src/settings/modules/GeneralSettings.cpp | 12 +++++ src/settings/modules/GeneralSettings.h | 2 + src/settings/modules/GlpkSettings.cpp | 12 +++++ src/settings/modules/GlpkSettings.h | 9 ++++ .../modules/GmmxxEquationSolverSettings.cpp | 32 ++++++++++++++ .../modules/GmmxxEquationSolverSettings.h | 44 +++++++++++++++++++ src/settings/modules/GurobiSettings.cpp | 16 +++++++ src/settings/modules/GurobiSettings.h | 16 +++++++ .../modules/NativeEquationSolverSettings.cpp | 24 ++++++++++ .../modules/NativeEquationSolverSettings.h | 30 +++++++++++++ src/utility/cli.h | 2 +- src/utility/macros.h | 34 ++++++++++++++ 17 files changed, 265 insertions(+), 5 deletions(-) diff --git a/src/modelchecker/csl/SparseMarkovAutomatonCslModelChecker.h b/src/modelchecker/csl/SparseMarkovAutomatonCslModelChecker.h index b927b6203..80ba611aa 100644 --- a/src/modelchecker/csl/SparseMarkovAutomatonCslModelChecker.h +++ b/src/modelchecker/csl/SparseMarkovAutomatonCslModelChecker.h @@ -494,7 +494,7 @@ namespace storm { storm::expressions::Expression constraint = storm::expressions::Expression::createDoubleVariable(stateToVariableNameMap.at(state)); for (auto element : transitionMatrix.getRow(nondeterministicChoiceIndices[state])) { - constraint = constraint - storm::expressions::Expression::createDoubleVariable(stateToVariableNameMap.at(element.getColumn())); + constraint = constraint - storm::expressions::Expression::createDoubleVariable(stateToVariableNameMap.at(element.getColumn())) * storm::expressions::Expression::createDoubleLiteral(element.getValue()); } constraint = constraint + storm::expressions::Expression::createDoubleLiteral(storm::utility::constantOne() / exitRates[state]) * storm::expressions::Expression::createDoubleVariable("k"); @@ -512,7 +512,7 @@ namespace storm { storm::expressions::Expression constraint = storm::expressions::Expression::createDoubleVariable(stateToVariableNameMap.at(state)); for (auto element : transitionMatrix.getRow(choice)) { - constraint = constraint - storm::expressions::Expression::createDoubleVariable(stateToVariableNameMap.at(element.getColumn())); + constraint = constraint - storm::expressions::Expression::createDoubleVariable(stateToVariableNameMap.at(element.getColumn())) * storm::expressions::Expression::createDoubleLiteral(element.getValue()); } storm::expressions::Expression rightHandSide = storm::expressions::Expression::createDoubleLiteral(storm::utility::constantZero()); diff --git a/src/settings/SettingsManager.cpp b/src/settings/SettingsManager.cpp index d8b9284d9..53d31f6f0 100644 --- a/src/settings/SettingsManager.cpp +++ b/src/settings/SettingsManager.cpp @@ -110,6 +110,9 @@ namespace storm { if (optionActive) { setOptionsArguments(activeOptionName, activeOptionIsShortName ? this->shortNameToOptions : this->longNameToOptions, argumentCache); } + + // Finally check whether all modules are okay with the current settings. + this->checkAllModules(); } void SettingsManager::setFromConfigurationFile(std::string const& configFilename) { @@ -325,6 +328,12 @@ namespace storm { } } + void SettingsManager::checkAllModules() const { + for (auto const& nameModulePair : this->modules) { + nameModulePair.second->check(); + } + } + SettingsManager const& manager() { return SettingsManager::manager(); } diff --git a/src/settings/SettingsManager.h b/src/settings/SettingsManager.h index 94d309813..1c77e1d56 100644 --- a/src/settings/SettingsManager.h +++ b/src/settings/SettingsManager.h @@ -179,6 +179,11 @@ namespace storm { */ static void addOptionToMap(std::string const& name, std::shared_ptr