diff --git a/src/parser/PrctlFileParser.cpp b/src/parser/PrctlFileParser.cpp index f155a11cb..50f0f5502 100644 --- a/src/parser/PrctlFileParser.cpp +++ b/src/parser/PrctlFileParser.cpp @@ -24,7 +24,7 @@ PrctlFileParser::~PrctlFileParser() { //intentionally left empty } -std::list*> parseFormulas(std::string filename) { +std::list*> PrctlFileParser::parseFormulas(std::string filename) { // Open file std::ifstream inputFileStream(filename, std::ios::in); std::list*> result; diff --git a/src/storm.cpp b/src/storm.cpp index abd7c04c2..8c940c0d2 100644 --- a/src/storm.cpp +++ b/src/storm.cpp @@ -31,6 +31,8 @@ #include "src/utility/ErrorHandling.h" #include "src/formula/Prctl.h" +#include "src/parser/PrctlFileParser.h" + #include "log4cplus/logger.h" #include "log4cplus/loggingmacros.h" #include "log4cplus/consoleappender.h" @@ -432,6 +434,18 @@ void testCheckingConsensus(storm::models::Mdp& mdp) { delete mc; } +/*! + * Check method for DTMCs + * @param dtmc Reference to the DTMC to check + */ +void checkDtmc(std::shared_ptr> dtmc) { + dtmc->printModelInformationToStream(std::cout); +} + +void checkMdp(std::shared_ptr> mdp) { + mdp->printModelInformationToStream(std::cout); +} + /*! * Simple testing procedure. */ @@ -439,22 +453,26 @@ void testChecking() { storm::settings::Settings* s = storm::settings::instance(); storm::parser::AutoParser parser(s->getString("trafile"), s->getString("labfile"), s->getString("staterew"), s->getString("transrew")); - if (parser.getType() == storm::models::DTMC) { - std::shared_ptr> dtmc = parser.getModel>(); - dtmc->printModelInformationToStream(std::cout); - - // testCheckingDie(*dtmc); - // testCheckingCrowds(*dtmc); - // testCheckingSynchronousLeader(*dtmc, 6); - } else if (parser.getType() == storm::models::MDP) { - std::shared_ptr> mdp = parser.getModel>(); - mdp->printModelInformationToStream(std::cout); - - // testCheckingDice(*mdp); - // testCheckingAsynchLeader(*mdp); - // testCheckingConsensus(*mdp); - } else { - std::cout << "Input is neither a DTMC nor an MDP." << std::endl; + if (s->isSet("prctl")) { + LOG4CPLUS_INFO(logger, "Parsing prctl file"+ s->getString("prctl")); + storm::parser::PrctlFileParser fileParser; + std::list*> formulaList = fileParser.parseFormulas(s->getString("prctl")); + + } + + + switch (parser.getType()) { + case storm::models::DTMC: + LOG4CPLUS_INFO(logger, "Model was detected as DTMC"); + checkDtmc(parser.getModel>()); + break; + case storm::models::MDP: + LOG4CPLUS_INFO(logger, "Model was detected as MDP"); + checkMdp(parser.getModel>()); + break; + default: + LOG4CPLUS_ERROR(logger, "The model type could not be determined correctly."); + break; } } diff --git a/src/utility/Settings.cpp b/src/utility/Settings.cpp index d6e2f5bc3..d43a7b785 100644 --- a/src/utility/Settings.cpp +++ b/src/utility/Settings.cpp @@ -137,6 +137,9 @@ void Settings::initDescriptions() { ("test-prctl", bpo::value(), "name of prctl file") ("trafile", bpo::value()->required(), "name of the .tra file") ("labfile", bpo::value()->required(), "name of the .lab file") + ("prctl", bpo::value()->default_value(""), "text file containing prctl formulas") + ("csl", bpo::value()->default_value(""), "text file containing csl formulas") + ("ltl", bpo::value()->default_value(""), "text file containing ltl formulas") ("transrew", bpo::value()->default_value(""), "name of transition reward file") ("staterew", bpo::value()->default_value(""), "name of state reward file") ("fix-deadlocks", "insert self-loops for states without outgoing transitions")