Browse Source
Added all options from StoRM
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
27 changed files with 385 additions and 228 deletions
-
2CMakeLists.txt
-
11src/adapters/ExplicitModelAdapter.cpp
-
7src/modelchecker/prctl/EigenDtmcPrctlModelChecker.h
-
8src/modelchecker/prctl/SparseMdpPrctlModelChecker.h
-
8src/modelchecker/prctl/TopologicalValueIterationMdpPrctlModelChecker.h
-
6src/models/Ctmdp.h
-
6src/models/Dtmc.h
-
6src/models/Mdp.h
-
6src/parser/DeterministicSparseTransitionParser.cpp
-
6src/parser/NondeterministicSparseTransitionParser.cpp
-
2src/settings/Argument.h
-
38src/settings/ArgumentBuilder.h
-
125src/settings/ArgumentValidators.h
-
5src/settings/Settings.cpp
-
1src/settings/Settings.h
-
10src/solver/AbstractNondeterministicLinearEquationSolver.h
-
28src/solver/GmmxxLinearEquationSolver.cpp
-
40src/solver/GmmxxLinearEquationSolver.h
-
8src/solver/GmmxxNondeterministicLinearEquationSolver.h
-
52src/storm.cpp
-
34test/functional/modelchecker/EigenDtmcPrctlModelCheckerTest.cpp
-
34test/functional/modelchecker/GmmxxDtmcPrctlModelCheckerTest.cpp
-
40test/functional/modelchecker/GmmxxMdpPrctlModelCheckerTest.cpp
-
40test/functional/modelchecker/SparseMdpPrctlModelCheckerTest.cpp
-
22test/performance/modelchecker/GmmxxDtmcPrctModelCheckerTest.cpp
-
34test/performance/modelchecker/GmmxxMdpPrctModelCheckerTest.cpp
-
34test/performance/modelchecker/SparseMdpPrctlModelCheckerTest.cpp
@ -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_ |
@ -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; |
|||
}); |
Write
Preview
Loading…
Cancel
Save
Reference in new issue