Browse Source

Added all options from StoRM

Rewrote all calls to the Settings instance with the new Syntax
Implemented new ArgumentValidators.h


Former-commit-id: b4ab63f8f2
tempestpy_adaptions
PBerger 12 years ago
parent
commit
e69c9f1962
  1. 2
      CMakeLists.txt
  2. 11
      src/adapters/ExplicitModelAdapter.cpp
  3. 7
      src/modelchecker/prctl/EigenDtmcPrctlModelChecker.h
  4. 8
      src/modelchecker/prctl/SparseMdpPrctlModelChecker.h
  5. 8
      src/modelchecker/prctl/TopologicalValueIterationMdpPrctlModelChecker.h
  6. 6
      src/models/Ctmdp.h
  7. 6
      src/models/Dtmc.h
  8. 6
      src/models/Mdp.h
  9. 6
      src/parser/DeterministicSparseTransitionParser.cpp
  10. 6
      src/parser/NondeterministicSparseTransitionParser.cpp
  11. 2
      src/settings/Argument.h
  12. 38
      src/settings/ArgumentBuilder.h
  13. 125
      src/settings/ArgumentValidators.h
  14. 5
      src/settings/Settings.cpp
  15. 1
      src/settings/Settings.h
  16. 10
      src/solver/AbstractNondeterministicLinearEquationSolver.h
  17. 28
      src/solver/GmmxxLinearEquationSolver.cpp
  18. 40
      src/solver/GmmxxLinearEquationSolver.h
  19. 8
      src/solver/GmmxxNondeterministicLinearEquationSolver.h
  20. 52
      src/storm.cpp
  21. 34
      test/functional/modelchecker/EigenDtmcPrctlModelCheckerTest.cpp
  22. 34
      test/functional/modelchecker/GmmxxDtmcPrctlModelCheckerTest.cpp
  23. 40
      test/functional/modelchecker/GmmxxMdpPrctlModelCheckerTest.cpp
  24. 40
      test/functional/modelchecker/SparseMdpPrctlModelCheckerTest.cpp
  25. 22
      test/performance/modelchecker/GmmxxDtmcPrctModelCheckerTest.cpp
  26. 34
      test/performance/modelchecker/GmmxxMdpPrctModelCheckerTest.cpp
  27. 34
      test/performance/modelchecker/SparseMdpPrctlModelCheckerTest.cpp

2
CMakeLists.txt

@ -149,6 +149,7 @@ file(GLOB_RECURSE STORM_MODELS_FILES ${PROJECT_SOURCE_DIR}/src/models/*.h ${PROJ
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_RECURSE STORM_SOLVER_FILES ${PROJECT_SOURCE_DIR}/src/solver/*.h ${PROJECT_SOURCE_DIR}/src/solver/*.cpp)
file(GLOB_RECURSE STORM_STORAGE_FILES ${PROJECT_SOURCE_DIR}/src/storage/*.h ${PROJECT_SOURCE_DIR}/src/storage/*.cpp)
file(GLOB_RECURSE STORM_UTILITY_FILES ${PROJECT_SOURCE_DIR}/src/utility/*.h ${PROJECT_SOURCE_DIR}/src/utility/*.cpp)
file(GLOB STORM_IR_FILES ${PROJECT_SOURCE_DIR}/src/ir/*.h ${PROJECT_SOURCE_DIR}/src/ir/*.cpp)
@ -173,6 +174,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(solver FILES ${STORM_SOLVER_FILES})
source_group(storage FILES ${STORM_STORAGE_FILES})
source_group(utility FILES ${STORM_UTILITY_FILES})
source_group(ir FILES ${STORM_IR_FILES})

11
src/adapters/ExplicitModelAdapter.cpp

@ -1,7 +1,7 @@
#include "src/adapters/ExplicitModelAdapter.h"
#include "src/storage/SparseMatrix.h"
#include "src/utility/Settings.h"
#include "src/settings/Settings.h"
#include "src/exceptions/WrongFormatException.h"
#include "src/ir/Program.h"
@ -32,8 +32,8 @@ namespace adapters {
allStates(), stateToIndexMap(), numberOfTransitions(0), numberOfChoices(0), transitionMap() {
// Get variables from program.
this->initializeVariables();
storm::settings::Settings* s = storm::settings::instance();
this->precision = s->get<double>("precision");
storm::settings::Settings* s = storm::settings::Settings::getInstance();
this->precision = s->getOptionByLongName("precision").getArgument(0).getValueAsDouble();
}
ExplicitModelAdapter::~ExplicitModelAdapter() {
@ -214,8 +214,7 @@ namespace adapters {
res->push_back(commands);
}
// Sort the result in the vague hope that having small lists at the beginning will speed up the expanding.
// This is how lambdas may look like in C++...
res->sort([](const std::list<storm::ir::Command>& a, const std::list<storm::ir::Command>& b){ return a.size() < b.size(); });
res->sort([] (const std::list<storm::ir::Command>& a, const std::list<storm::ir::Command>& b) -> bool { return a.size() < b.size(); });
return res;
}
@ -540,7 +539,7 @@ namespace adapters {
this->numberOfChoices += this->transitionMap[curIndex].size();
if (this->transitionMap[curIndex].size() == 0) {
// This is a deadlock state.
if (storm::settings::instance()->isSet("fix-deadlocks")) {
if (storm::settings::Settings::getInstance()->isSet("fixDeadlocks")) {
this->numberOfTransitions++;
this->numberOfChoices++;
this->transitionMap[curIndex].emplace_back();

7
src/modelchecker/prctl/EigenDtmcPrctlModelChecker.h

@ -86,7 +86,7 @@ private:
*/
virtual void solveEquationSystem(storm::storage::SparseMatrix<Type> const& matrix, std::vector<Type>** vector, std::vector<Type>& b) const {
// Get the settings object to customize linear solving.
storm::settings::Settings* s = storm::settings::instance();
storm::settings::Settings* s = storm::settings::Settings::getInstance();
// Transform the submatric matrix to the eigen format to use its solvers
Eigen::SparseMatrix<Type, 1, int_fast32_t>* eigenMatrix = storm::adapters::EigenAdapter::toEigenSparseMatrix<Type>(matrix);
@ -97,8 +97,9 @@ private:
// decomposition failed
LOG4CPLUS_ERROR(logger, "Decomposition of matrix failed!");
}
solver.setMaxIterations(s->get<unsigned>("maxiter"));
solver.setTolerance(s->get<double>("precision"));
uint_fast64_t maxIterations = s->getOptionByLongName("maxIterations").getArgument(0).getValueAsUnsignedInteger();
solver.setMaxIterations(static_cast<int>(maxIterations));
solver.setTolerance(s->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
std::cout << matrix.toString(nullptr) << std::endl;
std::cout << **vector << std::endl;

8
src/modelchecker/prctl/SparseMdpPrctlModelChecker.h

@ -18,7 +18,7 @@
#include "src/models/Mdp.h"
#include "src/utility/vector.h"
#include "src/utility/graph.h"
#include "src/utility/Settings.h"
#include "src/settings/Settings.h"
namespace storm {
namespace modelchecker {
@ -648,9 +648,9 @@ namespace storm {
storm::storage::BitVector const& maybeStates,
std::vector<uint_fast64_t>* guessedScheduler = nullptr,
std::pair<std::vector<Type>, std::vector<Type>>* distancePairs = nullptr) const {
storm::settings::Settings* s = storm::settings::instance();
double precision = s->get<double>("precision");
if (s->get<bool>("use-heuristic-presolve")) {
storm::settings::Settings* s = storm::settings::Settings::getInstance();
double precision = s->getOptionByLongName("precision").getArgument(0).getValueAsDouble();
if (s->isSet("useHeuristicPresolve")) {
// Compute both the most probable paths to target states as well as the most probable path to non-target states.
// Note that here target state means a state does not *not* satisfy the property that is to be reached
// if we want to minimize the reachability probability.

8
src/modelchecker/prctl/TopologicalValueIterationMdpPrctlModelChecker.h

@ -60,12 +60,12 @@ private:
*/
void solveEquationSystem(storm::storage::SparseMatrix<Type> const& matrix, std::vector<Type>& x, std::vector<Type> const& b, std::vector<uint_fast64_t> const& nondeterministicChoiceIndices) const {
// Get the settings object to customize solving.
storm::settings::Settings* s = storm::settings::instance();
storm::settings::Settings* s = storm::settings::Settings::getInstance();
// Get relevant user-defined settings for solving the equations.
double precision = s->get<double>("precision");
unsigned maxIterations = s->get<unsigned>("maxiter");
bool relative = s->get<bool>("relative");
double precision = s->getOptionByLongName("precision").getArgument(0).getValueAsDouble();
uint_fast64_t maxIterations = s->getOptionByLongName("maxIterations").getArgument(0).getValueAsUnsignedInteger();
bool relative = s->getOptionByLongName("relative").getArgument(0).getValueAsBoolean();
// Now, we need to determine the SCCs of the MDP and a topological sort.
std::vector<std::vector<uint_fast64_t>> stronglyConnectedComponents = storm::utility::graph::performSccDecomposition(this->getModel(), stronglyConnectedComponents, stronglyConnectedComponentsDependencyGraph);

6
src/models/Ctmdp.h

@ -14,7 +14,7 @@
#include "AtomicPropositionsLabeling.h"
#include "AbstractNondeterministicModel.h"
#include "src/storage/SparseMatrix.h"
#include "src/utility/Settings.h"
#include "src/settings/Settings.h"
namespace storm {
@ -121,8 +121,8 @@ private:
*/
bool checkValidityOfProbabilityMatrix() {
// Get the settings object to customize linear solving.
storm::settings::Settings* s = storm::settings::instance();
double precision = s->get<double>("precision");
storm::settings::Settings* s = storm::settings::Settings::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);
if (sum == 0) continue;

6
src/models/Dtmc.h

@ -17,7 +17,7 @@
#include "AtomicPropositionsLabeling.h"
#include "src/storage/SparseMatrix.h"
#include "src/exceptions/InvalidArgumentException.h"
#include "src/utility/Settings.h"
#include "src/settings/Settings.h"
namespace storm {
@ -126,8 +126,8 @@ private:
*/
bool checkValidityOfProbabilityMatrix() {
// Get the settings object to customize linear solving.
storm::settings::Settings* s = storm::settings::instance();
double precision = s->get<double>("precision");
storm::settings::Settings* s = storm::settings::Settings::getInstance();
double precision = s->getOptionByLongName("precision").getArgument(0).getValueAsDouble();
if (this->getTransitionMatrix().getRowCount() != this->getTransitionMatrix().getColumnCount()) {
// not square

6
src/models/Mdp.h

@ -15,7 +15,7 @@
#include "AtomicPropositionsLabeling.h"
#include "src/storage/SparseMatrix.h"
#include "src/utility/Settings.h"
#include "src/settings/Settings.h"
#include "src/models/AbstractNondeterministicModel.h"
namespace storm {
@ -122,8 +122,8 @@ private:
*/
bool checkValidityOfProbabilityMatrix() {
// Get the settings object to customize linear solving.
storm::settings::Settings* s = storm::settings::instance();
double precision = s->get<double>("precision");
storm::settings::Settings* s = storm::settings::Settings::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);
if (sum == 0) continue;

6
src/parser/DeterministicSparseTransitionParser.cpp

@ -23,7 +23,7 @@
#include "src/exceptions/FileIoException.h"
#include "src/exceptions/WrongFormatException.h"
#include "boost/integer/integer_mask.hpp"
#include "src/utility/Settings.h"
#include "src/settings/Settings.h"
#include "log4cplus/logger.h"
#include "log4cplus/loggingmacros.h"
@ -210,7 +210,7 @@ storm::storage::SparseMatrix<double> DeterministicSparseTransitionParser(std::st
int_fast64_t row, lastRow = -1, col;
double val;
bool fixDeadlocks = storm::settings::instance()->isSet("fix-deadlocks");
bool fixDeadlocks = storm::settings::Settings::getInstance()->isSet("fixDeadlocks");
bool hadDeadlocks = false;
bool rowHadDiagonalEntry = false;
@ -278,7 +278,7 @@ storm::storage::SparseMatrix<double> DeterministicSparseTransitionParser(std::st
}
}
if (!fixDeadlocks && hadDeadlocks) throw storm::exceptions::WrongFormatException() << "Some of the nodes had deadlocks. You can use --fix-deadlocks to insert self-loops on the fly.";
if (!fixDeadlocks && hadDeadlocks) throw storm::exceptions::WrongFormatException() << "Some of the nodes had deadlocks. You can use --fixDeadlocks to insert self-loops on the fly.";
/*
* Finalize Matrix.

6
src/parser/NondeterministicSparseTransitionParser.cpp

@ -21,7 +21,7 @@
#include <utility>
#include <string>
#include "src/utility/Settings.h"
#include "src/settings/Settings.h"
#include "src/exceptions/FileIoException.h"
#include "src/exceptions/WrongFormatException.h"
#include "boost/integer/integer_mask.hpp"
@ -283,7 +283,7 @@ NondeterministicSparseTransitionParserResult_t NondeterministicSparseTransitionP
int_fast64_t source, target, lastsource = -1, choice, lastchoice = -1;
uint_fast64_t curRow = -1;
double val;
bool fixDeadlocks = storm::settings::instance()->isSet("fix-deadlocks");
bool fixDeadlocks = storm::settings::Settings::getInstance()->isSet("fixDeadlocks");
bool hadDeadlocks = false;
/*
@ -383,7 +383,7 @@ NondeterministicSparseTransitionParserResult_t NondeterministicSparseTransitionP
rowMapping.at(node) = curRow + 1;
}
if (!fixDeadlocks && hadDeadlocks && !isRewardFile) throw storm::exceptions::WrongFormatException() << "Some of the nodes had deadlocks. You can use --fix-deadlocks to insert self-loops on the fly.";
if (!fixDeadlocks && hadDeadlocks && !isRewardFile) throw storm::exceptions::WrongFormatException() << "Some of the nodes had deadlocks. You can use --fixDeadlocks to insert self-loops on the fly.";
/*
* Finalize matrix.

2
src/settings/Argument.h

@ -27,6 +27,8 @@ namespace storm {
public:
typedef std::function<bool (const T, std::string&)> userValidationFunction_t;
typedef T argumentType_t;
/*
T argumentValue;
ArgumentType argumentType;

38
src/settings/ArgumentBuilder.h

@ -15,6 +15,7 @@
#include "ArgumentTypeInferationHelper.h"
#include "ArgumentBase.h"
#include "Argument.h"
#include "ArgumentValidators.h"
#include "src/exceptions/IllegalFunctionCallException.h"
#include "src/exceptions/IllegalArgumentTypeException.h"
@ -26,43 +27,6 @@ namespace storm {
public:
~ArgumentBuilder() {}
template<class T>
static std::function<bool (T const, std::string&)> rangeValidatorIncluding(T const lowerBound, T const upperBound) {
return std::bind([](T const lowerBound, T const upperBound, T const value, std::string& errorMessageTarget) -> bool {
bool lowerBoundCondition = (lowerBound <= value);
bool upperBoundCondition = (value <= upperBound);
if (!lowerBoundCondition) {
std::ostringstream stream;
stream << " Lower Bound Condition not met: " << lowerBound << " is not <= " << value;
errorMessageTarget.append(stream.str());
}
if (!upperBoundCondition) {
std::ostringstream stream;
stream << " Upper Bound Condition not met: " << value << " is not <= " << upperBound;
errorMessageTarget.append(stream.str());
}
return (lowerBoundCondition && upperBoundCondition);
}, lowerBound, upperBound, std::placeholders::_1, std::placeholders::_2);
}
template<class T>
static std::function<bool (T const, std::string&)> rangeValidatorExcluding(T const lowerBound, T const upperBound) {
return std::bind([](T const lowerBound, T const upperBound, T const value, std::string& errorMessageTarget) -> bool {
bool lowerBoundCondition = (lowerBound < value);
bool upperBoundCondition = (value < upperBound);
if (!lowerBoundCondition) {
std::ostringstream stream;
stream << " Lower Bound Condition not met: " << lowerBound << " is not < " << value;
errorMessageTarget.append(stream.str());
}
if (!upperBoundCondition) {
std::ostringstream stream;
stream << " Upper Bound Condition not met: " << value << " is not < " << upperBound;
errorMessageTarget.append(stream.str());
}
return (lowerBoundCondition && upperBoundCondition);
}, lowerBound, upperBound, std::placeholders::_1, std::placeholders::_2);
}
/*
Preparation Functions for all ArgumentType's

125
src/settings/ArgumentValidators.h

@ -0,0 +1,125 @@
#ifndef STORM_SETTINGS_ARGUMENTVALIDATORS_H_
#define STORM_SETTINGS_ARGUMENTVALIDATORS_H_
#include <iostream>
#include <ostream>
#include <fstream>
#include <list>
#include <utility>
#include <functional>
#include <vector>
#include <memory>
#include <string>
#include "Argument.h"
namespace storm {
namespace settings {
class ArgumentValidators {
public:
// Integer - int_fast64_t
static std::function<bool (int_fast64_t const, std::string&)> integerRangeValidatorIncluding(int_fast64_t const lowerBound, int_fast64_t const upperBound) {
return rangeValidatorIncluding<int_fast64_t>(lowerBound, upperBound);
}
static std::function<bool (int_fast64_t const, std::string&)> integerRangeValidatorExcluding(int_fast64_t const lowerBound, int_fast64_t const upperBound) {
return rangeValidatorExcluding<int_fast64_t>(lowerBound, upperBound);
}
// UnsignedInteger - uint_fast64_t
static std::function<bool (uint_fast64_t const, std::string&)> unsignedIntegerRangeValidatorIncluding(uint_fast64_t const lowerBound, uint_fast64_t const upperBound) {
return rangeValidatorIncluding<uint_fast64_t>(lowerBound, upperBound);
}
static std::function<bool (uint_fast64_t const, std::string&)> unsignedIntegerRangeValidatorExcluding(uint_fast64_t const lowerBound, uint_fast64_t const upperBound) {
return rangeValidatorExcluding<uint_fast64_t>(lowerBound, upperBound);
}
// Double - double
static std::function<bool (double const, std::string&)> doubleRangeValidatorIncluding(double const lowerBound, double const upperBound) {
return rangeValidatorIncluding<double>(lowerBound, upperBound);
}
static std::function<bool (double const, std::string&)> doubleRangeValidatorExcluding(double const lowerBound, double const upperBound) {
return rangeValidatorExcluding<double>(lowerBound, upperBound);
}
static std::function<bool (std::string const, std::string&)> existingReadableFileValidator() {
return [] (std::string const fileName, std::string& errorMessageTarget) -> bool {
std::ifstream targetFile(fileName);
bool isFileGood = targetFile.good();
if (!isFileGood) {
std::ostringstream stream;
stream << "Given file does not exist or is not readable by this process: \"" << fileName << "\"" << std::endl;
errorMessageTarget.append(stream.str());
}
return isFileGood;
};
}
static std::function<bool (std::string const, std::string&)> stringInListValidator(std::vector<std::string> list) {
return [list] (std::string const inputString, std::string& errorMessageTarget) -> bool {
bool containsElement = false;
std::string const lowerInputString = storm::utility::StringHelper::stringToLower(inputString);
for (auto it = list.cbegin(); it != list.cend(); ++it) {
if (storm::utility::StringHelper::stringToLower(*it).compare(lowerInputString) == 0) {
return true;
}
}
std::ostringstream stream;
stream << "The given Input \"" << inputString << "\" is not in the list of valid Items (";
bool first = true;
for (auto it = list.cbegin(); it != list.cend(); ++it) {
if (!first) {
stream << ", ";
}
stream << *it;
first = false;
}
stream << ")" << std::endl;
errorMessageTarget.append(stream.str());
return false;
};
}
private:
template<typename T>
static std::function<bool (T const, std::string&)> rangeValidatorIncluding(T const lowerBound, T const upperBound) {
return std::bind([](T const lowerBound, T const upperBound, T const value, std::string& errorMessageTarget) -> bool {
bool lowerBoundCondition = (lowerBound <= value);
bool upperBoundCondition = (value <= upperBound);
if (!lowerBoundCondition) {
std::ostringstream stream;
stream << " Lower Bound Condition not met: " << lowerBound << " is not <= " << value;
errorMessageTarget.append(stream.str());
}
if (!upperBoundCondition) {
std::ostringstream stream;
stream << " Upper Bound Condition not met: " << value << " is not <= " << upperBound;
errorMessageTarget.append(stream.str());
}
return (lowerBoundCondition && upperBoundCondition);
}, lowerBound, upperBound, std::placeholders::_1, std::placeholders::_2);
}
template<typename T>
static std::function<bool (T const, std::string&)> rangeValidatorExcluding(T const lowerBound, T const upperBound) {
return std::bind([](T const lowerBound, T const upperBound, T const value, std::string& errorMessageTarget) -> bool {
bool lowerBoundCondition = (lowerBound < value);
bool upperBoundCondition = (value < upperBound);
if (!lowerBoundCondition) {
std::ostringstream stream;
stream << " Lower Bound Condition not met: " << lowerBound << " is not < " << value;
errorMessageTarget.append(stream.str());
}
if (!upperBoundCondition) {
std::ostringstream stream;
stream << " Upper Bound Condition not met: " << value << " is not < " << upperBound;
errorMessageTarget.append(stream.str());
}
return (lowerBoundCondition && upperBoundCondition);
}, lowerBound, upperBound, std::placeholders::_1, std::placeholders::_2);
}
};
}
}
#endif // STORM_SETTINGS_ARGUMENTVALIDATORS_H_

5
src/settings/Settings.cpp

@ -211,7 +211,10 @@ storm::settings::Settings& storm::settings::Settings::addOption(Option* option)
// Copy Shared_ptr
this->options.insert(std::make_pair(lowerLongName, std::shared_ptr<Option>(optionPtr)));
this->optionPointers.push_back(std::shared_ptr<Option>(optionPtr));
this->shortNames.insert(std::make_pair(lowerShortName, lowerLongName));
// Ignore Options with empty shortName
if (!lowerShortName.empty()) {
this->shortNames.insert(std::make_pair(lowerShortName, lowerLongName));
}
} else {
// This will fail if the shortNames are not identical, so no additional checks here.
longNameIterator->second.get()->unify(*option);

1
src/settings/Settings.h

@ -13,7 +13,6 @@
#include "src/settings/Option.h"
#include "src/settings/OptionBuilder.h"
#include "src/settings/OptionsAccumulator.h"
#include "src/settings/ArgumentBase.h"
#include "src/settings/Argument.h"
#include "src/settings/ArgumentBuilder.h"

10
src/solver/AbstractNondeterministicLinearEquationSolver.h

@ -3,7 +3,7 @@
#include "src/storage/SparseMatrix.h"
#include "src/utility/vector.h"
#include "src/utility/Settings.h"
#include "src/settings/Settings.h"
#include <vector>
@ -73,12 +73,12 @@ namespace storm {
LOG4CPLUS_INFO(logger, "Starting iterative solver.");
// Get the settings object to customize solving.
storm::settings::Settings* s = storm::settings::instance();
storm::settings::Settings* s = storm::settings::Settings::getInstance();
// Get relevant user-defined settings for solving the equations.
double precision = s->get<double>("precision");
unsigned maxIterations = s->get<unsigned>("maxiter");
bool relative = s->get<bool>("relative");
double precision = s->getOptionByLongName("precision").getArgument(0).getValueAsDouble();
uint_fast64_t maxIterations = s->getOptionByLongName("maxIterations").getArgument(0).getValueAsUnsignedInteger();
bool relative = s->getOptionByLongName("relative").getArgument(0).getValueAsBoolean();
// Set up the environment for the power method.
std::vector<Type> multiplyResult(A.getRowCount());

28
src/solver/GmmxxLinearEquationSolver.cpp

@ -0,0 +1,28 @@
#include "GmmxxLinearEquationSolver.h"
#include <vector>
#include <string>
bool optionsRegistered = storm::settings::Settings::registerNewModule([] (storm::settings::Settings* instance) -> bool {
std::vector<std::string> methods;
methods.push_back("bicgstab");
methods.push_back("qmr");
methods.push_back("lscg");
methods.push_back("gmres");
methods.push_back("jacobi");
std::vector<std::string> preconditioner;
preconditioner.push_back("ilu");
preconditioner.push_back("diagonal");
preconditioner.push_back("ildlt");
preconditioner.push_back("none");
instance->addOption(storm::settings::OptionBuilder("GmmxxLinearEquationSolver", "leMethod", "", "The Method used in Linear Equation Solving. Available are: bicgstab, qmr, lscg, gmres, jacobi").addArgument(storm::settings::ArgumentBuilder::createStringArgument("leMethodName", "The Name of the Method to use").addValidationFunctionString(storm::settings::ArgumentValidators::stringInListValidator(methods)).setDefaultValueString("gmres").build()).build());
instance->addOption(storm::settings::OptionBuilder("GmmxxLinearEquationSolver", "preconditioner", "", "The Preconditioning Technique used in Linear Equation Solving. Available are: ilu, diagonal, ildlt, none").addArgument(storm::settings::ArgumentBuilder::createStringArgument("preconditionerName", "The Name of the Preconditioning Method").addValidationFunctionString(storm::settings::ArgumentValidators::stringInListValidator(preconditioner)).setDefaultValueString("ilu").build()).build());
instance->addOption(storm::settings::OptionBuilder("GmmxxLinearEquationSolver", "maxIterations", "", "Maximum number of Iterations to perform while solving a linear equation system").addArgument(storm::settings::ArgumentBuilder::createUnsignedIntegerArgument("iterationCount", "Max. Iteration Count").setDefaultValueUnsignedInteger(10000).build()).build());
instance->addOption(storm::settings::OptionBuilder("GmmxxLinearEquationSolver", "precision", "", "Precision used for iterative solving of linear equation systems").addArgument(storm::settings::ArgumentBuilder::createDoubleArgument("precisionValue", "Precision").setDefaultValueDouble(1e-6).addValidationFunctionDouble(storm::settings::ArgumentValidators::doubleRangeValidatorExcluding(0.0, 1000000.0)).build()).build());
instance->addOption(storm::settings::OptionBuilder("GmmxxLinearEquationSolver", "relative", "", "Whether the relative or the absolute error is considered for deciding convergence via a given precision").addArgument(storm::settings::ArgumentBuilder::createBooleanArgument("useRelative", "relative or absolute comparison").setDefaultValueBoolean(true).build()).build());
return true;
});

40
src/solver/GmmxxLinearEquationSolver.h

@ -4,7 +4,7 @@
#include "AbstractLinearEquationSolver.h"
#include "src/adapters/GmmxxAdapter.h"
#include "src/utility/ConstTemplates.h"
#include "src/utility/Settings.h"
#include "src/settings/Settings.h"
#include "src/utility/vector.h"
#include "gmm/gmm_matrix.h"
@ -14,7 +14,7 @@
namespace storm {
namespace solver {
template<class Type>
class GmmxxLinearEquationSolver : public AbstractLinearEquationSolver<Type> {
public:
@ -25,16 +25,22 @@ namespace storm {
virtual void solveEquationSystem(storm::storage::SparseMatrix<Type> const& A, std::vector<Type>& x, std::vector<Type> const& b) const {
// Get the settings object to customize linear solving.
storm::settings::Settings* s = storm::settings::instance();
storm::settings::Settings* s = storm::settings::Settings::getInstance();
// Prepare an iteration object that determines the accuracy, maximum number of iterations
// and the like.
gmm::iteration iter(s->get<double>("precision"), 0, s->get<unsigned>("maxiter"));
uint_fast64_t maxIterations = s->getOptionByLongName("maxIterations").getArgument(0).getValueAsUnsignedInteger();
gmm::iteration iter(s->getOptionByLongName("precision").getArgument(0).getValueAsDouble(), 0, maxIterations);
// Print some information about the used preconditioner.
const std::string& precond = s->getString("precond");
std::string const precond = s->getOptionByLongName("preconditioner").getArgument(0).getValueAsString();
LOG4CPLUS_INFO(logger, "Starting iterative solver.");
if (s->getString("lemethod") == "jacobi") {
// ALL available solvers must be declared in the cpp File, where the options are registered!
// Dito for the Preconditioners
std::string const chosenLeMethod = s->getOptionByLongName("leMethod").getArgument(0).getValueAsString();
if (chosenLeMethod == "jacobi") {
if (precond != "none") {
LOG4CPLUS_WARN(logger, "Requested preconditioner '" << precond << "', which is unavailable for the Jacobi method. Dropping preconditioner.");
}
@ -51,7 +57,7 @@ namespace storm {
}
// Now do the actual solving.
if (s->getString("lemethod") == "bicgstab") {
if (chosenLeMethod == "bicgstab") {
LOG4CPLUS_INFO(logger, "Using BiCGStab method.");
// Transform the transition probability matrix to the gmm++ format to use its arithmetic.
gmm::csr_matrix<Type>* gmmA = storm::adapters::GmmxxAdapter::toGmmxxSparseMatrix<Type>(A);
@ -72,7 +78,7 @@ namespace storm {
LOG4CPLUS_WARN(logger, "Iterative solver did not converge.");
}
delete gmmA;
} else if (s->getString("lemethod") == "qmr") {
} else if (chosenLeMethod == "qmr") {
LOG4CPLUS_INFO(logger, "Using QMR method.");
// Transform the transition probability matrix to the gmm++ format to use its arithmetic.
gmm::csr_matrix<Type>* gmmA = storm::adapters::GmmxxAdapter::toGmmxxSparseMatrix<Type>(A);
@ -93,7 +99,7 @@ namespace storm {
LOG4CPLUS_WARN(logger, "Iterative solver did not converge.");
}
delete gmmA;
} else if (s->getString("lemethod") == "lscg") {
} else if (chosenLeMethod == "lscg") {
LOG4CPLUS_INFO(logger, "Using LSCG method.");
// Transform the transition probability matrix to the gmm++ format to use its arithmetic.
gmm::csr_matrix<Type>* gmmA = storm::adapters::GmmxxAdapter::toGmmxxSparseMatrix<Type>(A);
@ -110,7 +116,7 @@ namespace storm {
LOG4CPLUS_WARN(logger, "Iterative solver did not converge.");
}
delete gmmA;
} else if (s->getString("lemethod") == "gmres") {
} else if (chosenLeMethod == "gmres") {
LOG4CPLUS_INFO(logger, "Using GMRES method.");
// Transform the transition probability matrix to the gmm++ format to use its arithmetic.
gmm::csr_matrix<Type>* gmmA = storm::adapters::GmmxxAdapter::toGmmxxSparseMatrix<Type>(A);
@ -131,12 +137,12 @@ namespace storm {
LOG4CPLUS_WARN(logger, "Iterative solver did not converge.");
}
delete gmmA;
} else if (s->getString("lemethod") == "jacobi") {
} else if (chosenLeMethod == "jacobi") {
LOG4CPLUS_INFO(logger, "Using Jacobi method.");
uint_fast64_t iterations = solveLinearEquationSystemWithJacobi(A, x, b);
uint_fast64_t maxIterations = s->getOptionByLongName("maxIterations").getArgument(0).getValueAsUnsignedInteger();
// Check if the solver converged and issue a warning otherwise.
if (iterations < s->get<unsigned>("maxiter")) {
if (iterations < maxIterations) {
LOG4CPLUS_INFO(logger, "Iterative solver converged after " << iterations << " iterations.");
} else {
LOG4CPLUS_WARN(logger, "Iterative solver did not converge.");
@ -192,11 +198,11 @@ namespace storm {
*/
uint_fast64_t solveLinearEquationSystemWithJacobi(storm::storage::SparseMatrix<Type> const& A, std::vector<Type>& x, std::vector<Type> const& b) const {
// Get the settings object to customize linear solving.
storm::settings::Settings* s = storm::settings::instance();
storm::settings::Settings* s = storm::settings::Settings::getInstance();
double precision = s->get<double>("precision");
uint_fast64_t maxIterations = s->get<unsigned>("maxiter");
bool relative = s->get<bool>("relative");
double precision = s->getOptionByLongName("precision").getArgument(0).getValueAsDouble();
uint_fast64_t maxIterations = s->getOptionByLongName("maxIterations").getArgument(0).getValueAsUnsignedInteger();
bool relative = s->getOptionByLongName("relative").getArgument(0).getValueAsBoolean();
// Get a Jacobi decomposition of the matrix A.
typename storm::storage::SparseMatrix<Type>::SparseJacobiDecomposition_t jacobiDecomposition = A.getJacobiDecomposition();

8
src/solver/GmmxxNondeterministicLinearEquationSolver.h

@ -49,12 +49,12 @@ namespace storm {
virtual void solveEquationSystem(bool minimize, storm::storage::SparseMatrix<Type> const& A, std::vector<Type>& x, std::vector<Type> const& b, std::vector<uint_fast64_t> const& nondeterministicChoiceIndices) const override {
// Get the settings object to customize solving.
storm::settings::Settings* s = storm::settings::instance();
storm::settings::Settings* s = storm::settings::Settings::getInstance();
// Get relevant user-defined settings for solving the equations.
double precision = s->get<double>("precision");
unsigned maxIterations = s->get<unsigned>("maxiter");
bool relative = s->get<bool>("relative");
double precision = s->getOptionByLongName("precision").getArgument(0).getValueAsDouble();
uint_fast64_t maxIterations = s->getOptionByLongName("maxIterations").getArgument(0).getValueAsUnsignedInteger();
bool relative = s->getOptionByLongName("relative").getArgument(0).getValueAsBoolean();
// Transform the transition probability matrix to the gmm++ format to use its arithmetic.
gmm::csr_matrix<Type>* gmmxxMatrix = storm::adapters::GmmxxAdapter::toGmmxxSparseMatrix<Type>(A);

52
src/storm.cpp

@ -90,6 +90,27 @@ void printUsage() {
#endif
}
bool registerStandardOptions(storm::settings::Settings* settings) {
settings->addOption(storm::settings::OptionBuilder("StoRM Main", "help", "h", "Shows all available Options, Arguments and Descriptions").build());
settings->addOption(storm::settings::OptionBuilder("StoRM Main", "verbose", "v", "Be verbose").build());
settings->addOption(storm::settings::OptionBuilder("StoRM Main", "debug", "", "Be very verbose (intended for debugging)").build());
settings->addOption(storm::settings::OptionBuilder("StoRM Main", "trace", "", "Be extremly verbose (intended for debugging, heavy performance impacts)").build());
settings->addOption(storm::settings::OptionBuilder("StoRM Main", "logfile", "l", "If specified, the log output will also be written to this file").addArgument(storm::settings::ArgumentBuilder::createStringArgument("logFileName", "The path and name of the File to write to").build()).build());
settings->addOption(storm::settings::OptionBuilder("StoRM Main", "configfile", "c", "If specified, this file will be read and parsed for additional configuration settings").addArgument(storm::settings::ArgumentBuilder::createStringArgument("configFileName", "The path and name of the File to read from").addValidationFunctionString(storm::settings::ArgumentValidators::existingReadableFileValidator()).build()).build());
settings->addOption(storm::settings::OptionBuilder("StoRM Main", "explicit", "", "Explicit parsing from Transition- and Labeling Files").addArgument(storm::settings::ArgumentBuilder::createStringArgument("transitionFileName", "The path and name of the File to read the transition system from").addValidationFunctionString(storm::settings::ArgumentValidators::existingReadableFileValidator()).build()).addArgument(storm::settings::ArgumentBuilder::createStringArgument("labelingFileName", "The path and name of the File to read the labeling from").addValidationFunctionString(storm::settings::ArgumentValidators::existingReadableFileValidator).build()).build());
settings->addOption(storm::settings::OptionBuilder("StoRM Main", "symbolic", "", "Parse the given PRISM File").addArgument(storm::settings::ArgumentBuilder::createStringArgument("prismFileName", "The path and name of the File to read the PRISM Model from").addValidationFunctionString(storm::settings::ArgumentValidators::existingReadableFileValidator()).build()).build());
settings->addOption(storm::settings::OptionBuilder("StoRM Main", "prctl", "", "Evaluates the PRCTL Formulas given in the File").addArgument(storm::settings::ArgumentBuilder::createStringArgument("prctlFileName", "The path and name of the File to read PRCTL Formulas from").addValidationFunctionString(storm::settings::ArgumentValidators::existingReadableFileValidator()).build()).build());
settings->addOption(storm::settings::OptionBuilder("StoRM Main", "csl", "", "Evaluates the CSL Formulas given in the File").addArgument(storm::settings::ArgumentBuilder::createStringArgument("cslFileName", "The path and name of the File to read CSL Formulas from").addValidationFunctionString(storm::settings::ArgumentValidators::existingReadableFileValidator()).build()).build());
settings->addOption(storm::settings::OptionBuilder("StoRM Main", "ltl", "", "Evaluates the LTL Formulas given in the File").addArgument(storm::settings::ArgumentBuilder::createStringArgument("ltlFileName", "The path and name of the File to read LTL Formulas from").addValidationFunctionString(storm::settings::ArgumentValidators::existingReadableFileValidator()).build()).build());
settings->addOption(storm::settings::OptionBuilder("StoRM Main", "transitionRewards", "", "If specified, the model will have these transition rewards").addArgument(storm::settings::ArgumentBuilder::createStringArgument("transitionRewardsFileName", "The path and name of the File to read the Transition Rewards from").addValidationFunctionString(storm::settings::ArgumentValidators::existingReadableFileValidator()).setDefaultValueString("").setIsOptional(true).build()).build());
settings->addOption(storm::settings::OptionBuilder("StoRM Main", "stateRewards", "", "If specified, the model will have these state rewards").addArgument(storm::settings::ArgumentBuilder::createStringArgument("stateRewardsFileName", "The path and name of the File to read the State Rewards from").addValidationFunctionString(storm::settings::ArgumentValidators::existingReadableFileValidator()).setDefaultValueString("").setIsOptional(true).build()).build());
settings->addOption(storm::settings::OptionBuilder("StoRM Main", "fixDeadlocks", "", "Insert Self-Loops for States with no outgoing transitions").build());
std::vector<std::string> matrixLibrarys;
matrixLibrarys.push_back("gmm++");
matrixLibrarys.push_back("native");
settings->addOption(storm::settings::OptionBuilder("StoRM Main", "matrixLibrary", "m", "Which matrix library is to be used in numerical solving").addArgument(storm::settings::ArgumentBuilder::createStringArgument("matrixLibraryName", "Name of a buildin Library").addValidationFunctionString(storm::settings::ArgumentValidators::stringInListValidator(matrixLibrarys)).setDefaultValueString("gmm++").build()).build());
settings->addOption(storm::settings::OptionBuilder("StoRM Main", "useHeurisiticPresolve", "", "Sets whether heuristic methods should be applied to get better initial values for value iteration").build());
}
log4cplus::Logger logger;
@ -200,7 +221,8 @@ void cleanUp() {
storm::modelchecker::prctl::AbstractModelChecker<double>* createPrctlModelChecker(storm::models::Dtmc<double>& dtmc) {
// Create the appropriate model checker.
storm::settings::Settings* s = storm::settings::Settings::getInstance();
if (s->getString("matrixlib") == "gmm++") {
std::string const chosenMatrixLibrary = s->getOptionByLongName("matrixLibrary").getArgument(0).getValueAsString();
if (chosenMatrixLibrary == "gmm++") {
return new storm::modelchecker::prctl::SparseDtmcPrctlModelChecker<double>(dtmc, new storm::solver::GmmxxLinearEquationSolver<double>());
}
@ -218,10 +240,11 @@ storm::modelchecker::prctl::AbstractModelChecker<double>* createPrctlModelChecke
*/
storm::modelchecker::prctl::AbstractModelChecker<double>* createPrctlModelChecker(storm::models::Mdp<double>& mdp) {
// Create the appropriate model checker.
storm::settings::Settings* s = storm::settings::instance();
if (s->getString("matrixlib") == "gmm++") {
storm::settings::Settings* s = storm::settings::Settings::getInstance();
std::string const chosenMatrixLibrary = s->getOptionByLongName("matrixLibrary").getArgument(0).getValueAsString();
if (chosenMatrixLibrary == "gmm++") {
return new storm::modelchecker::prctl::SparseMdpPrctlModelChecker<double>(mdp, new storm::solver::GmmxxNondeterministicLinearEquationSolver<double>());
} else if (s->getString("matrixlib") == "native") {
} else if (chosenMatrixLibrary == "native") {
return new storm::modelchecker::prctl::SparseMdpPrctlModelChecker<double>(mdp, new storm::solver::AbstractNondeterministicLinearEquationSolver<double>());
}
@ -237,10 +260,11 @@ storm::modelchecker::prctl::AbstractModelChecker<double>* createPrctlModelChecke
* @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::instance();
storm::settings::Settings* s = storm::settings::Settings::getInstance();
if (s->isSet("prctl")) {
LOG4CPLUS_INFO(logger, "Parsing prctl file: " << s->getString("prctl") << ".");
std::list<storm::property::prctl::AbstractPrctlFormula<double>*> formulaList = storm::parser::PrctlFileParser(s->getString("prctl"));
std::string const chosenPrctlFile = s->getOptionByLongName("prctl").getArgument(0).getValueAsString();
LOG4CPLUS_INFO(logger, "Parsing prctl file: " << chosenPrctlFile << ".");
std::list<storm::property::prctl::AbstractPrctlFormula<double>*> formulaList = storm::parser::PrctlFileParser(chosenPrctlFile);
for (auto formula : formulaList) {
modelchecker.check(*formula);
@ -274,13 +298,17 @@ int main(const int argc, const char* argv[]) {
// Now, the settings are received and the specified model is parsed. The actual actions taken depend on whether
// the model was provided in explicit or symbolic format.
storm::settings::Settings* s = storm::settings::instance();
storm::settings::Settings* s = storm::settings::Settings::getInstance();
if (s->isSet("explicit")) {
std::vector<std::string> args = s->get<std::vector<std::string>>("explicit");
storm::parser::AutoParser<double> parser(args[0], args[1], s->getString("staterew"), s->getString("transrew"));
std::string const chosenTransitionSystemFile = s->getOptionByLongName("explicit").getArgument(0).getValueAsString();
std::string const chosenLabelingFile = s->getOptionByLongName("explicit").getArgument(1).getValueAsString();
std::string const chosenStateRewardsFile = s->getOptionByLongName("stateRewards").getArgument(0).getValueAsString();
std::string const chosenTransitionRewardsFile = s->getOptionByLongName("transitionRewards").getArgument(0).getValueAsString();
storm::parser::AutoParser<double> parser(chosenTransitionSystemFile, chosenLabelingFile, chosenStateRewardsFile, chosenTransitionRewardsFile);
// Determine which engine is to be used to choose the right model checker.
LOG4CPLUS_DEBUG(logger, s->getString("matrixlib"));
LOG4CPLUS_DEBUG(logger, s->getOptionByLongName("matrixLibrary").getArgument(0).getValueAsString());
// Depending on the model type, the appropriate model checking procedure is chosen.
storm::modelchecker::prctl::AbstractModelChecker<double>* modelchecker = nullptr;
@ -314,7 +342,7 @@ int main(const int argc, const char* argv[]) {
delete modelchecker;
}
} else if (s->isSet("symbolic")) {
std::string arg = s->getString("symbolic");
std::string const arg = s->getOptionByLongName("symbolic").getArgument(0).getValueAsString();
storm::adapters::ExplicitModelAdapter adapter(storm::parser::PrismParserFromFile(arg));
std::shared_ptr<storm::models::AbstractModel<double>> model = adapter.getModel();
model->printModelInformationToStream(std::cout);

34
test/functional/modelchecker/EigenDtmcPrctlModelCheckerTest.cpp

@ -2,13 +2,13 @@
#include "gtest/gtest.h"
#include "storm-config.h"
#include "src/utility/Settings.h"
#include "src/settings/Settings.h"
#include "src/modelchecker/EigenDtmcPrctlModelChecker.h"
#include "src/parser/AutoParser.h"
TEST(EigenDtmcPrctlModelCheckerTest, Die) {
storm::settings::Settings* s = storm::settings::instance();
s->set("fix-deadlocks");
storm::settings::Settings* s = storm::settings::Settings::getInstance();
s->set("fixDeadlocks");
storm::parser::AutoParser<double> parser(STORM_CPP_TESTS_BASE_PATH "/functional/modelchecker/die/die.tra", STORM_CPP_TESTS_BASE_PATH "/functional/modelchecker/die/die.lab", "", STORM_CPP_TESTS_BASE_PATH "/functional/modelchecker/die/die.coin_flips.trans.rew");
ASSERT_EQ(parser.getType(), storm::models::DTMC);
@ -26,7 +26,7 @@ TEST(EigenDtmcPrctlModelCheckerTest, Die) {
std::vector<double>* result = probFormula->check(mc);
ASSERT_LT(std::abs((*result)[1] - ((double)1/6)), s->get<double>("precision"));
ASSERT_LT(std::abs((*result)[1] - ((double)1/6)), s->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
delete probFormula;
delete result;
@ -37,7 +37,7 @@ TEST(EigenDtmcPrctlModelCheckerTest, Die) {
result = probFormula->check(mc);
ASSERT_LT(std::abs((*result)[1] - ((double)1/6)), s->get<double>("precision"));
ASSERT_LT(std::abs((*result)[1] - ((double)1/6)), s->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
delete probFormula;
delete result;
@ -48,7 +48,7 @@ TEST(EigenDtmcPrctlModelCheckerTest, Die) {
result = probFormula->check(mc);
ASSERT_LT(std::abs((*result)[1] - ((double)1/6)), s->get<double>("precision"));
ASSERT_LT(std::abs((*result)[1] - ((double)1/6)), s->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
delete probFormula;
delete result;
@ -60,15 +60,15 @@ TEST(EigenDtmcPrctlModelCheckerTest, Die) {
result = rewardFormula->check(mc);
ASSERT_LT(std::abs((*result)[1] - ((double)11/3)), s->get<double>("precision"));
ASSERT_LT(std::abs((*result)[1] - ((double)11/3)), s->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
delete rewardFormula;
delete result;
}
TEST(EigenDtmcPrctlModelCheckerTest, Crowds) {
storm::settings::Settings* s = storm::settings::instance();
s->set("fix-deadlocks");
storm::settings::Settings* s = storm::settings::Settings::getInstance();
s->set("fixDeadlocks");
storm::parser::AutoParser<double> parser(STORM_CPP_TESTS_BASE_PATH "/functional/modelchecker/crowds/crowds5_5.tra", STORM_CPP_TESTS_BASE_PATH "/functional/modelchecker/crowds/crowds5_5.lab", "", "");
ASSERT_EQ(parser.getType(), storm::models::DTMC);
@ -86,7 +86,7 @@ TEST(EigenDtmcPrctlModelCheckerTest, Crowds) {
std::vector<double>* result = probFormula->check(mc);
ASSERT_LT(std::abs((*result)[1] - 0.3328800375801578281), s->get<double>("precision"));
ASSERT_LT(std::abs((*result)[1] - 0.3328800375801578281), s->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
delete probFormula;
delete result;
@ -97,7 +97,7 @@ TEST(EigenDtmcPrctlModelCheckerTest, Crowds) {
result = probFormula->check(mc);
ASSERT_LT(std::abs((*result)[1] - 0.1522173670950556501), s->get<double>("precision"));
ASSERT_LT(std::abs((*result)[1] - 0.1522173670950556501), s->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
delete probFormula;
delete result;
@ -108,15 +108,15 @@ TEST(EigenDtmcPrctlModelCheckerTest, Crowds) {
result = probFormula->check(mc);
ASSERT_LT(std::abs((*result)[1] - 0.32153724292835045), s->get<double>("precision"));
ASSERT_LT(std::abs((*result)[1] - 0.32153724292835045), s->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
delete probFormula;
delete result;
}
TEST(EigenDtmcPrctlModelCheckerTest, SynchronousLeader) {
storm::settings::Settings* s = storm::settings::instance();
s->set("fix-deadlocks");
storm::settings::Settings* s = storm::settings::Settings::getInstance();
s->set("fixDeadlocks");
storm::parser::AutoParser<double> parser(STORM_CPP_TESTS_BASE_PATH "/functional/modelchecker/synchronous_leader/leader4_8.tra", STORM_CPP_TESTS_BASE_PATH "/functional/modelchecker/synchronous_leader/leader4_8.lab", "", STORM_CPP_TESTS_BASE_PATH "/functional/modelchecker/synchronous_leader/leader4_8.pick.trans.rew");
ASSERT_EQ(parser.getType(), storm::models::DTMC);
@ -134,7 +134,7 @@ TEST(EigenDtmcPrctlModelCheckerTest, SynchronousLeader) {
std::vector<double>* result = probFormula->check(mc);
ASSERT_LT(std::abs((*result)[1] - 1), s->get<double>("precision"));
ASSERT_LT(std::abs((*result)[1] - 1), s->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
delete probFormula;
delete result;
@ -145,7 +145,7 @@ TEST(EigenDtmcPrctlModelCheckerTest, SynchronousLeader) {
result = probFormula->check(mc);
ASSERT_LT(std::abs((*result)[1] - 0.9999965911265462636), s->get<double>("precision"));
ASSERT_LT(std::abs((*result)[1] - 0.9999965911265462636), s->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
delete probFormula;
delete result;
@ -156,7 +156,7 @@ TEST(EigenDtmcPrctlModelCheckerTest, SynchronousLeader) {
result = rewardFormula->check(mc);
ASSERT_LT(std::abs((*result)[1] - 1.0448979591835938496), s->get<double>("precision"));
ASSERT_LT(std::abs((*result)[1] - 1.0448979591835938496), s->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
delete rewardFormula;
delete result;

34
test/functional/modelchecker/GmmxxDtmcPrctlModelCheckerTest.cpp

@ -3,12 +3,12 @@
#include "src/solver/GmmxxLinearEquationSolver.h"
#include "src/modelchecker/prctl/SparseDtmcPrctlModelChecker.h"
#include "src/utility/Settings.h"
#include "src/settings/Settings.h"
#include "src/parser/AutoParser.h"
TEST(GmmxxDtmcPrctlModelCheckerTest, Die) {
storm::settings::Settings* s = storm::settings::instance();
s->set("fix-deadlocks");
storm::settings::Settings* s = storm::settings::Settings::getInstance();
s->set("fixDeadlocks");
storm::parser::AutoParser<double> parser(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");
ASSERT_EQ(parser.getType(), storm::models::DTMC);
@ -28,7 +28,7 @@ TEST(GmmxxDtmcPrctlModelCheckerTest, Die) {
ASSERT_NE(nullptr, result);
ASSERT_LT(std::abs((*result)[0] - ((double)1/6)), s->get<double>("precision"));
ASSERT_LT(std::abs((*result)[0] - ((double)1/6)), s->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
delete probFormula;
delete result;
@ -41,7 +41,7 @@ TEST(GmmxxDtmcPrctlModelCheckerTest, Die) {
ASSERT_NE(nullptr, result);
ASSERT_LT(std::abs((*result)[0] - ((double)1/6)), s->get<double>("precision"));
ASSERT_LT(std::abs((*result)[0] - ((double)1/6)), s->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
delete probFormula;
delete result;
@ -54,7 +54,7 @@ TEST(GmmxxDtmcPrctlModelCheckerTest, Die) {
ASSERT_NE(nullptr, result);
ASSERT_LT(std::abs((*result)[0] - ((double)1/6)), s->get<double>("precision"));
ASSERT_LT(std::abs((*result)[0] - ((double)1/6)), s->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
delete probFormula;
delete result;
@ -67,15 +67,15 @@ TEST(GmmxxDtmcPrctlModelCheckerTest, Die) {
ASSERT_NE(nullptr, result);
ASSERT_LT(std::abs((*result)[0] - ((double)11/3)), s->get<double>("precision"));
ASSERT_LT(std::abs((*result)[0] - ((double)11/3)), s->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
delete rewardFormula;
delete result;
}
TEST(GmmxxDtmcPrctlModelCheckerTest, Crowds) {
storm::settings::Settings* s = storm::settings::instance();
s->set("fix-deadlocks");
storm::settings::Settings* s = storm::settings::Settings::getInstance();
s->set("fixDeadlocks");
storm::parser::AutoParser<double> parser(STORM_CPP_BASE_PATH "/examples/dtmc/crowds/crowds5_5.tra", STORM_CPP_BASE_PATH "/examples/dtmc/crowds/crowds5_5.lab", "", "");
ASSERT_EQ(parser.getType(), storm::models::DTMC);
@ -95,7 +95,7 @@ TEST(GmmxxDtmcPrctlModelCheckerTest, Crowds) {
ASSERT_NE(nullptr, result);
ASSERT_LT(std::abs((*result)[0] - 0.3328800375801578281), s->get<double>("precision"));
ASSERT_LT(std::abs((*result)[0] - 0.3328800375801578281), s->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
delete probFormula;
delete result;
@ -108,7 +108,7 @@ TEST(GmmxxDtmcPrctlModelCheckerTest, Crowds) {
ASSERT_NE(nullptr, result);
ASSERT_LT(std::abs((*result)[0] - 0.1522173670950556501), s->get<double>("precision"));
ASSERT_LT(std::abs((*result)[0] - 0.1522173670950556501), s->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
delete probFormula;
delete result;
@ -121,15 +121,15 @@ TEST(GmmxxDtmcPrctlModelCheckerTest, Crowds) {
ASSERT_NE(nullptr, result);
ASSERT_LT(std::abs((*result)[0] - 0.32153724292835045), s->get<double>("precision"));
ASSERT_LT(std::abs((*result)[0] - 0.32153724292835045), s->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
delete probFormula;
delete result;
}
TEST(GmmxxDtmcPrctlModelCheckerTest, SynchronousLeader) {
storm::settings::Settings* s = storm::settings::instance();
s->set("fix-deadlocks");
storm::settings::Settings* s = storm::settings::Settings::getInstance();
s->set("fixDeadlocks");
storm::parser::AutoParser<double> parser(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");
ASSERT_EQ(parser.getType(), storm::models::DTMC);
@ -149,7 +149,7 @@ TEST(GmmxxDtmcPrctlModelCheckerTest, SynchronousLeader) {
ASSERT_NE(nullptr, result);
ASSERT_LT(std::abs((*result)[0] - 1), s->get<double>("precision"));
ASSERT_LT(std::abs((*result)[0] - 1), s->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
delete probFormula;
delete result;
@ -162,7 +162,7 @@ TEST(GmmxxDtmcPrctlModelCheckerTest, SynchronousLeader) {
ASSERT_NE(nullptr, result);
ASSERT_LT(std::abs((*result)[0] - 0.9999965911265462636), s->get<double>("precision"));
ASSERT_LT(std::abs((*result)[0] - 0.9999965911265462636), s->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
delete probFormula;
delete result;
@ -175,7 +175,7 @@ TEST(GmmxxDtmcPrctlModelCheckerTest, SynchronousLeader) {
ASSERT_NE(nullptr, result);
ASSERT_LT(std::abs((*result)[0] - 1.0448979591835938496), s->get<double>("precision"));
ASSERT_LT(std::abs((*result)[0] - 1.0448979591835938496), s->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
delete rewardFormula;
delete result;

40
test/functional/modelchecker/GmmxxMdpPrctlModelCheckerTest.cpp

@ -7,7 +7,7 @@
#include "src/parser/AutoParser.h"
TEST(GmmxxMdpPrctlModelCheckerTest, Dice) {
storm::settings::Settings* s = storm::settings::instance();
storm::settings::Settings* s = storm::settings::Settings::getInstance();
storm::parser::AutoParser<double> parser(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(parser.getType(), storm::models::MDP);
@ -27,7 +27,7 @@ TEST(GmmxxMdpPrctlModelCheckerTest, Dice) {
ASSERT_NE(nullptr, result);
ASSERT_LT(std::abs((*result)[0] - 0.0277777612209320068), s->get<double>("precision"));
ASSERT_LT(std::abs((*result)[0] - 0.0277777612209320068), s->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
delete probFormula;
delete result;
@ -38,7 +38,7 @@ TEST(GmmxxMdpPrctlModelCheckerTest, Dice) {
result = mc.checkNoBoundOperator(*probFormula);
ASSERT_LT(std::abs((*result)[0] - 0.0277777612209320068), s->get<double>("precision"));
ASSERT_LT(std::abs((*result)[0] - 0.0277777612209320068), s->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
delete probFormula;
delete result;
@ -49,7 +49,7 @@ TEST(GmmxxMdpPrctlModelCheckerTest, Dice) {
result = mc.checkNoBoundOperator(*probFormula);
ASSERT_LT(std::abs((*result)[0] - 0.0555555224418640136), s->get<double>("precision"));
ASSERT_LT(std::abs((*result)[0] - 0.0555555224418640136), s->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
delete probFormula;
delete result;
@ -60,7 +60,7 @@ TEST(GmmxxMdpPrctlModelCheckerTest, Dice) {
result = mc.checkNoBoundOperator(*probFormula);
ASSERT_LT(std::abs((*result)[0] - 0.0555555224418640136), s->get<double>("precision"));
ASSERT_LT(std::abs((*result)[0] - 0.0555555224418640136), s->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
delete probFormula;
delete result;
@ -71,7 +71,7 @@ TEST(GmmxxMdpPrctlModelCheckerTest, Dice) {
result = mc.checkNoBoundOperator(*probFormula);
ASSERT_LT(std::abs((*result)[0] - 0.083333283662796020508), s->get<double>("precision"));
ASSERT_LT(std::abs((*result)[0] - 0.083333283662796020508), s->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
delete probFormula;
delete result;
@ -82,7 +82,7 @@ TEST(GmmxxMdpPrctlModelCheckerTest, Dice) {
result = mc.checkNoBoundOperator(*probFormula);
ASSERT_LT(std::abs((*result)[0] - 0.083333283662796020508), s->get<double>("precision"));
ASSERT_LT(std::abs((*result)[0] - 0.083333283662796020508), s->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
delete probFormula;
delete result;
@ -93,7 +93,7 @@ TEST(GmmxxMdpPrctlModelCheckerTest, Dice) {
result = mc.checkNoBoundOperator(*rewardFormula);
ASSERT_LT(std::abs((*result)[0] - 7.3333294987678527832), s->get<double>("precision"));
ASSERT_LT(std::abs((*result)[0] - 7.3333294987678527832), s->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
delete rewardFormula;
delete result;
@ -104,7 +104,7 @@ TEST(GmmxxMdpPrctlModelCheckerTest, Dice) {
result = mc.checkNoBoundOperator(*rewardFormula);;
ASSERT_LT(std::abs((*result)[0] - 7.3333294987678527832), s->get<double>("precision"));
ASSERT_LT(std::abs((*result)[0] - 7.3333294987678527832), s->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
delete rewardFormula;
delete result;
@ -123,7 +123,7 @@ TEST(GmmxxMdpPrctlModelCheckerTest, Dice) {
result = stateRewardModelChecker.checkNoBoundOperator(*rewardFormula);
ASSERT_LT(std::abs((*result)[0] - 7.3333294987678527832), s->get<double>("precision"));
ASSERT_LT(std::abs((*result)[0] - 7.3333294987678527832), s->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
delete rewardFormula;
delete result;
@ -134,7 +134,7 @@ TEST(GmmxxMdpPrctlModelCheckerTest, Dice) {
result = stateRewardModelChecker.checkNoBoundOperator(*rewardFormula);
ASSERT_LT(std::abs((*result)[0] - 7.3333294987678527832), s->get<double>("precision"));
ASSERT_LT(std::abs((*result)[0] - 7.3333294987678527832), s->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
delete rewardFormula;
delete result;
@ -153,7 +153,7 @@ TEST(GmmxxMdpPrctlModelCheckerTest, Dice) {
result = stateAndTransitionRewardModelChecker.checkNoBoundOperator(*rewardFormula);
ASSERT_LT(std::abs((*result)[0] - (2 * 7.3333294987678527832)), s->get<double>("precision"));
ASSERT_LT(std::abs((*result)[0] - (2 * 7.3333294987678527832)), s->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
delete rewardFormula;
delete result;
@ -164,14 +164,14 @@ TEST(GmmxxMdpPrctlModelCheckerTest, Dice) {
result = stateAndTransitionRewardModelChecker.checkNoBoundOperator(*rewardFormula);
ASSERT_LT(std::abs((*result)[0] - (2 * 7.3333294987678527832)), s->get<double>("precision"));
ASSERT_LT(std::abs((*result)[0] - (2 * 7.3333294987678527832)), s->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
delete rewardFormula;
delete result;
}
TEST(GmmxxMdpPrctlModelCheckerTest, AsynchronousLeader) {
storm::settings::Settings* s = storm::settings::instance();
storm::settings::Settings* s = storm::settings::Settings::getInstance();
storm::parser::AutoParser<double> parser(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(parser.getType(), storm::models::MDP);
@ -191,7 +191,7 @@ TEST(GmmxxMdpPrctlModelCheckerTest, AsynchronousLeader) {
ASSERT_NE(nullptr, result);
ASSERT_LT(std::abs((*result)[0] - 1), s->get<double>("precision"));
ASSERT_LT(std::abs((*result)[0] - 1), s->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
delete probFormula;
delete result;
@ -204,7 +204,7 @@ TEST(GmmxxMdpPrctlModelCheckerTest, AsynchronousLeader) {
ASSERT_NE(nullptr, result);
ASSERT_LT(std::abs((*result)[0] - 1), s->get<double>("precision"));
ASSERT_LT(std::abs((*result)[0] - 1), s->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
delete probFormula;
delete result;
@ -217,7 +217,7 @@ TEST(GmmxxMdpPrctlModelCheckerTest, AsynchronousLeader) {
ASSERT_NE(nullptr, result);
ASSERT_LT(std::abs((*result)[0] - 0.0625), s->get<double>("precision"));
ASSERT_LT(std::abs((*result)[0] - 0.0625), s->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
delete probFormula;
delete result;
@ -230,7 +230,7 @@ TEST(GmmxxMdpPrctlModelCheckerTest, AsynchronousLeader) {
ASSERT_NE(nullptr, result);
ASSERT_LT(std::abs((*result)[0] - 0.0625), s->get<double>("precision"));
ASSERT_LT(std::abs((*result)[0] - 0.0625), s->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
delete probFormula;
delete result;
@ -241,7 +241,7 @@ TEST(GmmxxMdpPrctlModelCheckerTest, AsynchronousLeader) {
result = mc.checkNoBoundOperator(*rewardFormula);;
ASSERT_LT(std::abs((*result)[0] - 4.28568908480604982), s->get<double>("precision"));
ASSERT_LT(std::abs((*result)[0] - 4.28568908480604982), s->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
delete rewardFormula;
delete result;
@ -254,7 +254,7 @@ TEST(GmmxxMdpPrctlModelCheckerTest, AsynchronousLeader) {
ASSERT_NE(nullptr, result);
ASSERT_LT(std::abs((*result)[0] - 4.2856904354441400784), s->get<double>("precision"));
ASSERT_LT(std::abs((*result)[0] - 4.2856904354441400784), s->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
delete rewardFormula;
delete result;

40
test/functional/modelchecker/SparseMdpPrctlModelCheckerTest.cpp

@ -6,7 +6,7 @@
#include "src/parser/AutoParser.h"
TEST(SparseMdpPrctlModelCheckerTest, Dice) {
storm::settings::Settings* s = storm::settings::instance();
storm::settings::Settings* s = storm::settings::Settings::getInstance();
storm::parser::AutoParser<double> parser(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(parser.getType(), storm::models::MDP);
@ -25,7 +25,7 @@ TEST(SparseMdpPrctlModelCheckerTest, Dice) {
std::vector<double>* result = mc.checkNoBoundOperator(*probFormula);
ASSERT_NE(nullptr, result);
ASSERT_LT(std::abs((*result)[0] - 0.0277777612209320068), s->get<double>("precision"));
ASSERT_LT(std::abs((*result)[0] - 0.0277777612209320068), s->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
delete probFormula;
delete result;
@ -36,7 +36,7 @@ TEST(SparseMdpPrctlModelCheckerTest, Dice) {
result = mc.checkNoBoundOperator(*probFormula);
ASSERT_LT(std::abs((*result)[0] - 0.0277777612209320068), s->get<double>("precision"));
ASSERT_LT(std::abs((*result)[0] - 0.0277777612209320068), s->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
delete probFormula;
delete result;
@ -47,7 +47,7 @@ TEST(SparseMdpPrctlModelCheckerTest, Dice) {
result = mc.checkNoBoundOperator(*probFormula);
ASSERT_LT(std::abs((*result)[0] - 0.0555555224418640136), s->get<double>("precision"));
ASSERT_LT(std::abs((*result)[0] - 0.0555555224418640136), s->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
delete probFormula;
delete result;
@ -58,7 +58,7 @@ TEST(SparseMdpPrctlModelCheckerTest, Dice) {
result = mc.checkNoBoundOperator(*probFormula);
ASSERT_LT(std::abs((*result)[0] - 0.0555555224418640136), s->get<double>("precision"));
ASSERT_LT(std::abs((*result)[0] - 0.0555555224418640136), s->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
delete probFormula;
delete result;
@ -69,7 +69,7 @@ TEST(SparseMdpPrctlModelCheckerTest, Dice) {
result = mc.checkNoBoundOperator(*probFormula);
ASSERT_LT(std::abs((*result)[0] - 0.083333283662796020508), s->get<double>("precision"));
ASSERT_LT(std::abs((*result)[0] - 0.083333283662796020508), s->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
delete probFormula;
delete result;
@ -80,7 +80,7 @@ TEST(SparseMdpPrctlModelCheckerTest, Dice) {
result = mc.checkNoBoundOperator(*probFormula);
ASSERT_LT(std::abs((*result)[0] - 0.083333283662796020508), s->get<double>("precision"));
ASSERT_LT(std::abs((*result)[0] - 0.083333283662796020508), s->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
delete probFormula;
delete result;
@ -91,7 +91,7 @@ TEST(SparseMdpPrctlModelCheckerTest, Dice) {
result = mc.checkNoBoundOperator(*rewardFormula);
ASSERT_LT(std::abs((*result)[0] - 7.3333294987678527832), s->get<double>("precision"));
ASSERT_LT(std::abs((*result)[0] - 7.3333294987678527832), s->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
delete rewardFormula;
delete result;
@ -102,7 +102,7 @@ TEST(SparseMdpPrctlModelCheckerTest, Dice) {
result = mc.checkNoBoundOperator(*rewardFormula);;
ASSERT_LT(std::abs((*result)[0] - 7.3333294987678527832), s->get<double>("precision"));
ASSERT_LT(std::abs((*result)[0] - 7.3333294987678527832), s->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
delete rewardFormula;
delete result;
@ -121,7 +121,7 @@ TEST(SparseMdpPrctlModelCheckerTest, Dice) {
result = stateRewardModelChecker.checkNoBoundOperator(*rewardFormula);
ASSERT_LT(std::abs((*result)[0] - 7.3333294987678527832), s->get<double>("precision"));
ASSERT_LT(std::abs((*result)[0] - 7.3333294987678527832), s->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
delete rewardFormula;
delete result;
@ -132,7 +132,7 @@ TEST(SparseMdpPrctlModelCheckerTest, Dice) {
result = stateRewardModelChecker.checkNoBoundOperator(*rewardFormula);
ASSERT_LT(std::abs((*result)[0] - 7.3333294987678527832), s->get<double>("precision"));
ASSERT_LT(std::abs((*result)[0] - 7.3333294987678527832), s->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
delete rewardFormula;
delete result;
@ -151,7 +151,7 @@ TEST(SparseMdpPrctlModelCheckerTest, Dice) {
result = stateAndTransitionRewardModelChecker.checkNoBoundOperator(*rewardFormula);
ASSERT_LT(std::abs((*result)[0] - (2 * 7.3333294987678527832)), s->get<double>("precision"));
ASSERT_LT(std::abs((*result)[0] - (2 * 7.3333294987678527832)), s->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
delete rewardFormula;
delete result;
@ -162,14 +162,14 @@ TEST(SparseMdpPrctlModelCheckerTest, Dice) {
result = stateAndTransitionRewardModelChecker.checkNoBoundOperator(*rewardFormula);
ASSERT_LT(std::abs((*result)[0] - (2 * 7.3333294987678527832)), s->get<double>("precision"));
ASSERT_LT(std::abs((*result)[0] - (2 * 7.3333294987678527832)), s->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
delete rewardFormula;
delete result;
}
TEST(SparseMdpPrctlModelCheckerTest, AsynchronousLeader) {
storm::settings::Settings* s = storm::settings::instance();
storm::settings::Settings* s = storm::settings::Settings::getInstance();
storm::parser::AutoParser<double> parser(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(parser.getType(), storm::models::MDP);
@ -189,7 +189,7 @@ TEST(SparseMdpPrctlModelCheckerTest, AsynchronousLeader) {
ASSERT_NE(nullptr, result);
ASSERT_LT(std::abs((*result)[0] - 1), s->get<double>("precision"));
ASSERT_LT(std::abs((*result)[0] - 1), s->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
delete probFormula;
delete result;
@ -202,7 +202,7 @@ TEST(SparseMdpPrctlModelCheckerTest, AsynchronousLeader) {
ASSERT_NE(nullptr, result);
ASSERT_LT(std::abs((*result)[0] - 1), s->get<double>("precision"));
ASSERT_LT(std::abs((*result)[0] - 1), s->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
delete probFormula;
delete result;
@ -215,7 +215,7 @@ TEST(SparseMdpPrctlModelCheckerTest, AsynchronousLeader) {
ASSERT_NE(nullptr, result);
ASSERT_LT(std::abs((*result)[0] - 0.0625), s->get<double>("precision"));
ASSERT_LT(std::abs((*result)[0] - 0.0625), s->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
delete probFormula;
delete result;
@ -228,7 +228,7 @@ TEST(SparseMdpPrctlModelCheckerTest, AsynchronousLeader) {
ASSERT_NE(nullptr, result);
ASSERT_LT(std::abs((*result)[0] - 0.0625), s->get<double>("precision"));
ASSERT_LT(std::abs((*result)[0] - 0.0625), s->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
delete probFormula;
delete result;
@ -239,7 +239,7 @@ TEST(SparseMdpPrctlModelCheckerTest, AsynchronousLeader) {
result = mc.checkNoBoundOperator(*rewardFormula);;
ASSERT_LT(std::abs((*result)[0] - 4.28568908480604982), s->get<double>("precision"));
ASSERT_LT(std::abs((*result)[0] - 4.28568908480604982), s->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
delete rewardFormula;
delete result;
@ -252,7 +252,7 @@ TEST(SparseMdpPrctlModelCheckerTest, AsynchronousLeader) {
ASSERT_NE(nullptr, result);
ASSERT_LT(std::abs((*result)[0] - 4.2856904354441400784), s->get<double>("precision"));
ASSERT_LT(std::abs((*result)[0] - 4.2856904354441400784), s->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
delete rewardFormula;
delete result;

22
test/performance/modelchecker/GmmxxDtmcPrctModelCheckerTest.cpp

@ -1,13 +1,13 @@
#include "gtest/gtest.h"
#include "storm-config.h"
#include "src/utility/Settings.h"
#include "src/settings/Settings.h"
#include "src/modelchecker/prctl/SparseDtmcPrctlModelChecker.h"
#include "src/solver/GmmxxLinearEquationSolver.h"
#include "src/parser/AutoParser.h"
TEST(GmmxxDtmcPrctlModelCheckerTest, Crowds) {
storm::settings::Settings* s = storm::settings::instance();
s->set("fix-deadlocks");
storm::settings::Settings* s = storm::settings::Settings::getInstance();
s->set("fixDeadlocks");
storm::parser::AutoParser<double> parser(STORM_CPP_BASE_PATH "/examples/dtmc/crowds/crowds20_5.tra", STORM_CPP_BASE_PATH "/examples/dtmc/crowds/crowds20_5.lab", "", "");
ASSERT_EQ(parser.getType(), storm::models::DTMC);
@ -29,7 +29,7 @@ TEST(GmmxxDtmcPrctlModelCheckerTest, Crowds) {
ASSERT_NE(nullptr, result);
ASSERT_LT(std::abs((*result)[0] - 0.2296803699), s->get<double>("precision"));
ASSERT_LT(std::abs((*result)[0] - 0.2296803699), s->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
delete probFormula;
delete result;
@ -44,7 +44,7 @@ TEST(GmmxxDtmcPrctlModelCheckerTest, Crowds) {
ASSERT_NE(nullptr, result);
ASSERT_LT(std::abs((*result)[0] - 0.05072232915), s->get<double>("precision"));
ASSERT_LT(std::abs((*result)[0] - 0.05072232915), s->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
delete probFormula;
delete result;
@ -59,7 +59,7 @@ TEST(GmmxxDtmcPrctlModelCheckerTest, Crowds) {
ASSERT_NE(nullptr, result);
ASSERT_LT(std::abs((*result)[0] - 0.2274230551), s->get<double>("precision"));
ASSERT_LT(std::abs((*result)[0] - 0.2274230551), s->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
delete probFormula;
delete result;
@ -67,8 +67,8 @@ TEST(GmmxxDtmcPrctlModelCheckerTest, Crowds) {
TEST(GmmxxDtmcPrctlModelCheckerTest, SynchronousLeader) {
storm::settings::Settings* s = storm::settings::instance();
s->set("fix-deadlocks");
storm::settings::Settings* s = storm::settings::Settings::getInstance();
s->set("fixDeadlocks");
storm::parser::AutoParser<double> parser(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");
ASSERT_EQ(parser.getType(), storm::models::DTMC);
@ -90,7 +90,7 @@ TEST(GmmxxDtmcPrctlModelCheckerTest, SynchronousLeader) {
ASSERT_NE(nullptr, result);
ASSERT_LT(std::abs((*result)[0] - 1), s->get<double>("precision"));
ASSERT_LT(std::abs((*result)[0] - 1), s->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
delete probFormula;
delete result;
@ -105,7 +105,7 @@ TEST(GmmxxDtmcPrctlModelCheckerTest, SynchronousLeader) {
ASSERT_NE(nullptr, result);
ASSERT_LT(std::abs((*result)[0] - 0.999394979327824395376467), s->get<double>("precision"));
ASSERT_LT(std::abs((*result)[0] - 0.999394979327824395376467), s->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
delete probFormula;
delete result;
@ -120,7 +120,7 @@ TEST(GmmxxDtmcPrctlModelCheckerTest, SynchronousLeader) {
ASSERT_NE(nullptr, result);
ASSERT_LT(std::abs((*result)[0] - 1.02521744572240791626427), s->get<double>("precision"));
ASSERT_LT(std::abs((*result)[0] - 1.02521744572240791626427), s->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
delete rewardFormula;
delete result;

34
test/performance/modelchecker/GmmxxMdpPrctModelCheckerTest.cpp

@ -1,13 +1,13 @@
#include "gtest/gtest.h"
#include "storm-config.h"
#include "src/utility/Settings.h"
#include "src/settings/Settings.h"
#include "src/modelchecker/prctl/SparseMdpPrctlModelChecker.h"
#include "src/solver/GmmxxNondeterministicLinearEquationSolver.h"
#include "src/parser/AutoParser.h"
TEST(GmmxxMdpPrctlModelCheckerTest, AsynchronousLeader) {
storm::settings::Settings* s = storm::settings::instance();
storm::settings::Settings* s = storm::settings::Settings::getInstance();
storm::parser::AutoParser<double> parser(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(parser.getType(), storm::models::MDP);
@ -29,7 +29,7 @@ TEST(GmmxxMdpPrctlModelCheckerTest, AsynchronousLeader) {
ASSERT_NE(nullptr, result);
ASSERT_LT(std::abs((*result)[0] - 1), s->get<double>("precision"));
ASSERT_LT(std::abs((*result)[0] - 1), s->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
delete probFormula;
delete result;
@ -44,7 +44,7 @@ TEST(GmmxxMdpPrctlModelCheckerTest, AsynchronousLeader) {
ASSERT_NE(nullptr, result);
ASSERT_LT(std::abs((*result)[0] - 1), s->get<double>("precision"));
ASSERT_LT(std::abs((*result)[0] - 1), s->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
delete probFormula;
delete result;
@ -59,7 +59,7 @@ TEST(GmmxxMdpPrctlModelCheckerTest, AsynchronousLeader) {
ASSERT_NE(nullptr, result);
ASSERT_LT(std::abs((*result)[0] - 0), s->get<double>("precision"));
ASSERT_LT(std::abs((*result)[0] - 0), s->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
delete probFormula;
delete result;
@ -74,7 +74,7 @@ TEST(GmmxxMdpPrctlModelCheckerTest, AsynchronousLeader) {
ASSERT_NE(nullptr, result);
ASSERT_LT(std::abs((*result)[0] - 0), s->get<double>("precision"));
ASSERT_LT(std::abs((*result)[0] - 0), s->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
delete probFormula;
delete result;
@ -87,7 +87,7 @@ TEST(GmmxxMdpPrctlModelCheckerTest, AsynchronousLeader) {
result = mc.checkNoBoundOperator(*rewardFormula);
LOG4CPLUS_WARN(logger, "Done.");
ASSERT_LT(std::abs((*result)[0] - 6.172433512), s->get<double>("precision"));
ASSERT_LT(std::abs((*result)[0] - 6.172433512), s->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
delete rewardFormula;
delete result;
@ -102,14 +102,14 @@ TEST(GmmxxMdpPrctlModelCheckerTest, AsynchronousLeader) {
ASSERT_NE(nullptr, result);
ASSERT_LT(std::abs((*result)[0] - 6.1724344), s->get<double>("precision"));
ASSERT_LT(std::abs((*result)[0] - 6.1724344), s->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
delete rewardFormula;
delete result;
}
TEST(GmmxxMdpPrctlModelCheckerTest, Consensus) {
storm::settings::Settings* s = storm::settings::instance();
storm::settings::Settings* s = storm::settings::Settings::getInstance();
s->set<unsigned>("maxiter", 20000);
storm::parser::AutoParser<double> parser(STORM_CPP_BASE_PATH "/examples/mdp/consensus/coin4_6.tra", STORM_CPP_BASE_PATH "/examples/mdp/consensus/coin4_6.lab", STORM_CPP_BASE_PATH "/examples/mdp/consensus/coin4_6.steps.state.rew", "");
@ -133,7 +133,7 @@ TEST(GmmxxMdpPrctlModelCheckerTest, Consensus) {
ASSERT_NE(nullptr, result);
ASSERT_LT(std::abs((*result)[31168] - 1), s->get<double>("precision"));
ASSERT_LT(std::abs((*result)[31168] - 1), s->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
delete probFormula;
delete result;
@ -150,7 +150,7 @@ TEST(GmmxxMdpPrctlModelCheckerTest, Consensus) {
ASSERT_NE(nullptr, result);
ASSERT_LT(std::abs((*result)[31168] - 0.43742828319177884388579), s->get<double>("precision"));
ASSERT_LT(std::abs((*result)[31168] - 0.43742828319177884388579), s->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
delete probFormula;
delete result;
@ -166,7 +166,7 @@ TEST(GmmxxMdpPrctlModelCheckerTest, Consensus) {
LOG4CPLUS_WARN(logger, "Done.");
ASSERT_NE(nullptr, result);
ASSERT_LT(std::abs((*result)[31168] - 0.52932863686144482340267813924583606421947479248047), s->get<double>("precision"));
ASSERT_LT(std::abs((*result)[31168] - 0.52932863686144482340267813924583606421947479248047), s->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
delete probFormula;
delete result;
@ -183,7 +183,7 @@ TEST(GmmxxMdpPrctlModelCheckerTest, Consensus) {
LOG4CPLUS_WARN(logger, "Done.");
ASSERT_NE(nullptr, result);
ASSERT_LT(std::abs((*result)[31168] - 0.1041409700076474653673841), s->get<double>("precision"));
ASSERT_LT(std::abs((*result)[31168] - 0.1041409700076474653673841), s->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
delete probFormula;
delete result;
@ -197,7 +197,7 @@ TEST(GmmxxMdpPrctlModelCheckerTest, Consensus) {
LOG4CPLUS_WARN(logger, "Done.");
ASSERT_NE(nullptr, result);
ASSERT_LT(std::abs((*result)[31168] - 0), s->get<double>("precision"));
ASSERT_LT(std::abs((*result)[31168] - 0), s->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
delete probFormula;
delete result;
@ -211,7 +211,7 @@ TEST(GmmxxMdpPrctlModelCheckerTest, Consensus) {
LOG4CPLUS_WARN(logger, "Done.");
ASSERT_NE(nullptr, result);
ASSERT_LT(std::abs((*result)[31168] - 0), s->get<double>("precision"));
ASSERT_LT(std::abs((*result)[31168] - 0), s->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
delete probFormula;
delete result;
@ -225,7 +225,7 @@ TEST(GmmxxMdpPrctlModelCheckerTest, Consensus) {
LOG4CPLUS_WARN(logger, "Done.");
ASSERT_NE(nullptr, result);
ASSERT_LT(std::abs((*result)[31168] - 1725.5933133943854045), s->get<double>("precision"));
ASSERT_LT(std::abs((*result)[31168] - 1725.5933133943854045), s->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
delete rewardFormula;
delete result;
@ -239,7 +239,7 @@ TEST(GmmxxMdpPrctlModelCheckerTest, Consensus) {
LOG4CPLUS_WARN(logger, "Done.");
ASSERT_NE(nullptr, result);
ASSERT_LT(std::abs((*result)[31168] - 2183.1424220082612919213715), s->get<double>("precision"));
ASSERT_LT(std::abs((*result)[31168] - 2183.1424220082612919213715), s->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
delete rewardFormula;
delete result;

34
test/performance/modelchecker/SparseMdpPrctlModelCheckerTest.cpp

@ -1,13 +1,13 @@
#include "gtest/gtest.h"
#include "storm-config.h"
#include "src/utility/Settings.h"
#include "src/settings/Settings.h"
#include "src/modelchecker/prctl/SparseMdpPrctlModelChecker.h"
#include "src/solver/AbstractNondeterministicLinearEquationSolver.h"
#include "src/parser/AutoParser.h"
TEST(SparseMdpPrctlModelCheckerTest, AsynchronousLeader) {
storm::settings::Settings* s = storm::settings::instance();
storm::settings::Settings* s = storm::settings::Settings::getInstance();
storm::parser::AutoParser<double> parser(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(parser.getType(), storm::models::MDP);
@ -28,7 +28,7 @@ TEST(SparseMdpPrctlModelCheckerTest, AsynchronousLeader) {
LOG4CPLUS_WARN(logger, "Done.");
ASSERT_NE(nullptr, result);
ASSERT_LT(std::abs((*result)[0] - 1), s->get<double>("precision"));
ASSERT_LT(std::abs((*result)[0] - 1), s->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
delete probFormula;
delete result;
@ -43,7 +43,7 @@ TEST(SparseMdpPrctlModelCheckerTest, AsynchronousLeader) {
ASSERT_NE(nullptr, result);
ASSERT_LT(std::abs((*result)[0] - 1), s->get<double>("precision"));
ASSERT_LT(std::abs((*result)[0] - 1), s->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
delete probFormula;
delete result;
@ -58,7 +58,7 @@ TEST(SparseMdpPrctlModelCheckerTest, AsynchronousLeader) {
ASSERT_NE(nullptr, result);
ASSERT_LT(std::abs((*result)[0] - 0), s->get<double>("precision"));
ASSERT_LT(std::abs((*result)[0] - 0), s->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
delete probFormula;
delete result;
@ -72,7 +72,7 @@ TEST(SparseMdpPrctlModelCheckerTest, AsynchronousLeader) {
LOG4CPLUS_WARN(logger, "Done.");
ASSERT_NE(nullptr, result);
ASSERT_LT(std::abs((*result)[0] - 0), s->get<double>("precision"));
ASSERT_LT(std::abs((*result)[0] - 0), s->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
delete probFormula;
delete result;
@ -85,7 +85,7 @@ TEST(SparseMdpPrctlModelCheckerTest, AsynchronousLeader) {
result = mc.checkNoBoundOperator(*rewardFormula);
LOG4CPLUS_WARN(logger, "Done.");
ASSERT_LT(std::abs((*result)[0] - 6.172433512), s->get<double>("precision"));
ASSERT_LT(std::abs((*result)[0] - 6.172433512), s->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
delete rewardFormula;
delete result;
@ -100,14 +100,14 @@ TEST(SparseMdpPrctlModelCheckerTest, AsynchronousLeader) {
ASSERT_NE(nullptr, result);
ASSERT_LT(std::abs((*result)[0] - 6.1724344), s->get<double>("precision"));
ASSERT_LT(std::abs((*result)[0] - 6.1724344), s->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
delete rewardFormula;
delete result;
}
TEST(SparseMdpPrctlModelCheckerTest, Consensus) {
storm::settings::Settings* s = storm::settings::instance();
storm::settings::Settings* s = storm::settings::Settings::getInstance();
// Increase the maximal number of iterations, because the solver does not converge otherwise.
s->set<unsigned>("maxiter", 20000);
@ -132,7 +132,7 @@ TEST(SparseMdpPrctlModelCheckerTest, Consensus) {
ASSERT_NE(nullptr, result);
ASSERT_LT(std::abs((*result)[31168] - 1), s->get<double>("precision"));
ASSERT_LT(std::abs((*result)[31168] - 1), s->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
delete probFormula;
delete result;
@ -148,7 +148,7 @@ TEST(SparseMdpPrctlModelCheckerTest, Consensus) {
LOG4CPLUS_WARN(logger, "Done.");
ASSERT_NE(nullptr, result);
ASSERT_LT(std::abs((*result)[31168] - 0.43742828319177884388579), s->get<double>("precision"));
ASSERT_LT(std::abs((*result)[31168] - 0.43742828319177884388579), s->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
delete probFormula;
delete result;
@ -164,7 +164,7 @@ TEST(SparseMdpPrctlModelCheckerTest, Consensus) {
LOG4CPLUS_WARN(logger, "Done.");
ASSERT_NE(nullptr, result);
ASSERT_LT(std::abs((*result)[31168] - 0.52932863686144482340267813924583606421947479248047), s->get<double>("precision"));
ASSERT_LT(std::abs((*result)[31168] - 0.52932863686144482340267813924583606421947479248047), s->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
delete probFormula;
delete result;
@ -181,7 +181,7 @@ TEST(SparseMdpPrctlModelCheckerTest, Consensus) {
LOG4CPLUS_WARN(logger, "Done.");
ASSERT_NE(nullptr, result);
ASSERT_LT(std::abs((*result)[31168] - 0.1041409700076474653673841), s->get<double>("precision"));
ASSERT_LT(std::abs((*result)[31168] - 0.1041409700076474653673841), s->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
delete probFormula;
delete result;
@ -195,7 +195,7 @@ TEST(SparseMdpPrctlModelCheckerTest, Consensus) {
LOG4CPLUS_WARN(logger, "Done.");
ASSERT_NE(nullptr, result);
ASSERT_LT(std::abs((*result)[31168] - 0), s->get<double>("precision"));
ASSERT_LT(std::abs((*result)[31168] - 0), s->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
delete probFormula;
delete result;
@ -209,7 +209,7 @@ TEST(SparseMdpPrctlModelCheckerTest, Consensus) {
LOG4CPLUS_WARN(logger, "Done.");
ASSERT_NE(nullptr, result);
ASSERT_LT(std::abs((*result)[31168] - 0), s->get<double>("precision"));
ASSERT_LT(std::abs((*result)[31168] - 0), s->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
delete probFormula;
delete result;
@ -223,7 +223,7 @@ TEST(SparseMdpPrctlModelCheckerTest, Consensus) {
LOG4CPLUS_WARN(logger, "Done.");
ASSERT_NE(nullptr, result);
ASSERT_LT(std::abs((*result)[31168] - 1725.5933133943854045), s->get<double>("precision"));
ASSERT_LT(std::abs((*result)[31168] - 1725.5933133943854045), s->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
delete rewardFormula;
delete result;
@ -237,7 +237,7 @@ TEST(SparseMdpPrctlModelCheckerTest, Consensus) {
LOG4CPLUS_WARN(logger, "Done.");
ASSERT_NE(nullptr, result);
ASSERT_LT(std::abs((*result)[31168] - 2183.1424220082612919213715), s->get<double>("precision"));
ASSERT_LT(std::abs((*result)[31168] - 2183.1424220082612919213715), s->getOptionByLongName("precision").getArgument(0).getValueAsDouble());
delete rewardFormula;
delete result;

Loading…
Cancel
Save