Browse Source

Renamed Settings class to SettingsManager.

Former-commit-id: 2b33f4c8d0
main
dehnert 11 years ago
parent
commit
96e1f8faf9
  1. 4
      CMakeLists.txt
  2. 6
      src/adapters/ExplicitModelAdapter.h
  3. 2
      src/counterexamples/GenerateCounterexample.h
  4. 2
      src/counterexamples/MILPMinimalLabelSetGenerator.h
  5. 2
      src/modelchecker/csl/SparseMarkovAutomatonCslModelChecker.h
  6. 2
      src/modelchecker/prctl/CreatePrctlModelChecker.h
  7. 2
      src/models/Ctmdp.h
  8. 2
      src/models/Dtmc.h
  9. 2
      src/models/Mdp.h
  10. 2
      src/parser/DeterministicSparseTransitionParser.cpp
  11. 4
      src/parser/MarkovAutomatonSparseTransitionParser.cpp
  12. 2
      src/parser/NondeterministicSparseTransitionParser.cpp
  13. 4
      src/settings/InternalOptionMemento.h
  14. 4
      src/settings/Option.h
  15. 58
      src/settings/Settings.cpp
  16. 23
      src/settings/Settings.h
  17. 0
      src/settings/modules/Settings.h
  18. 12
      src/solver/GlpkLpSolver.cpp
  19. 2
      src/solver/GmmxxLinearEquationSolver.cpp
  20. 2
      src/solver/GmmxxNondeterministicLinearEquationSolver.cpp
  21. 2
      src/solver/NativeLinearEquationSolver.cpp
  22. 2
      src/solver/NativeNondeterministicLinearEquationSolver.cpp
  23. 6
      src/storage/dd/CuddDdManager.cpp
  24. 4
      src/storm.cpp
  25. 6
      src/utility/CLI.h
  26. 195
      src/utility/CuddUtility.cpp
  27. 65
      src/utility/CuddUtility.h
  28. 2
      src/utility/InitializeLogging.h
  29. 6
      src/utility/solver.cpp
  30. 6
      test/functional/modelchecker/GmmxxDtmcPrctlModelCheckerTest.cpp
  31. 4
      test/functional/modelchecker/SparseMdpPrctlModelCheckerTest.cpp
  32. 24
      test/functional/solver/GlpkLpSolverTest.cpp
  33. 44
      test/functional/solver/GmmxxLinearEquationSolverTest.cpp
  34. 14
      test/functional/solver/GmmxxNondeterministicLinearEquationSolverTest.cpp
  35. 8
      test/functional/solver/NativeLinearEquationSolverTest.cpp
  36. 14
      test/functional/solver/NativeNondeterministicLinearEquationSolverTest.cpp
  37. 8
      test/functional/storm-functional-tests.cpp
  38. 4
      test/performance/modelchecker/GmmxxDtmcPrctModelCheckerTest.cpp
  39. 4
      test/performance/modelchecker/SparseMdpPrctlModelCheckerTest.cpp
  40. 4
      test/performance/storm-performance-tests.cpp

4
CMakeLists.txt

@ -247,7 +247,8 @@ file(GLOB_RECURSE STORM_COUNTEREXAMPLES_FILES ${PROJECT_SOURCE_DIR}/src/countere
file(GLOB_RECURSE STORM_MODELS_FILES ${PROJECT_SOURCE_DIR}/src/models/*.h ${PROJECT_SOURCE_DIR}/src/models/*.cpp)
file(GLOB STORM_PARSER_FILES ${PROJECT_SOURCE_DIR}/src/parser/*.h ${PROJECT_SOURCE_DIR}/src/parser/*.cpp)
file(GLOB_RECURSE STORM_PARSER_PRISMPARSER_FILES ${PROJECT_SOURCE_DIR}/src/parser/prismparser/*.h ${PROJECT_SOURCE_DIR}/src/parser/prismparser/*.cpp)
file(GLOB_RECURSE STORM_SETTINGS_FILES ${PROJECT_SOURCE_DIR}/src/settings/*.h ${PROJECT_SOURCE_DIR}/src/settings/*.cpp)
file(GLOB STORM_SETTINGS_FILES ${PROJECT_SOURCE_DIR}/src/settings/*.h ${PROJECT_SOURCE_DIR}/src/settings/*.cpp)
file(GLOB STORM_SETTINGS_MODULES_FILES ${PROJECT_SOURCE_DIR}/src/settings/modules/*.h ${PROJECT_SOURCE_DIR}/src/settings/modules/*.cpp)
file(GLOB_RECURSE STORM_SOLVER_FILES ${PROJECT_SOURCE_DIR}/src/solver/*.h ${PROJECT_SOURCE_DIR}/src/solver/*.cpp)
file(GLOB STORM_STORAGE_FILES ${PROJECT_SOURCE_DIR}/src/storage/*.h ${PROJECT_SOURCE_DIR}/src/storage/*.cpp)
file(GLOB_RECURSE STORM_STORAGE_DD_FILES ${PROJECT_SOURCE_DIR}/src/storage/dd/*.h ${PROJECT_SOURCE_DIR}/src/storage/dd/*.cpp)
@ -280,6 +281,7 @@ source_group(models FILES ${STORM_MODELS_FILES})
source_group(parser FILES ${STORM_PARSER_FILES})
source_group(parser\\prismparser FILES ${STORM_PARSER_PRISMPARSER_FILES})
source_group(settings FILES ${STORM_SETTINGS_FILES})
source_group(settings\\modules ${STORM_SETTINGS_MODULES_FILES})
source_group(solver FILES ${STORM_SOLVER_FILES})
source_group(storage FILES ${STORM_STORAGE_FILES})
source_group(storage\\dd FILES ${STORM_STORAGE_DD_FILES})

6
src/adapters/ExplicitModelAdapter.h

@ -312,7 +312,7 @@ namespace storm {
}
// Check that the resulting distribution is in fact a distribution.
LOG_THROW(std::abs(1 - probabilitySum) < storm::settings::Settings::getInstance()->getOptionByLongName("precision").getArgument(0).getValueAsDouble(), storm::exceptions::WrongFormatException, "Probabilities do not sum to one for command '" << command << "'.");
LOG_THROW(std::abs(1 - probabilitySum) < storm::settings::SettingsManager::getInstance()->getOptionByLongName("precision").getArgument(0).getValueAsDouble(), storm::exceptions::WrongFormatException, "Probabilities do not sum to one for command '" << command << "'.");
}
}
@ -418,7 +418,7 @@ namespace storm {
}
// Check that the resulting distribution is in fact a distribution.
if (std::abs(1 - probabilitySum) > storm::settings::Settings::getInstance()->getOptionByLongName("precision").getArgument(0).getValueAsDouble()) {
if (std::abs(1 - probabilitySum) > storm::settings::SettingsManager::getInstance()->getOptionByLongName("precision").getArgument(0).getValueAsDouble()) {
LOG4CPLUS_ERROR(logger, "Sum of update probabilities do not some to one for some command.");
throw storm::exceptions::WrongFormatException() << "Sum of update probabilities do not some to one for some command.";
}
@ -502,7 +502,7 @@ namespace storm {
// If the current state does not have a single choice, we equip it with a self-loop if that was
// requested and issue an error otherwise.
if (totalNumberOfChoices == 0) {
if (storm::settings::Settings::getInstance()->isSet("fixDeadlocks")) {
if (storm::settings::SettingsManager::getInstance()->isSet("fixDeadlocks")) {
// Insert empty choice labeling for added self-loop transitions.
choiceLabels.push_back(boost::container::flat_set<uint_fast64_t>());
transitionMatrixBuilder.addNextValue(currentRow, currentState, storm::utility::constantOne<ValueType>());

2
src/counterexamples/GenerateCounterexample.h

@ -27,7 +27,7 @@
LOG4CPLUS_INFO(logger, "Starting counterexample generation.");
LOG4CPLUS_INFO(logger, "Testing inputs...");
storm::settings::Settings* s = storm::settings::Settings::getInstance();
storm::settings::SettingsManager* s = storm::settings::SettingsManager::getInstance();
// First test output directory.
std::string outPath = s->getOptionByLongName("counterExample").getArgument(0).getValueAsString();

2
src/counterexamples/MILPMinimalLabelSetGenerator.h

@ -1025,7 +1025,7 @@ namespace storm {
// Delegate the actual computation work to the function of equal name.
auto startTime = std::chrono::high_resolution_clock::now();
boost::container::flat_set<uint_fast64_t> usedLabelSet = getMinimalLabelSet(labeledMdp, phiStates, psiStates, bound, strictBound, true, storm::settings::Settings::getInstance()->isSet("schedcuts"));
boost::container::flat_set<uint_fast64_t> usedLabelSet = getMinimalLabelSet(labeledMdp, phiStates, psiStates, bound, strictBound, true, storm::settings::SettingsManager::getInstance()->isSet("schedcuts"));
auto endTime = std::chrono::high_resolution_clock::now();
std::cout << std::endl << "Computed minimal label set of size " << usedLabelSet.size() << " in " << std::chrono::duration_cast<std::chrono::milliseconds>(endTime - startTime).count() << "ms." << std::endl;

2
src/modelchecker/csl/SparseMarkovAutomatonCslModelChecker.h

@ -235,7 +235,7 @@ namespace storm {
// (1) Compute the accuracy we need to achieve the required error bound.
ValueType maxExitRate = this->getModel().getMaximalExitRate();
ValueType delta = (2 * storm::settings::Settings::getInstance()->getOptionByLongName("digiprecision").getArgument(0).getValueAsDouble()) / (upperBound * maxExitRate * maxExitRate);
ValueType delta = (2 * storm::settings::SettingsManager::getInstance()->getOptionByLongName("digiprecision").getArgument(0).getValueAsDouble()) / (upperBound * maxExitRate * maxExitRate);
// (2) Compute the number of steps we need to make for the interval.
uint_fast64_t numberOfSteps = static_cast<uint_fast64_t>(std::ceil((upperBound - lowerBound) / delta));

2
src/modelchecker/prctl/CreatePrctlModelChecker.h

@ -15,7 +15,7 @@
*/
storm::modelchecker::prctl::AbstractModelChecker<double>* createPrctlModelChecker(storm::models::Dtmc<double> const & dtmc) {
// Create the appropriate model checker.
storm::settings::Settings* s = storm::settings::Settings::getInstance();
storm::settings::SettingsManager* s = storm::settings::SettingsManager::getInstance();
std::string const& linsolver = s->getOptionByLongName("linsolver").getArgument(0).getValueAsString();
if (linsolver == "gmm++") {
return new storm::modelchecker::prctl::SparseDtmcPrctlModelChecker<double>(dtmc, new storm::solver::GmmxxLinearEquationSolver<double>());

2
src/models/Ctmdp.h

@ -127,7 +127,7 @@ private:
*/
bool checkValidityOfProbabilityMatrix() {
// Get the settings object to customize linear solving.
storm::settings::Settings* s = storm::settings::Settings::getInstance();
storm::settings::SettingsManager* s = storm::settings::SettingsManager::getInstance();
double precision = s->getOptionByLongName("precision").getArgument(0).getValueAsDouble();
for (uint_fast64_t row = 0; row < this->getTransitionMatrix().getRowCount(); row++) {
T sum = this->getTransitionMatrix().getRowSum(row);

2
src/models/Dtmc.h

@ -298,7 +298,7 @@ private:
*/
bool checkValidityOfProbabilityMatrix() {
// Get the settings object to customize linear solving.
storm::settings::Settings* s = storm::settings::Settings::getInstance();
storm::settings::SettingsManager* s = storm::settings::SettingsManager::getInstance();
double precision = s->getOptionByLongName("precision").getArgument(0).getValueAsDouble();
if (this->getTransitionMatrix().getRowCount() != this->getTransitionMatrix().getColumnCount()) {

2
src/models/Mdp.h

@ -198,7 +198,7 @@ private:
*/
bool checkValidityOfProbabilityMatrix() {
// Get the settings object to customize linear solving.
storm::settings::Settings* s = storm::settings::Settings::getInstance();
storm::settings::SettingsManager* s = storm::settings::SettingsManager::getInstance();
double precision = s->getOptionByLongName("precision").getArgument(0).getValueAsDouble();
for (uint_fast64_t row = 0; row < this->getTransitionMatrix().getRowCount(); row++) {
T sum = this->getTransitionMatrix().getRowSum(row);

2
src/parser/DeterministicSparseTransitionParser.cpp

@ -93,7 +93,7 @@ namespace storm {
uint_fast64_t row, col, lastRow = 0;
double val;
bool fixDeadlocks = storm::settings::Settings::getInstance()->isSet("fixDeadlocks");
bool fixDeadlocks = storm::settings::SettingsManager::getInstance()->isSet("fixDeadlocks");
bool hadDeadlocks = false;
bool rowHadDiagonalEntry = false;

4
src/parser/MarkovAutomatonSparseTransitionParser.cpp

@ -15,7 +15,7 @@ namespace storm {
MarkovAutomatonSparseTransitionParser::FirstPassResult MarkovAutomatonSparseTransitionParser::firstPass(char const* buf) {
MarkovAutomatonSparseTransitionParser::FirstPassResult result;
bool fixDeadlocks = storm::settings::Settings::getInstance()->isSet("fixDeadlocks");
bool fixDeadlocks = storm::settings::SettingsManager::getInstance()->isSet("fixDeadlocks");
// Skip the format hint if it is there.
buf = trimWhitespaces(buf);
@ -157,7 +157,7 @@ namespace storm {
MarkovAutomatonSparseTransitionParser::Result MarkovAutomatonSparseTransitionParser::secondPass(char const* buf, FirstPassResult const& firstPassResult) {
Result result(firstPassResult);
bool fixDeadlocks = storm::settings::Settings::getInstance()->isSet("fixDeadlocks");
bool fixDeadlocks = storm::settings::SettingsManager::getInstance()->isSet("fixDeadlocks");
// Skip the format hint if it is there.
buf = trimWhitespaces(buf);

2
src/parser/NondeterministicSparseTransitionParser.cpp

@ -100,7 +100,7 @@ namespace storm {
// Initialize variables for the parsing run.
uint_fast64_t source = 0, target = 0, lastSource = 0, choice = 0, lastChoice = 0, curRow = 0;
double val = 0.0;
bool fixDeadlocks = storm::settings::Settings::getInstance()->isSet("fixDeadlocks");
bool fixDeadlocks = storm::settings::SettingsManager::getInstance()->isSet("fixDeadlocks");
bool hadDeadlocks = false;
// The first state already starts a new row group of the matrix.

4
src/settings/InternalOptionMemento.h

@ -29,7 +29,7 @@ namespace settings {
*
* @param
*/
InternalOptionMemento(std::string const& longOptionName, bool requiredHasBeenSetState): instance(storm::settings::Settings::getInstance()), optionName(longOptionName), stateRequired(requiredHasBeenSetState) {
InternalOptionMemento(std::string const& longOptionName, bool requiredHasBeenSetState): instance(storm::settings::SettingsManager::getInstance()), optionName(longOptionName), stateRequired(requiredHasBeenSetState) {
this->stateBefore = instance->isSet(optionName);
if (stateRequired) {
instance->set(optionName);
@ -56,7 +56,7 @@ namespace settings {
private:
storm::settings::Settings* instance;
storm::settings::SettingsManager* instance;
std::string const optionName;
bool stateBefore;
bool stateRequired;

4
src/settings/Option.h

@ -32,12 +32,12 @@ extern log4cplus::Logger logger;
namespace storm {
namespace settings {
class Settings;
class SettingsManager;
class Option {
public:
friend class storm::settings::Settings;
friend class storm::settings::SettingsManager;
Option(std::string const& moduleName, std::string const& longOptionName, std::string const& shortOptionName, std::string const& optionDescription, bool isOptionRequired)
: longName(longOptionName), shortName(shortOptionName), description(optionDescription), moduleName(moduleName), isRequired(isOptionRequired), hasBeenSet(false) {

58
src/settings/Settings.cpp

@ -7,7 +7,7 @@
#include "src/exceptions/OptionParserException.h"
// Static Inits
storm::settings::Destroyer storm::settings::Settings::destroyer;
storm::settings::Destroyer storm::settings::SettingsManager::destroyer;
/*!
* @brief Create new instance.
@ -19,16 +19,16 @@ storm::settings::Destroyer storm::settings::Settings::destroyer;
* @param filename either NULL or name of config file
* @return The new instance of Settings.
*/
void storm::settings::Settings::parse(int const argc, char const * const argv[]) {
storm::settings::Settings* myInstance = storm::settings::Settings::getInstance();
void storm::settings::SettingsManager::parse(int const argc, char const * const argv[]) {
storm::settings::SettingsManager* myInstance = storm::settings::SettingsManager::getInstance();
myInstance->parseCommandLine(argc, argv);
}
bool storm::settings::Settings::hasAssignment(std::string const& option) {
bool storm::settings::SettingsManager::hasAssignment(std::string const& option) {
return (option.find_first_of('=', 0) != std::string::npos);
}
storm::settings::stringPair_t storm::settings::Settings::splitOptionString(std::string const& option) {
storm::settings::stringPair_t storm::settings::SettingsManager::splitOptionString(std::string const& option) {
size_t splitLocation = option.find_first_of('=', 0);
if (splitLocation == std::string::npos) {
// Second half is empty
@ -40,7 +40,7 @@ storm::settings::stringPair_t storm::settings::Settings::splitOptionString(std::
return std::make_pair(option.substr(0, splitLocation), option.substr(splitLocation + 1, std::string::npos));
}
void storm::settings::Settings::handleAssignment(std::string const& longOptionName, std::vector<std::string> arguments) {
void storm::settings::SettingsManager::handleAssignment(std::string const& longOptionName, std::vector<std::string> arguments) {
std::string optionName = storm::utility::StringHelper::stringToLower(longOptionName);
Option* option = this->getPtrByLongName(optionName);
@ -51,7 +51,7 @@ void storm::settings::Settings::handleAssignment(std::string const& longOptionNa
uint_fast64_t givenArgsCount = arguments.size();
if (givenArgsCount > option->getArgumentCount()) {
LOG4CPLUS_ERROR(logger, "Settings::handleAssignment: Unable to parse arguments for option \"" << longOptionName << "\": " << arguments.size() << " arguments given, but expected no more than " << option->getArgumentCount() << ".");
LOG4CPLUS_ERROR(logger, "SettingsManager::handleAssignment: Unable to parse arguments for option \"" << longOptionName << "\": " << arguments.size() << " arguments given, but expected no more than " << option->getArgumentCount() << ".");
throw storm::exceptions::OptionParserException() << "Unable to parse arguments for option \"" << longOptionName << "\": " << arguments.size() << " arguments given, but expected no more than " << option->getArgumentCount() << ".";
}
@ -59,7 +59,7 @@ void storm::settings::Settings::handleAssignment(std::string const& longOptionNa
if (i < givenArgsCount) {
storm::settings::fromStringAssignmentResult_t assignmentResult = option->getArgument(i).fromStringValue(arguments.at(i));
if (!assignmentResult.first) {
LOG4CPLUS_ERROR(logger, "Settings::handleAssignment: Unable to parse arguments for option \"" << longOptionName << "\": argument " << option->getArgument(i).getArgumentName() << " rejected the given value \"" << arguments.at(i) << "\" with message:\r\n" << assignmentResult.second << ".");
LOG4CPLUS_ERROR(logger, "SettingsManager::handleAssignment: Unable to parse arguments for option \"" << longOptionName << "\": argument " << option->getArgument(i).getArgumentName() << " rejected the given value \"" << arguments.at(i) << "\" with message:\r\n" << assignmentResult.second << ".");
throw storm::exceptions::OptionParserException() << "Unable to parse arguments for option \"" << longOptionName << "\": argument " << option->getArgument(i).getArgumentName() << " rejected the given value \"" << arguments.at(i) << "\" with message:\r\n" << assignmentResult.second << ".";
}
} else {
@ -74,7 +74,7 @@ void storm::settings::Settings::handleAssignment(std::string const& longOptionNa
}
}
std::vector<std::string> storm::settings::Settings::argvToStringArray(int const argc, char const * const argv[]) {
std::vector<std::string> storm::settings::SettingsManager::argvToStringArray(int const argc, char const * const argv[]) {
// Ignore argv[0], it contains the program path and name
std::vector<std::string> result;
for (int i = 1; i < argc; ++i) {
@ -83,7 +83,7 @@ std::vector<std::string> storm::settings::Settings::argvToStringArray(int const
return result;
}
bool storm::settings::Settings::checkArgumentSyntaxForOption(std::string const& argvString) {
bool storm::settings::SettingsManager::checkArgumentSyntaxForOption(std::string const& argvString) {
if (argvString.size() < 2) {
return false;
}
@ -100,7 +100,7 @@ bool storm::settings::Settings::checkArgumentSyntaxForOption(std::string const&
return true;
}
std::vector<bool> storm::settings::Settings::scanForOptions(std::vector<std::string> const& arguments) {
std::vector<bool> storm::settings::SettingsManager::scanForOptions(std::vector<std::string> const& arguments) {
std::vector<bool> result;
result.reserve(arguments.size());
for (auto it = arguments.cbegin(); it != arguments.cend(); ++it) {
@ -109,7 +109,7 @@ std::vector<bool> storm::settings::Settings::scanForOptions(std::vector<std::str
return result;
}
void storm::settings::Settings::parseCommandLine(int const argc, char const * const argv[]) {
void storm::settings::SettingsManager::parseCommandLine(int const argc, char const * const argv[]) {
LOG4CPLUS_DEBUG(logger, "Settings::parseCommandLine: Parsing " << argc << " arguments.");
std::vector<std::string> stringArgv = argvToStringArray(argc, argv);
@ -180,41 +180,15 @@ void storm::settings::Settings::parseCommandLine(int const argc, char const * co
}
}
bool storm::settings::Settings::registerNewModule(ModuleRegistrationFunction_t registrationFunction) {
Settings* myInstance = Settings::getInstance();
bool result = false;
try {
result = registrationFunction(myInstance);
//LOG4CPLUS_DEBUG(logger, "Settings::registerNewModule: Successfully executed a registrationFunction");
} catch (storm::exceptions::IllegalArgumentException e) {
//LOG4CPLUS_ERROR(logger, "Settings::registerNewModule: Internal Error while setting up available Options!" << std::endl << "IllegalArgumentException: " << e.what() << ".");
std::cout << "Internal Error while setting up available options." << std::endl << "IllegalArgumentException: " << e.what() << "." << std::endl;
return false;
} catch (storm::exceptions::IllegalArgumentValueException e) {
//LOG4CPLUS_ERROR(logger, "Settings::registerNewModule: Internal Error while setting up available Options!" << std::endl << "IllegalArgumentValueException: " << e.what() << ".");
std::cout << "Internal Error while setting up available options." << std::endl << "IllegalArgumentValueException: " << e.what() << "." << std::endl;
return false;
} catch (storm::exceptions::IllegalFunctionCallException e) {
//LOG4CPLUS_ERROR(logger, "Settings::registerNewModule: Internal Error while setting up available Options!" << std::endl << "IllegalFunctionCallException: " << e.what() << ".");
std::cout << "Internal Error while setting up available options." << std::endl << "IllegalFunctionCallException: " << e.what() << "." << std::endl;
return false;
} catch (std::exception e) {
//LOG4CPLUS_ERROR(logger, "Settings::registerNewModule: Internal Error while setting up available Options!" << std::endl << "std::exception: " << e.what() << ".");
std::cout << "Internal Error while setting up available options." << std::endl << "std::exception: " << e.what() << "." << std::endl;
return false;
}
return result;
}
storm::settings::Settings* storm::settings::Settings::getInstance() {
storm::settings::SettingsManager* storm::settings::SettingsManager::getInstance() {
// Usually, this would require double-checked locking.
// But since C++11, this is the way to go:
static storm::settings::Settings pInstance;
static storm::settings::SettingsManager pInstance;
return &pInstance;
}
storm::settings::Settings& storm::settings::Settings::addOption(Option* option) {
storm::settings::SettingsManager& storm::settings::SettingsManager::addOption(Option* option) {
// For automatic management of option's lifetime
std::shared_ptr<Option> optionPtr(option);
@ -247,7 +221,7 @@ storm::settings::Settings& storm::settings::Settings::addOption(Option* option)
return *this;
}
std::string storm::settings::Settings::getHelpText() const {
std::string storm::settings::SettingsManager::getHelpText() const {
// Copy all option names into a vector and sort it
std::vector<std::string> optionNames;

23
src/settings/Settings.h

@ -33,10 +33,6 @@ namespace storm {
* @brief Contains Settings class and associated methods.
*/
namespace settings {
class Settings;
typedef std::function<bool (Settings*)> ModuleRegistrationFunction_t;
typedef bool (*stringValidationFunction_t)(const std::string);
typedef bool (*integerValidationFunction_t)(const int_fast64_t);
typedef bool (*unsignedIntegerValidationFunction_t)(const uint_fast64_t);
@ -61,13 +57,8 @@ namespace settings {
* option modules. An option module can be anything that implements the
* interface specified by registerModule() and does a static initialization call to this function.
*/
class Settings {
class SettingsManager {
public:
/*!
* This function handles the static initialization registration of modules and their options
*/
static bool registerNewModule(ModuleRegistrationFunction_t registrationFunction);
/*!
* This parses the command line of the application and matches it to all prior registered options
@ -117,7 +108,7 @@ namespace settings {
* Returns a reference to the settings instance
* @throws OptionUnificationException
*/
Settings& addOption(Option* option);
SettingsManager& addOption(Option* option);
/*!
* Returns true iff there is an Option with the specified longName and it has been set
@ -138,7 +129,7 @@ namespace settings {
* This function is the Singleton interface for the Settings class
* @return Settings* A Pointer to the singleton instance of Settings
*/
static Settings* getInstance();
static SettingsManager* getInstance();
friend class Destroyer;
friend class InternalOptionMemento;
private:
@ -149,7 +140,7 @@ namespace settings {
* an instance manually, one should always use the
* newInstance() method.
*/
Settings() {
SettingsManager() {
this->addOption(storm::settings::OptionBuilder("StoRM Main", "help", "h", "Shows all available options, arguments and descriptions.").build());
this->addOption(storm::settings::OptionBuilder("StoRM Main", "verbose", "v", "Be verbose.").build());
@ -302,7 +293,7 @@ namespace settings {
* This destructor should be private, as noone should be able to destroy a singleton.
* The object is automatically destroyed when the program terminates by the destroyer.
*/
virtual ~Settings() {
virtual ~SettingsManager() {
//
}
@ -445,7 +436,7 @@ namespace settings {
class Destroyer {
public:
Destroyer(): settingsInstance(nullptr) {
this->settingsInstance = storm::settings::Settings::getInstance();
this->settingsInstance = storm::settings::SettingsManager::getInstance();
}
/*!
@ -462,7 +453,7 @@ namespace settings {
}
}
private:
storm::settings::Settings* settingsInstance;
storm::settings::SettingsManager* settingsInstance;
};

0
src/settings/modules/Settings.h

12
src/solver/GlpkLpSolver.cpp

@ -21,7 +21,7 @@ namespace storm {
glp_set_prob_name(lp, name.c_str());
// Set whether the glpk output shall be printed to the command line.
glp_term_out(storm::settings::Settings::getInstance()->isSet("debug") || storm::settings::Settings::getInstance()->isSet("glpkoutput") ? GLP_ON : GLP_OFF);
glp_term_out(storm::settings::SettingsManager::getInstance()->isSet("debug") || storm::settings::SettingsManager::getInstance()->isSet("glpkoutput") ? GLP_ON : GLP_OFF);
// Because glpk uses 1-based indexing (wtf!?), we need to put dummy elements into the matrix vectors.
rowIndices.push_back(0);
@ -145,13 +145,13 @@ namespace storm {
// Determine the type of the constraint and add it properly.
switch (constraint.getOperator()) {
case storm::expressions::OperatorType::Less:
glp_set_row_bnds(this->lp, nextConstraintIndex, GLP_UP, 0, rightCoefficients.second - storm::settings::Settings::getInstance()->getOptionByLongName("glpkinttol").getArgument(0).getValueAsDouble());
glp_set_row_bnds(this->lp, nextConstraintIndex, GLP_UP, 0, rightCoefficients.second - storm::settings::SettingsManager::getInstance()->getOptionByLongName("glpkinttol").getArgument(0).getValueAsDouble());
break;
case storm::expressions::OperatorType::LessOrEqual:
glp_set_row_bnds(this->lp, nextConstraintIndex, GLP_UP, 0, rightCoefficients.second);
break;
case storm::expressions::OperatorType::Greater:
glp_set_row_bnds(this->lp, nextConstraintIndex, GLP_LO, rightCoefficients.second + storm::settings::Settings::getInstance()->getOptionByLongName("glpkinttol").getArgument(0).getValueAsDouble(), 0);
glp_set_row_bnds(this->lp, nextConstraintIndex, GLP_LO, rightCoefficients.second + storm::settings::SettingsManager::getInstance()->getOptionByLongName("glpkinttol").getArgument(0).getValueAsDouble(), 0);
break;
case storm::expressions::OperatorType::GreaterOrEqual:
glp_set_row_bnds(this->lp, nextConstraintIndex, GLP_LO, rightCoefficients.second, 0);
@ -187,7 +187,7 @@ namespace storm {
glp_iocp* parameters = new glp_iocp();
glp_init_iocp(parameters);
parameters->presolve = GLP_ON;
parameters->tol_int = storm::settings::Settings::getInstance()->getOptionByLongName("glpkinttol").getArgument(0).getValueAsDouble();
parameters->tol_int = storm::settings::SettingsManager::getInstance()->getOptionByLongName("glpkinttol").getArgument(0).getValueAsDouble();
error = glp_intopt(this->lp, parameters);
delete parameters;
@ -285,7 +285,7 @@ namespace storm {
}
// Now check the desired precision was actually achieved.
LOG_THROW(std::abs(static_cast<int>(value) - value) <= storm::settings::Settings::getInstance()->getOptionByLongName("glpkinttol").getArgument(0).getValueAsDouble(), storm::exceptions::InvalidStateException, "Illegal value for integer variable in glpk solution (" << value << ").");
LOG_THROW(std::abs(static_cast<int>(value) - value) <= storm::settings::SettingsManager::getInstance()->getOptionByLongName("glpkinttol").getArgument(0).getValueAsDouble(), storm::exceptions::InvalidStateException, "Illegal value for integer variable in glpk solution (" << value << ").");
return static_cast<int_fast64_t>(value);
}
@ -307,7 +307,7 @@ namespace storm {
value = glp_get_col_prim(this->lp, static_cast<int>(variableIndexPair->second));
}
LOG_THROW(std::abs(static_cast<int>(value) - value) <= storm::settings::Settings::getInstance()->getOptionByLongName("glpkinttol").getArgument(0).getValueAsDouble(), storm::exceptions::InvalidStateException, "Illegal value for binary variable in glpk solution (" << value << ").");
LOG_THROW(std::abs(static_cast<int>(value) - value) <= storm::settings::SettingsManager::getInstance()->getOptionByLongName("glpkinttol").getArgument(0).getValueAsDouble(), storm::exceptions::InvalidStateException, "Illegal value for binary variable in glpk solution (" << value << ").");
return static_cast<bool>(value);
}

2
src/solver/GmmxxLinearEquationSolver.cpp

@ -24,7 +24,7 @@ namespace storm {
template<typename ValueType>
GmmxxLinearEquationSolver<ValueType>::GmmxxLinearEquationSolver() {
// Get the settings object to customize linear solving.
storm::settings::Settings* settings = storm::settings::Settings::getInstance();
storm::settings::SettingsManager* settings = storm::settings::SettingsManager::getInstance();
// Get appropriate settings.
maximalNumberOfIterations = settings->getOptionByLongName("maxiter").getArgument(0).getValueAsUnsignedInteger();

2
src/solver/GmmxxNondeterministicLinearEquationSolver.cpp

@ -12,7 +12,7 @@ namespace storm {
template<typename ValueType>
GmmxxNondeterministicLinearEquationSolver<ValueType>::GmmxxNondeterministicLinearEquationSolver() {
// Get the settings object to customize solving.
storm::settings::Settings* settings = storm::settings::Settings::getInstance();
storm::settings::SettingsManager* settings = storm::settings::SettingsManager::getInstance();
// Get appropriate settings.
maximalNumberOfIterations = settings->getOptionByLongName("maxiter").getArgument(0).getValueAsUnsignedInteger();

2
src/solver/NativeLinearEquationSolver.cpp

@ -17,7 +17,7 @@ namespace storm {
template<typename ValueType>
NativeLinearEquationSolver<ValueType>::NativeLinearEquationSolver() {
// Get the settings object to customize linear solving.
storm::settings::Settings* settings = storm::settings::Settings::getInstance();
storm::settings::SettingsManager* settings = storm::settings::SettingsManager::getInstance();
// Get appropriate settings.
maximalNumberOfIterations = settings->getOptionByLongName("maxiter").getArgument(0).getValueAsUnsignedInteger();

2
src/solver/NativeNondeterministicLinearEquationSolver.cpp

@ -11,7 +11,7 @@ namespace storm {
template<typename ValueType>
NativeNondeterministicLinearEquationSolver<ValueType>::NativeNondeterministicLinearEquationSolver() {
// Get the settings object to customize solving.
storm::settings::Settings* settings = storm::settings::Settings::getInstance();
storm::settings::SettingsManager* settings = storm::settings::SettingsManager::getInstance();
// Get appropriate settings.
maximalNumberOfIterations = settings->getOptionByLongName("maxiter").getArgument(0).getValueAsUnsignedInteger();

6
src/storage/dd/CuddDdManager.cpp

@ -10,11 +10,11 @@
namespace storm {
namespace dd {
DdManager<DdType::CUDD>::DdManager() : metaVariableMap(), cuddManager(), reorderingTechnique(CUDD_REORDER_NONE) {
this->cuddManager.SetMaxMemory(static_cast<unsigned long>(storm::settings::Settings::getInstance()->getOptionByLongName("cuddmaxmem").getArgument(0).getValueAsUnsignedInteger() * 1024ul * 1024ul));
this->cuddManager.SetEpsilon(storm::settings::Settings::getInstance()->getOptionByLongName("cuddprec").getArgument(0).getValueAsDouble());
this->cuddManager.SetMaxMemory(static_cast<unsigned long>(storm::settings::SettingsManager::getInstance()->getOptionByLongName("cuddmaxmem").getArgument(0).getValueAsUnsignedInteger() * 1024ul * 1024ul));
this->cuddManager.SetEpsilon(storm::settings::SettingsManager::getInstance()->getOptionByLongName("cuddprec").getArgument(0).getValueAsDouble());
// Now set the selected reordering technique.
std::string const& reorderingTechnique = storm::settings::Settings::getInstance()->getOptionByLongName("reorder").getArgument(0).getValueAsString();
std::string const& reorderingTechnique = storm::settings::SettingsManager::getInstance()->getOptionByLongName("reorder").getArgument(0).getValueAsString();
if (reorderingTechnique == "none") {
this->reorderingTechnique = CUDD_REORDER_NONE;
} else if (reorderingTechnique == "random") {

4
src/storm.cpp

@ -73,7 +73,7 @@
* @param modelchecker The model checker that is to be invoked on all given formulae.
*/
void checkPrctlFormulae(storm::modelchecker::prctl::AbstractModelChecker<double> const& modelchecker) {
storm::settings::Settings* s = storm::settings::Settings::getInstance();
storm::settings::SettingsManager* s = storm::settings::SettingsManager::getInstance();
if (s->isSet("prctl")) {
std::string const chosenPrctlFile = s->getOptionByLongName("prctl").getArgument(0).getValueAsString();
LOG4CPLUS_INFO(logger, "Parsing prctl file: " << chosenPrctlFile << ".");
@ -112,7 +112,7 @@ int main(const int argc, const char* argv[]) {
}
// If requested by the user, we install a timeout signal to abort computation.
storm::settings::Settings* s = storm::settings::Settings::getInstance();
storm::settings::SettingsManager* s = storm::settings::SettingsManager::getInstance();
uint_fast64_t timeout = s->getOptionByLongName("timeout").getArgument(0).getValueAsUnsignedInteger();
if (timeout != 0) {
stormSetAlarm(timeout);

6
src/utility/CLI.h

@ -127,9 +127,9 @@ void printHeader(const int argc, const char* argv[]) {
* @return True iff the program should continue to run after parsing the options.
*/
bool parseOptions(const int argc, const char* argv[]) {
storm::settings::Settings* s = storm::settings::Settings::getInstance();
storm::settings::SettingsManager* s = storm::settings::SettingsManager::getInstance();
try {
storm::settings::Settings::parse(argc, argv);
storm::settings::SettingsManager::parse(argc, argv);
} catch (storm::exceptions::OptionParserException& e) {
std::cout << "Could not recover from settings error: " << e.what() << "." << std::endl;
std::cout << std::endl << s->getHelpText();
@ -137,7 +137,7 @@ bool parseOptions(const int argc, const char* argv[]) {
}
if (s->isSet("help")) {
std::cout << storm::settings::Settings::getInstance()->getHelpText();
std::cout << storm::settings::SettingsManager::getInstance()->getHelpText();
return false;
}

195
src/utility/CuddUtility.cpp

@ -1,195 +0,0 @@
/*
* CuddUtility.cpp
*
* Created on: 26.01.2013
* Author: Christian Dehnert
*/
#include "CuddUtility.h"
#include "src/exceptions/InvalidArgumentException.h"
#include "log4cplus/logger.h"
#include "log4cplus/loggingmacros.h"
extern log4cplus::Logger logger;
#include <stdio.h>
#include <iostream>
namespace storm {
namespace utility {
storm::utility::CuddUtility* storm::utility::CuddUtility::instance = nullptr;
ADD* CuddUtility::getNewAddVariable() {
ADD* result = new ADD(manager.addVar());
allDecisionDiagramVariables.push_back(result);
return result;
}
ADD* CuddUtility::getAddVariable(int index) const {
return new ADD(manager.addVar(index));
}
ADD* CuddUtility::getOne() const {
return new ADD(manager.addOne());
}
ADD* CuddUtility::getZero() const {
return new ADD(manager.addZero());
}
ADD* CuddUtility::getConstantEncoding(uint_fast64_t constant, std::vector<ADD*> const& variables) const {
if ((constant >> variables.size()) != 0) {
LOG4CPLUS_ERROR(logger, "Cannot create encoding for constant " << constant << " with "
<< variables.size() << " variables.");
throw storm::exceptions::InvalidArgumentException() << "Cannot create encoding"
<< " for constant " << constant << " with " << variables.size()
<< " variables.";
}
// Determine whether the new ADD will be rooted by the first variable or its complement.
ADD initialNode;
if ((constant & (1ull << (variables.size() - 1))) != 0) {
initialNode = *variables[0];
} else {
initialNode = ~(*variables[0]);
}
ADD* result = new ADD(initialNode);
// Add (i.e. multiply) the other variables as well according to whether their bit is set or not.
for (uint_fast64_t i = 1; i < variables.size(); ++i) {
if ((constant & (1ull << (variables.size() - i - 1))) != 0) {
*result *= *variables[i];
} else {
*result *= ~(*variables[i]);
}
}
return result;
}
void CuddUtility::setValueAtIndex(ADD* add, uint_fast64_t index, std::vector<ADD*> const& variables, double value) const {
if ((index >> variables.size()) != 0) {
LOG4CPLUS_ERROR(logger, "Cannot create encoding for index " << index << " with "
<< variables.size() << " variables.");
throw storm::exceptions::InvalidArgumentException() << "Cannot create encoding"
<< " for index " << index << " with " << variables.size()
<< " variables.";
}
// Determine whether the new ADD will be rooted by the first variable or its complement.
ADD initialNode;
if ((index & (1ull << (variables.size() - 1))) != 0) {
initialNode = *variables[0];
} else {
initialNode = ~(*variables[0]);
}
ADD* encoding = new ADD(initialNode);
// Add (i.e. multiply) the other variables as well according to whether their bit is set or not.
for (uint_fast64_t i = 1; i < variables.size(); ++i) {
if ((index & (1ull << (variables.size() - i - 1))) != 0) {
*encoding *= *variables[i];
} else {
*encoding *= ~(*variables[i]);
}
}
*add = encoding->Ite(manager.constant(value), *add);
}
void CuddUtility::setValueAtIndices(ADD* add, uint_fast64_t rowIndex, uint_fast64_t columnIndex, std::vector<ADD*> const& rowVariables, std::vector<ADD*> const& columnVariables, double value) const {
if ((rowIndex >> rowVariables.size()) != 0) {
LOG4CPLUS_ERROR(logger, "Cannot create encoding for index " << rowIndex << " with "
<< rowVariables.size() << " variables.");
throw storm::exceptions::InvalidArgumentException() << "Cannot create encoding"
<< " for index " << rowIndex << " with " << rowVariables.size()
<< " variables.";
}
if ((columnIndex >> columnVariables.size()) != 0) {
LOG4CPLUS_ERROR(logger, "Cannot create encoding for index " << columnIndex << " with "
<< columnVariables.size() << " variables.");
throw storm::exceptions::InvalidArgumentException() << "Cannot create encoding"
<< " for index " << columnIndex << " with " << columnVariables.size()
<< " variables.";
}
if (rowVariables.size() != columnVariables.size()) {
LOG4CPLUS_ERROR(logger, "Number of variables for indices encodings does not match.");
throw storm::exceptions::InvalidArgumentException()
<< "Number of variables for indices encodings does not match.";
}
ADD initialNode;
if ((rowIndex & (1ull << (rowVariables.size() - 1))) != 0) {
initialNode = *rowVariables[0];
} else {
initialNode = ~(*rowVariables[0]);
}
ADD* encoding = new ADD(initialNode);
if ((columnIndex & (1ull << (rowVariables.size() - 1))) != 0) {
*encoding *= *columnVariables[0];
} else {
*encoding *= ~(*columnVariables[0]);
}
for (uint_fast64_t i = 1; i < rowVariables.size(); ++i) {
if ((rowIndex & (1ull << (rowVariables.size() - i - 1))) != 0) {
*encoding *= *rowVariables[i];
} else {
*encoding *= ~(*rowVariables[i]);
}
if ((columnIndex & (1ull << (columnVariables.size() - i - 1))) != 0) {
*encoding *= *columnVariables[i];
} else {
*encoding *= ~(*columnVariables[i]);
}
}
*add = encoding->Ite(manager.constant(value), *add);
}
ADD* CuddUtility::getConstant(double value) const {
return new ADD(manager.constant(value));
}
ADD* CuddUtility::permuteVariables(ADD* add, std::vector<ADD*> fromVariables, std::vector<ADD*> toVariables, uint_fast64_t totalNumberOfVariables) const {
std::vector<int> permutation;
permutation.resize(totalNumberOfVariables);
for (uint_fast64_t i = 0; i < totalNumberOfVariables; ++i) {
permutation[i] = static_cast<int>(i);
}
for (uint_fast64_t i = 0; i < fromVariables.size(); ++i) {
permutation[fromVariables[i]->NodeReadIndex()] = toVariables[i]->NodeReadIndex();
}
return new ADD(add->Permute(&permutation[0]));
}
void CuddUtility::dumpDotToFile(ADD* add, std::string filename) const {
std::vector<ADD> nodes;
nodes.push_back(*add);
FILE* filePtr;
filePtr = fopen(filename.c_str(), "w");
manager.DumpDot(nodes, 0, 0, filePtr);
fclose(filePtr);
}
Cudd const& CuddUtility::getManager() const {
return manager;
}
CuddUtility* cuddUtilityInstance() {
if (CuddUtility::instance == nullptr) {
CuddUtility::instance = new CuddUtility();
}
return CuddUtility::instance;
}
} // namespace utility
} // namespace storm

65
src/utility/CuddUtility.h

@ -1,65 +0,0 @@
/*
* CuddUtility.h
*
* Created on: 26.01.2013
* Author: Christian Dehnert
*/
#ifndef STORM_UTILITY_CUDDUTILITY_H_
#define STORM_UTILITY_CUDDUTILITY_H_
#include "cuddObj.hh"
#include <cstdint>
namespace storm {
namespace utility {
class CuddUtility {
public:
~CuddUtility() {
for (auto element : allDecisionDiagramVariables) {
delete element;
}
}
ADD* getNewAddVariable();
ADD* getAddVariable(int index) const;
ADD* getOne() const;
ADD* getZero() const;
ADD* getConstantEncoding(uint_fast64_t constant, std::vector<ADD*> const& variables) const;
void setValueAtIndex(ADD* add, uint_fast64_t index, std::vector<ADD*> const& variables, double value) const;
void setValueAtIndices(ADD* add, uint_fast64_t rowIndex, uint_fast64_t columnIndex, std::vector<ADD*> const& rowVariables, std::vector<ADD*> const& columnVariables, double value) const;
ADD* getConstant(double value) const;
ADD* permuteVariables(ADD* add, std::vector<ADD*> fromVariables, std::vector<ADD*> toVariables, uint_fast64_t totalNumberOfVariables) const;
void dumpDotToFile(ADD* add, std::string filename) const;
Cudd const& getManager() const;
friend CuddUtility* cuddUtilityInstance();
private:
CuddUtility() : manager(), allDecisionDiagramVariables() {
}
Cudd manager;
std::vector<ADD*> allDecisionDiagramVariables;
static CuddUtility* instance;
};
CuddUtility* cuddUtilityInstance();
} // namespace utility
} // namespace storm
#endif /* STORM_UTILITY_CUDDUTILITY_H_ */

2
src/utility/InitializeLogging.h

@ -27,7 +27,7 @@ void initializeLogger() {
* Sets up the logging to file.
*/
void setUpFileLogging() {
storm::settings::Settings* s = storm::settings::Settings::getInstance();
storm::settings::SettingsManager* s = storm::settings::SettingsManager::getInstance();
log4cplus::SharedAppenderPtr fileLogAppender(new log4cplus::FileAppender(s->getOptionByLongName("logfile").getArgument(0).getValueAsString()));
fileLogAppender->setName("mainFileAppender");
fileLogAppender->setLayout(std::auto_ptr<log4cplus::Layout>(new log4cplus::PatternLayout("%-5p - %D{%H:%M:%S} (%r ms) - %F:%L: %m%n")));

6
src/utility/solver.cpp

@ -15,7 +15,7 @@ namespace storm {
namespace utility {
namespace solver {
std::shared_ptr<storm::solver::LpSolver> getLpSolver(std::string const& name) {
std::string const& lpSolver = storm::settings::Settings::getInstance()->getOptionByLongName("lpsolver").getArgument(0).getValueAsString();
std::string const& lpSolver = storm::settings::SettingsManager::getInstance()->getOptionByLongName("lpsolver").getArgument(0).getValueAsString();
if (lpSolver == "gurobi") {
return std::shared_ptr<storm::solver::LpSolver>(new storm::solver::GurobiLpSolver(name));
} else if (lpSolver == "glpk") {
@ -27,7 +27,7 @@ namespace storm {
template<typename ValueType>
std::shared_ptr<storm::solver::LinearEquationSolver<ValueType>> getLinearEquationSolver() {
std::string const& linearEquationSolver = storm::settings::Settings::getInstance()->getOptionByLongName("linsolver").getArgument(0).getValueAsString();
std::string const& linearEquationSolver = storm::settings::SettingsManager::getInstance()->getOptionByLongName("linsolver").getArgument(0).getValueAsString();
if (linearEquationSolver == "gmm++") {
return std::shared_ptr<storm::solver::LinearEquationSolver<ValueType>>(new storm::solver::GmmxxLinearEquationSolver<ValueType>());
} else if (linearEquationSolver == "native") {
@ -39,7 +39,7 @@ namespace storm {
template<typename ValueType>
std::shared_ptr<storm::solver::NondeterministicLinearEquationSolver<ValueType>> getNondeterministicLinearEquationSolver() {
std::string const& nondeterministicLinearEquationSolver = storm::settings::Settings::getInstance()->getOptionByLongName("ndsolver").getArgument(0).getValueAsString();
std::string const& nondeterministicLinearEquationSolver = storm::settings::SettingsManager::getInstance()->getOptionByLongName("ndsolver").getArgument(0).getValueAsString();
if (nondeterministicLinearEquationSolver == "gmm++") {
return std::shared_ptr<storm::solver::NondeterministicLinearEquationSolver<ValueType>>(new storm::solver::GmmxxNondeterministicLinearEquationSolver<ValueType>());
} else if (nondeterministicLinearEquationSolver == "native") {

6
test/functional/modelchecker/GmmxxDtmcPrctlModelCheckerTest.cpp

@ -8,7 +8,7 @@
#include "src/parser/AutoParser.h"
TEST(GmmxxDtmcPrctlModelCheckerTest, Die) {
storm::settings::Settings* s = storm::settings::Settings::getInstance();
storm::settings::SettingsManager* s = storm::settings::SettingsManager::getInstance();
storm::settings::InternalOptionMemento deadlockOption("fixDeadlocks", true);
ASSERT_TRUE(s->isSet("fixDeadlocks"));
std::shared_ptr<storm::models::AbstractModel<double>> abstractModel = storm::parser::AutoParser::parseModel(STORM_CPP_BASE_PATH "/examples/dtmc/die/die.tra", STORM_CPP_BASE_PATH "/examples/dtmc/die/die.lab", "", STORM_CPP_BASE_PATH "/examples/dtmc/die/die.coin_flips.trans.rew");
@ -52,7 +52,7 @@ TEST(GmmxxDtmcPrctlModelCheckerTest, Die) {
}
TEST(GmmxxDtmcPrctlModelCheckerTest, Crowds) {
storm::settings::Settings* s = storm::settings::Settings::getInstance();
storm::settings::SettingsManager* s = storm::settings::SettingsManager::getInstance();
storm::settings::InternalOptionMemento deadlockOption("fixDeadlocks", true);
ASSERT_TRUE(s->isSet("fixDeadlocks"));
std::shared_ptr<storm::models::AbstractModel<double>> abstractModel = storm::parser::AutoParser::parseModel(STORM_CPP_BASE_PATH "/examples/dtmc/crowds/crowds5_5.tra", STORM_CPP_BASE_PATH "/examples/dtmc/crowds/crowds5_5.lab", "", "");
@ -89,7 +89,7 @@ TEST(GmmxxDtmcPrctlModelCheckerTest, Crowds) {
}
TEST(GmmxxDtmcPrctlModelCheckerTest, SynchronousLeader) {
storm::settings::Settings* s = storm::settings::Settings::getInstance();
storm::settings::SettingsManager* s = storm::settings::SettingsManager::getInstance();
storm::settings::InternalOptionMemento deadlockOption("fixDeadlocks", true);
ASSERT_TRUE(s->isSet("fixDeadlocks"));
std::shared_ptr<storm::models::AbstractModel<double>> abstractModel = storm::parser::AutoParser::parseModel(STORM_CPP_BASE_PATH "/examples/dtmc/synchronous_leader/leader4_8.tra", STORM_CPP_BASE_PATH "/examples/dtmc/synchronous_leader/leader4_8.lab", "", STORM_CPP_BASE_PATH "/examples/dtmc/synchronous_leader/leader4_8.pick.trans.rew");

4
test/functional/modelchecker/SparseMdpPrctlModelCheckerTest.cpp

@ -7,7 +7,7 @@
#include "src/parser/AutoParser.h"
TEST(SparseMdpPrctlModelCheckerTest, Dice) {
storm::settings::Settings* s = storm::settings::Settings::getInstance();
storm::settings::SettingsManager* s = storm::settings::SettingsManager::getInstance();
std::shared_ptr<storm::models::AbstractModel<double>> abstractModel = storm::parser::AutoParser::parseModel(STORM_CPP_BASE_PATH "/examples/mdp/two_dice/two_dice.tra", STORM_CPP_BASE_PATH "/examples/mdp/two_dice/two_dice.lab", "", STORM_CPP_BASE_PATH "/examples/mdp/two_dice/two_dice.flip.trans.rew");
ASSERT_EQ(abstractModel->getType(), storm::models::MDP);
@ -103,7 +103,7 @@ TEST(SparseMdpPrctlModelCheckerTest, Dice) {
}
TEST(SparseMdpPrctlModelCheckerTest, AsynchronousLeader) {
storm::settings::Settings* s = storm::settings::Settings::getInstance();
storm::settings::SettingsManager* s = storm::settings::SettingsManager::getInstance();
std::shared_ptr<storm::models::AbstractModel<double>> abstractModel = storm::parser::AutoParser::parseModel(STORM_CPP_BASE_PATH "/examples/mdp/asynchronous_leader/leader4.tra", STORM_CPP_BASE_PATH "/examples/mdp/asynchronous_leader/leader4.lab", "", STORM_CPP_BASE_PATH "/examples/mdp/asynchronous_leader/leader4.trans.rew");
ASSERT_EQ(storm::models::MDP, abstractModel->getType());

24
test/functional/solver/GlpkLpSolverTest.cpp

@ -25,16 +25,16 @@ TEST(GlpkLpSolver, LPOptimizeMax) {
ASSERT_FALSE(solver.isInfeasible());
double xValue = 0;
ASSERT_NO_THROW(xValue = solver.getContinuousValue("x"));
ASSERT_LT(std::abs(xValue - 1), storm::settings::Settings::getInstance()->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
ASSERT_LT(std::abs(xValue - 1), storm::settings::SettingsManager::getInstance()->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
double yValue = 0;
ASSERT_NO_THROW(yValue = solver.getContinuousValue("y"));
ASSERT_LT(std::abs(yValue - 6.5), storm::settings::Settings::getInstance()->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
ASSERT_LT(std::abs(yValue - 6.5), storm::settings::SettingsManager::getInstance()->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
double zValue = 0;
ASSERT_NO_THROW(zValue = solver.getContinuousValue("z"));
ASSERT_LT(std::abs(zValue - 2.75), storm::settings::Settings::getInstance()->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
ASSERT_LT(std::abs(zValue - 2.75), storm::settings::SettingsManager::getInstance()->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
double objectiveValue = 0;
ASSERT_NO_THROW(objectiveValue = solver.getObjectiveValue());
ASSERT_LT(std::abs(objectiveValue - 14.75), storm::settings::Settings::getInstance()->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
ASSERT_LT(std::abs(objectiveValue - 14.75), storm::settings::SettingsManager::getInstance()->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
}
TEST(GlpkLpSolver, LPOptimizeMin) {
@ -55,16 +55,16 @@ TEST(GlpkLpSolver, LPOptimizeMin) {
ASSERT_FALSE(solver.isInfeasible());
double xValue = 0;
ASSERT_NO_THROW(xValue = solver.getContinuousValue("x"));
ASSERT_LT(std::abs(xValue - 1), storm::settings::Settings::getInstance()->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
ASSERT_LT(std::abs(xValue - 1), storm::settings::SettingsManager::getInstance()->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
double yValue = 0;
ASSERT_NO_THROW(yValue = solver.getContinuousValue("y"));
ASSERT_LT(std::abs(yValue - 0), storm::settings::Settings::getInstance()->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
ASSERT_LT(std::abs(yValue - 0), storm::settings::SettingsManager::getInstance()->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
double zValue = 0;
ASSERT_NO_THROW(zValue = solver.getContinuousValue("z"));
ASSERT_LT(std::abs(zValue - 5.7), storm::settings::Settings::getInstance()->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
ASSERT_LT(std::abs(zValue - 5.7), storm::settings::SettingsManager::getInstance()->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
double objectiveValue = 0;
ASSERT_NO_THROW(objectiveValue = solver.getObjectiveValue());
ASSERT_LT(std::abs(objectiveValue - (-6.7)), storm::settings::Settings::getInstance()->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
ASSERT_LT(std::abs(objectiveValue - (-6.7)), storm::settings::SettingsManager::getInstance()->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
}
TEST(GlpkLpSolver, MILPOptimizeMax) {
@ -91,10 +91,10 @@ TEST(GlpkLpSolver, MILPOptimizeMax) {
ASSERT_EQ(6, yValue);
double zValue = 0;
ASSERT_NO_THROW(zValue = solver.getContinuousValue("z"));
ASSERT_LT(std::abs(zValue - 3), storm::settings::Settings::getInstance()->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
ASSERT_LT(std::abs(zValue - 3), storm::settings::SettingsManager::getInstance()->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
double objectiveValue = 0;
ASSERT_NO_THROW(objectiveValue = solver.getObjectiveValue());
ASSERT_LT(std::abs(objectiveValue - 14), storm::settings::Settings::getInstance()->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
ASSERT_LT(std::abs(objectiveValue - 14), storm::settings::SettingsManager::getInstance()->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
}
TEST(GlpkLpSolver, MILPOptimizeMin) {
@ -121,10 +121,10 @@ TEST(GlpkLpSolver, MILPOptimizeMin) {
ASSERT_EQ(0, yValue);
double zValue = 0;
ASSERT_NO_THROW(zValue = solver.getContinuousValue("z"));
ASSERT_LT(std::abs(zValue - 5), storm::settings::Settings::getInstance()->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
ASSERT_LT(std::abs(zValue - 5), storm::settings::SettingsManager::getInstance()->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
double objectiveValue = 0;
ASSERT_NO_THROW(objectiveValue = solver.getObjectiveValue());
ASSERT_LT(std::abs(objectiveValue - (-6)), storm::settings::Settings::getInstance()->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
ASSERT_LT(std::abs(objectiveValue - (-6)), storm::settings::SettingsManager::getInstance()->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
}
TEST(GlpkLpSolver, LPInfeasible) {

44
test/functional/solver/GmmxxLinearEquationSolverTest.cpp

@ -27,9 +27,9 @@ TEST(GmmxxLinearEquationSolver, SolveWithStandardOptions) {
storm::solver::GmmxxLinearEquationSolver<double> solver;
ASSERT_NO_THROW(solver.solveEquationSystem(A, x, b));
ASSERT_LT(std::abs(x[0] - 1), storm::settings::Settings::getInstance()->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
ASSERT_LT(std::abs(x[1] - 3), storm::settings::Settings::getInstance()->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
ASSERT_LT(std::abs(x[2] - (-1)), storm::settings::Settings::getInstance()->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
ASSERT_LT(std::abs(x[0] - 1), storm::settings::SettingsManager::getInstance()->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
ASSERT_LT(std::abs(x[1] - 3), storm::settings::SettingsManager::getInstance()->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
ASSERT_LT(std::abs(x[2] - (-1)), storm::settings::SettingsManager::getInstance()->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
}
TEST(GmmxxLinearEquationSolver, gmres) {
@ -55,9 +55,9 @@ TEST(GmmxxLinearEquationSolver, gmres) {
storm::solver::GmmxxLinearEquationSolver<double> solver(storm::solver::GmmxxLinearEquationSolver<double>::GMRES, 1e-6, 10000, storm::solver::GmmxxLinearEquationSolver<double>::NONE, true, 50);
ASSERT_NO_THROW(solver.solveEquationSystem(A, x, b));
ASSERT_LT(std::abs(x[0] - 1), storm::settings::Settings::getInstance()->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
ASSERT_LT(std::abs(x[1] - 3), storm::settings::Settings::getInstance()->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
ASSERT_LT(std::abs(x[2] - (-1)), storm::settings::Settings::getInstance()->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
ASSERT_LT(std::abs(x[0] - 1), storm::settings::SettingsManager::getInstance()->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
ASSERT_LT(std::abs(x[1] - 3), storm::settings::SettingsManager::getInstance()->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
ASSERT_LT(std::abs(x[2] - (-1)), storm::settings::SettingsManager::getInstance()->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
}
TEST(GmmxxLinearEquationSolver, qmr) {
@ -83,9 +83,9 @@ TEST(GmmxxLinearEquationSolver, qmr) {
storm::solver::GmmxxLinearEquationSolver<double> solver(storm::solver::GmmxxLinearEquationSolver<double>::QMR, 1e-6, 10000, storm::solver::GmmxxLinearEquationSolver<double>::NONE, true, 50);
ASSERT_NO_THROW(solver.solveEquationSystem(A, x, b));
ASSERT_LT(std::abs(x[0] - 1), storm::settings::Settings::getInstance()->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
ASSERT_LT(std::abs(x[1] - 3), storm::settings::Settings::getInstance()->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
ASSERT_LT(std::abs(x[2] - (-1)), storm::settings::Settings::getInstance()->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
ASSERT_LT(std::abs(x[0] - 1), storm::settings::SettingsManager::getInstance()->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
ASSERT_LT(std::abs(x[1] - 3), storm::settings::SettingsManager::getInstance()->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
ASSERT_LT(std::abs(x[2] - (-1)), storm::settings::SettingsManager::getInstance()->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
}
TEST(GmmxxLinearEquationSolver, bicgstab) {
@ -111,9 +111,9 @@ TEST(GmmxxLinearEquationSolver, bicgstab) {
storm::solver::GmmxxLinearEquationSolver<double> solver(storm::solver::GmmxxLinearEquationSolver<double>::BICGSTAB, 1e-6, 10000, storm::solver::GmmxxLinearEquationSolver<double>::NONE);
ASSERT_NO_THROW(solver.solveEquationSystem(A, x, b));
ASSERT_LT(std::abs(x[0] - 1), storm::settings::Settings::getInstance()->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
ASSERT_LT(std::abs(x[1] - 3), storm::settings::Settings::getInstance()->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
ASSERT_LT(std::abs(x[2] - (-1)), storm::settings::Settings::getInstance()->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
ASSERT_LT(std::abs(x[0] - 1), storm::settings::SettingsManager::getInstance()->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
ASSERT_LT(std::abs(x[1] - 3), storm::settings::SettingsManager::getInstance()->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
ASSERT_LT(std::abs(x[2] - (-1)), storm::settings::SettingsManager::getInstance()->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
}
TEST(GmmxxLinearEquationSolver, jacobi) {
@ -139,9 +139,9 @@ TEST(GmmxxLinearEquationSolver, jacobi) {
storm::solver::GmmxxLinearEquationSolver<double> solver(storm::solver::GmmxxLinearEquationSolver<double>::JACOBI, 1e-6, 10000, storm::solver::GmmxxLinearEquationSolver<double>::NONE);
ASSERT_NO_THROW(solver.solveEquationSystem(A, x, b));
ASSERT_LT(std::abs(x[0] - 1), storm::settings::Settings::getInstance()->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
ASSERT_LT(std::abs(x[1] - 3), storm::settings::Settings::getInstance()->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
ASSERT_LT(std::abs(x[2] - (-1)), storm::settings::Settings::getInstance()->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
ASSERT_LT(std::abs(x[0] - 1), storm::settings::SettingsManager::getInstance()->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
ASSERT_LT(std::abs(x[1] - 3), storm::settings::SettingsManager::getInstance()->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
ASSERT_LT(std::abs(x[2] - (-1)), storm::settings::SettingsManager::getInstance()->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
}
TEST(GmmxxLinearEquationSolver, gmresilu) {
@ -167,9 +167,9 @@ TEST(GmmxxLinearEquationSolver, gmresilu) {
storm::solver::GmmxxLinearEquationSolver<double> solver(storm::solver::GmmxxLinearEquationSolver<double>::GMRES, 1e-6, 10000, storm::solver::GmmxxLinearEquationSolver<double>::NONE, true, 50);
ASSERT_NO_THROW(solver.solveEquationSystem(A, x, b));
ASSERT_LT(std::abs(x[0] - 1), storm::settings::Settings::getInstance()->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
ASSERT_LT(std::abs(x[1] - 3), storm::settings::Settings::getInstance()->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
ASSERT_LT(std::abs(x[2] - (-1)), storm::settings::Settings::getInstance()->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
ASSERT_LT(std::abs(x[0] - 1), storm::settings::SettingsManager::getInstance()->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
ASSERT_LT(std::abs(x[1] - 3), storm::settings::SettingsManager::getInstance()->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
ASSERT_LT(std::abs(x[2] - (-1)), storm::settings::SettingsManager::getInstance()->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
}
TEST(GmmxxLinearEquationSolver, gmresdiag) {
@ -195,9 +195,9 @@ TEST(GmmxxLinearEquationSolver, gmresdiag) {
storm::solver::GmmxxLinearEquationSolver<double> solver(storm::solver::GmmxxLinearEquationSolver<double>::GMRES, 1e-6, 10000, storm::solver::GmmxxLinearEquationSolver<double>::NONE, true, 50);
ASSERT_NO_THROW(solver.solveEquationSystem(A, x, b));
ASSERT_LT(std::abs(x[0] - 1), storm::settings::Settings::getInstance()->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
ASSERT_LT(std::abs(x[1] - 3), storm::settings::Settings::getInstance()->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
ASSERT_LT(std::abs(x[2] - (-1)), storm::settings::Settings::getInstance()->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
ASSERT_LT(std::abs(x[0] - 1), storm::settings::SettingsManager::getInstance()->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
ASSERT_LT(std::abs(x[1] - 3), storm::settings::SettingsManager::getInstance()->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
ASSERT_LT(std::abs(x[2] - (-1)), storm::settings::SettingsManager::getInstance()->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
}
TEST(GmmxxLinearEquationSolver, MatrixVectorMultplication) {
@ -220,5 +220,5 @@ TEST(GmmxxLinearEquationSolver, MatrixVectorMultplication) {
storm::solver::GmmxxLinearEquationSolver<double> solver;
ASSERT_NO_THROW(solver.performMatrixVectorMultiplication(A, x, nullptr, 4));
ASSERT_LT(std::abs(x[0] - 1), storm::settings::Settings::getInstance()->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
ASSERT_LT(std::abs(x[0] - 1), storm::settings::SettingsManager::getInstance()->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
}

14
test/functional/solver/GmmxxNondeterministicLinearEquationSolverTest.cpp

@ -17,10 +17,10 @@ TEST(GmmxxNondeterministicLinearEquationSolver, SolveWithStandardOptions) {
storm::solver::GmmxxNondeterministicLinearEquationSolver<double> solver;
ASSERT_NO_THROW(solver.solveEquationSystem(true, A, x, b));
ASSERT_LT(std::abs(x[0] - 0.5), storm::settings::Settings::getInstance()->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
ASSERT_LT(std::abs(x[0] - 0.5), storm::settings::SettingsManager::getInstance()->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
ASSERT_NO_THROW(solver.solveEquationSystem(false, A, x, b));
ASSERT_LT(std::abs(x[0] - 0.989991), storm::settings::Settings::getInstance()->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
ASSERT_LT(std::abs(x[0] - 0.989991), storm::settings::SettingsManager::getInstance()->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
}
TEST(GmmxxNondeterministicLinearEquationSolver, MatrixVectorMultiplication) {
@ -45,21 +45,21 @@ TEST(GmmxxNondeterministicLinearEquationSolver, MatrixVectorMultiplication) {
storm::solver::GmmxxNondeterministicLinearEquationSolver<double> solver;
ASSERT_NO_THROW(solver.performMatrixVectorMultiplication(true, A, x, nullptr, 1));
ASSERT_LT(std::abs(x[0] - 0.099), storm::settings::Settings::getInstance()->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
ASSERT_LT(std::abs(x[0] - 0.099), storm::settings::SettingsManager::getInstance()->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
x = {0, 1, 0};
ASSERT_NO_THROW(solver.performMatrixVectorMultiplication(true, A, x, nullptr, 2));
ASSERT_LT(std::abs(x[0] - 0.1881), storm::settings::Settings::getInstance()->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
ASSERT_LT(std::abs(x[0] - 0.1881), storm::settings::SettingsManager::getInstance()->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
x = {0, 1, 0};
ASSERT_NO_THROW(solver.performMatrixVectorMultiplication(true, A, x, nullptr, 20));
ASSERT_LT(std::abs(x[0] - 0.5), storm::settings::Settings::getInstance()->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
ASSERT_LT(std::abs(x[0] - 0.5), storm::settings::SettingsManager::getInstance()->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
x = {0, 1, 0};
ASSERT_NO_THROW(solver.performMatrixVectorMultiplication(false, A, x, nullptr, 1));
ASSERT_LT(std::abs(x[0] - 0.5), storm::settings::Settings::getInstance()->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
ASSERT_LT(std::abs(x[0] - 0.5), storm::settings::SettingsManager::getInstance()->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
x = {0, 1, 0};
ASSERT_NO_THROW(solver.performMatrixVectorMultiplication(false, A, x, nullptr, 20));
ASSERT_LT(std::abs(x[0] - 0.9238082658), storm::settings::Settings::getInstance()->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
ASSERT_LT(std::abs(x[0] - 0.9238082658), storm::settings::SettingsManager::getInstance()->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
}

8
test/functional/solver/NativeLinearEquationSolverTest.cpp

@ -27,9 +27,9 @@ TEST(NativeLinearEquationSolver, SolveWithStandardOptions) {
storm::solver::NativeLinearEquationSolver<double> solver;
ASSERT_NO_THROW(solver.solveEquationSystem(A, x, b));
ASSERT_LT(std::abs(x[0] - 1), storm::settings::Settings::getInstance()->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
ASSERT_LT(std::abs(x[1] - 3), storm::settings::Settings::getInstance()->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
ASSERT_LT(std::abs(x[2] - (-1)), storm::settings::Settings::getInstance()->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
ASSERT_LT(std::abs(x[0] - 1), storm::settings::SettingsManager::getInstance()->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
ASSERT_LT(std::abs(x[1] - 3), storm::settings::SettingsManager::getInstance()->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
ASSERT_LT(std::abs(x[2] - (-1)), storm::settings::SettingsManager::getInstance()->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
}
TEST(NativeLinearEquationSolver, MatrixVectorMultplication) {
@ -52,5 +52,5 @@ TEST(NativeLinearEquationSolver, MatrixVectorMultplication) {
storm::solver::NativeLinearEquationSolver<double> solver;
ASSERT_NO_THROW(solver.performMatrixVectorMultiplication(A, x, nullptr, 4));
ASSERT_LT(std::abs(x[0] - 1), storm::settings::Settings::getInstance()->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
ASSERT_LT(std::abs(x[0] - 1), storm::settings::SettingsManager::getInstance()->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
}

14
test/functional/solver/NativeNondeterministicLinearEquationSolverTest.cpp

@ -17,10 +17,10 @@ TEST(NativeNondeterministicLinearEquationSolver, SolveWithStandardOptions) {
storm::solver::NativeNondeterministicLinearEquationSolver<double> solver;
ASSERT_NO_THROW(solver.solveEquationSystem(true, A, x, b));
ASSERT_LT(std::abs(x[0] - 0.5), storm::settings::Settings::getInstance()->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
ASSERT_LT(std::abs(x[0] - 0.5), storm::settings::SettingsManager::getInstance()->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
ASSERT_NO_THROW(solver.solveEquationSystem(false, A, x, b));
ASSERT_LT(std::abs(x[0] - 0.989991), storm::settings::Settings::getInstance()->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
ASSERT_LT(std::abs(x[0] - 0.989991), storm::settings::SettingsManager::getInstance()->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
}
TEST(NativeNondeterministicLinearEquationSolver, MatrixVectorMultiplication) {
@ -45,21 +45,21 @@ TEST(NativeNondeterministicLinearEquationSolver, MatrixVectorMultiplication) {
storm::solver::NativeNondeterministicLinearEquationSolver<double> solver;
ASSERT_NO_THROW(solver.performMatrixVectorMultiplication(true, A, x, nullptr, 1));
ASSERT_LT(std::abs(x[0] - 0.099), storm::settings::Settings::getInstance()->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
ASSERT_LT(std::abs(x[0] - 0.099), storm::settings::SettingsManager::getInstance()->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
x = {0, 1, 0};
ASSERT_NO_THROW(solver.performMatrixVectorMultiplication(true, A, x, nullptr, 2));
ASSERT_LT(std::abs(x[0] - 0.1881), storm::settings::Settings::getInstance()->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
ASSERT_LT(std::abs(x[0] - 0.1881), storm::settings::SettingsManager::getInstance()->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
x = {0, 1, 0};
ASSERT_NO_THROW(solver.performMatrixVectorMultiplication(true, A, x, nullptr, 20));
ASSERT_LT(std::abs(x[0] - 0.5), storm::settings::Settings::getInstance()->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
ASSERT_LT(std::abs(x[0] - 0.5), storm::settings::SettingsManager::getInstance()->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
x = {0, 1, 0};
ASSERT_NO_THROW(solver.performMatrixVectorMultiplication(false, A, x, nullptr, 1));
ASSERT_LT(std::abs(x[0] - 0.5), storm::settings::Settings::getInstance()->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
ASSERT_LT(std::abs(x[0] - 0.5), storm::settings::SettingsManager::getInstance()->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
x = {0, 1, 0};
ASSERT_NO_THROW(solver.performMatrixVectorMultiplication(false, A, x, nullptr, 20));
ASSERT_LT(std::abs(x[0] - 0.9238082658), storm::settings::Settings::getInstance()->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
ASSERT_LT(std::abs(x[0] - 0.9238082658), storm::settings::SettingsManager::getInstance()->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
}

8
test/functional/storm-functional-tests.cpp

@ -34,9 +34,9 @@ void setUpLogging() {
*/
void createEmptyOptions() {
const char* newArgv[] = {"storm-functional-tests"};
storm::settings::Settings* s = storm::settings::Settings::getInstance();
storm::settings::SettingsManager* s = storm::settings::SettingsManager::getInstance();
try {
storm::settings::Settings::parse(1, newArgv);
storm::settings::SettingsManager::parse(1, newArgv);
} catch (storm::exceptions::OptionParserException& e) {
std::cout << "Could not recover from settings error: " << e.what() << "." << std::endl;
std::cout << std::endl << s->getHelpText();
@ -51,10 +51,10 @@ int main(int argc, char* argv[]) {
testing::InitGoogleTest(&argc, argv);
// now all Google Test Options have been removed
storm::settings::Settings* instance = storm::settings::Settings::getInstance();
storm::settings::SettingsManager* instance = storm::settings::SettingsManager::getInstance();
try {
storm::settings::Settings::parse(argc, argv);
storm::settings::SettingsManager::parse(argc, argv);
} catch (storm::exceptions::OptionParserException& e) {
std::cout << "Could not recover from settings error: " << e.what() << "." << std::endl;
std::cout << std::endl << instance->getHelpText();

4
test/performance/modelchecker/GmmxxDtmcPrctModelCheckerTest.cpp

@ -7,7 +7,7 @@
#include "src/parser/AutoParser.h"
TEST(GmmxxDtmcPrctlModelCheckerTest, Crowds) {
storm::settings::Settings* s = storm::settings::Settings::getInstance();
storm::settings::SettingsManager* s = storm::settings::SettingsManager::getInstance();
storm::settings::InternalOptionMemento deadlockOption("fixDeadlocks", true);
ASSERT_TRUE(s->isSet("fixDeadlocks"));
std::shared_ptr<storm::models::AbstractModel<double>> abstractModel = storm::parser::AutoParser::parseModel(STORM_CPP_BASE_PATH "/examples/dtmc/crowds/crowds20_5.tra", STORM_CPP_BASE_PATH "/examples/dtmc/crowds/crowds20_5.lab", "", "");
@ -51,7 +51,7 @@ TEST(GmmxxDtmcPrctlModelCheckerTest, Crowds) {
TEST(GmmxxDtmcPrctlModelCheckerTest, SynchronousLeader) {
storm::settings::Settings* s = storm::settings::Settings::getInstance();
storm::settings::SettingsManager* s = storm::settings::SettingsManager::getInstance();
storm::settings::InternalOptionMemento deadlockOption("fixDeadlocks", true);
ASSERT_TRUE(s->isSet("fixDeadlocks"));
std::shared_ptr<storm::models::AbstractModel<double>> abstractModel = storm::parser::AutoParser::parseModel(STORM_CPP_BASE_PATH "/examples/dtmc/synchronous_leader/leader6_8.tra", STORM_CPP_BASE_PATH "/examples/dtmc/synchronous_leader/leader6_8.lab", "", STORM_CPP_BASE_PATH "/examples/dtmc/synchronous_leader/leader6_8.pick.trans.rew");

4
test/performance/modelchecker/SparseMdpPrctlModelCheckerTest.cpp

@ -7,7 +7,7 @@
#include "src/parser/AutoParser.h"
TEST(SparseMdpPrctlModelCheckerTest, AsynchronousLeader) {
storm::settings::Settings* s = storm::settings::Settings::getInstance();
storm::settings::SettingsManager* s = storm::settings::SettingsManager::getInstance();
std::shared_ptr<storm::models::AbstractModel<double>> abstractModel = storm::parser::AutoParser::parseModel(STORM_CPP_BASE_PATH "/examples/mdp/asynchronous_leader/leader7.tra", STORM_CPP_BASE_PATH "/examples/mdp/asynchronous_leader/leader7.lab", "", STORM_CPP_BASE_PATH "/examples/mdp/asynchronous_leader/leader7.trans.rew");
ASSERT_EQ(abstractModel->getType(), storm::models::MDP);
@ -54,7 +54,7 @@ TEST(SparseMdpPrctlModelCheckerTest, AsynchronousLeader) {
}
TEST(SparseMdpPrctlModelCheckerTest, Consensus) {
storm::settings::Settings* s = storm::settings::Settings::getInstance();
storm::settings::SettingsManager* s = storm::settings::SettingsManager::getInstance();
// Increase the maximal number of iterations, because the solver does not converge otherwise.
// This is done in the main cpp unit

4
test/performance/storm-performance-tests.cpp

@ -34,9 +34,9 @@ void setUpLogging() {
*/
void createEmptyOptions() {
const char* newArgv[] = {"storm-performance-tests", "--maxiter", "20000"};
storm::settings::Settings* s = storm::settings::Settings::getInstance();
storm::settings::SettingsManager* s = storm::settings::SettingsManager::getInstance();
try {
storm::settings::Settings::parse(3, newArgv);
storm::settings::SettingsManager::parse(3, newArgv);
} catch (storm::exceptions::OptionParserException& e) {
std::cout << "Could not recover from settings error: " << e.what() << "." << std::endl;
std::cout << std::endl << s->getHelpText();

Loading…
Cancel
Save