Browse Source

Added some options to Gmmxx-Modelchecker. DO NOT PULL FOR THE TIME BEING AS THERE IS A PROBLEM WITH THE OPTIONS.

tempestpy_adaptions
dehnert 12 years ago
parent
commit
2a6228af71
  1. 50
      src/modelChecker/GmmxxDtmcPrctlModelChecker.h
  2. 3
      src/mrmc.cpp

50
src/modelChecker/GmmxxDtmcPrctlModelChecker.h

@ -13,6 +13,9 @@
#include "src/solver/GraphAnalyzer.h"
#include "src/utility/vector.h"
#include "src/exceptions/InvalidSettings.h"
#include <boost/program_options.hpp>
#include "gmm/gmm_matrix.h"
#include "gmm/gmm_iter_solvers.h"
@ -167,6 +170,53 @@ public:
return result;
}
/*!
* Returns the name of this module.
* @return The name of this module.
*/
static std::string getModuleName() {
return "gmm++";
}
/*!
* Returns a trigger such that if the option "matrixlib" is set to "gmm++", this model checker
* is to be used.
* @return An option trigger for this module.
*/
static std::pair<std::string, std::string> getOptionTrigger() {
return std::pair<std::string, std::string>("matrixlib", "gmm++");
}
/*!
* Registers all options associated with the gmm++ matrix library.
*/
static void putOptions(boost::program_options::options_description* desc) {
desc->add_options()("lemethod", boost::program_options::value<std::string>()->default_value("bicgstab")->notifier(&validateLeMethod), "Sets the method used for linear equation solving. Must be in {bicgstab, gmres, qmr}.");
desc->add_options()("lemethod", boost::program_options::value<unsigned>()->default_value(10000), "Sets the maximal number of iterations used for linear equation solving.");
desc->add_options()("precond", boost::program_options::value<std::string>()->default_value("ilu")->notifier(&validatePreconditioner), "Sets the preconditioner used for linear equation solving. Must be in {ilu, diagonal, ildlt}.");
desc->add_options()("restart", boost::program_options::value<unsigned>()->default_value(40), "Sets the number of iterations after which gmres is restarted.");
}
/*!
* Validates whether the given lemethod matches one of the available ones.
* Throws an exception of type InvalidSettings in case the selected method is illegal.
*/
static void validateLeMethod(const std::string& lemethod) {
if (lemethod.compare("bicgstab") != 0 && lemethod.compare("qmr") != 0 && lemethod.compare("gmres") != 0) {
throw exceptions::InvalidSettings();
}
}
/*!
* Validates whether the given preconditioner matches one of the available ones.
* Throws an exception of type InvalidSettings in case the selected preconditioner is illegal.
*/
static void validatePreconditioner(const std::string& preconditioner) {
if (preconditioner.compare("ilu") != 0 && preconditioner.compare("diagonal") != 0 && preconditioner.compare("ildlt") != 0) {
throw exceptions::InvalidSettings();
}
}
};
} //namespace modelChecker

3
src/mrmc.cpp

@ -62,7 +62,7 @@ void setUpConsoleLogging() {
int main(const int argc, const char* argv[]) {
setUpFileLogging();
mrmc::settings::Settings* s = NULL;
mrmc::settings::Settings* s = nullptr;
LOG4CPLUS_INFO(logger, "This is the Markov Reward Model Checker (MRMC) by i2 of RWTH Aachen University.");
@ -74,6 +74,7 @@ int main(const int argc, const char* argv[]) {
LOG4CPLUS_INFO(logger, "MRMC command invoked " << commandStream.str());
try {
mrmc::settings::Settings::registerModule<mrmc::modelChecker::GmmxxDtmcPrctlModelChecker<double> >();
s = mrmc::settings::newInstance(argc, argv, nullptr);
} catch (mrmc::exceptions::InvalidSettings& e) {
LOG4CPLUS_FATAL(logger, "InvalidSettings error: " << e.what());

Loading…
Cancel
Save