From dbd6c02f6a77169f8462e5a07ecd865d494183f9 Mon Sep 17 00:00:00 2001 From: PBerger Date: Sat, 9 Feb 2013 18:34:53 +0100 Subject: [PATCH 1/8] Updated CMakeLists.txt, Cotire Usage is now restricted to Linux/Windows and deactivated on APPLE systems. --- CMakeLists.txt | 48 ++++++++++++++++++++++++++++++++---------------- 1 file changed, 32 insertions(+), 16 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b19636778..0ffe20f22 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -152,14 +152,24 @@ add_executable(storm-tests ${STORM_TEST_SOURCES} ${STORM_TEST_HEADERS}) target_link_libraries(storm ${Boost_LIBRARIES}) target_link_libraries(storm-tests ${Boost_LIBRARIES}) -# Include Cotire for PCH Generation -set (CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/resources/cmake") -include(cotire) - -cotire(storm) -target_link_libraries(storm_unity ${Boost_LIBRARIES}) -#cotire(storm-tests) - +set (STORM_USE_COTIRE ON) +if (APPLE) + set(STORM_USE_COTIRE OFF) +endif(APPLE) + +# Print Cotire Usage Status +message (STATUS "Using Cotire: ${STORM_USE_COTIRE}") + +if (STORM_USE_COTIRE) + # Include Cotire for PCH Generation + set (CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/resources/cmake") + include(cotire) + + cotire(storm) + target_link_libraries(storm_unity ${Boost_LIBRARIES}) + #cotire(storm-tests) +endif() + # Add a target to generate API documentation with Doxygen if(DOXYGEN_FOUND) set(CMAKE_DOXYGEN_OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/doc") @@ -187,27 +197,33 @@ endif(GTEST_INCLUDE_DIR) if (LOG4CPLUS_INCLUDE_DIR) include_directories(${LOG4CPLUS_INCLUDE_DIR}) target_link_libraries(storm ${LOG4CPLUS_LIBRARIES}) - target_link_libraries(storm_unity ${LOG4CPLUS_LIBRARIES}) + if (STORM_USE_COTIRE) + target_link_libraries(storm_unity ${LOG4CPLUS_LIBRARIES}) + endif(STORM_USE_COTIRE) target_link_libraries(storm-tests ${LOG4CPLUS_LIBRARIES}) # On Linux, we have to link against librt if (UNIX AND NOT APPLE) - target_link_libraries(storm rt) - target_link_libraries(storm_unity rt) - target_link_libraries(storm-tests rt) + target_link_libraries(storm rt) + if (STORM_USE_COTIRE) + target_link_libraries(storm_unity rt) + endif(STORM_USE_COTIRE) + target_link_libraries(storm-tests rt) endif(UNIX AND NOT APPLE) endif(LOG4CPLUS_INCLUDE_DIR) if (THREADS_FOUND) include_directories(${THREADS_INCLUDE_DIRS}) - target_link_libraries(storm ${CMAKE_THREAD_LIBS_INIT}) - target_link_libraries(storm_unity ${CMAKE_THREAD_LIBS_INIT}) + target_link_libraries(storm ${CMAKE_THREAD_LIBS_INIT}) + if (STORM_USE_COTIRE) + target_link_libraries(storm_unity ${CMAKE_THREAD_LIBS_INIT}) + endif(STORM_USE_COTIRE) target_link_libraries(storm-tests ${CMAKE_THREAD_LIBS_INIT}) endif(THREADS_FOUND) # Configure a header file to pass some of the CMake settings to the source code configure_file ( - "${PROJECT_SOURCE_DIR}/storm-config.h.in" - "${PROJECT_BINARY_DIR}/storm-config.h" + "${PROJECT_SOURCE_DIR}/storm-config.h.in" + "${PROJECT_BINARY_DIR}/storm-config.h" ) add_custom_target(memcheck valgrind --leak-check=full --show-reachable=yes ${PROJECT_BINARY_DIR}/storm -v --fix-deadlocks ${PROJECT_SOURCE_DIR}/examples/dtmc/crowds/crowds5_5.tra examples/dtmc/crowds/crowds5_5.lab From c02271a36ae43873a6c200962f5bb2b00348ad26 Mon Sep 17 00:00:00 2001 From: dehnert Date: Sun, 10 Feb 2013 13:55:37 +0100 Subject: [PATCH 2/8] Fixed typo in CTMC class. Moved GraphAnalyzer to utility. --- src/modelchecker/EigenDtmcPrctlModelChecker.h | 4 ++-- src/modelchecker/GmmxxDtmcPrctlModelChecker.h | 6 +++--- src/models/Ctmc.h | 2 +- src/storm.cpp | 1 - src/{solver => utility}/GraphAnalyzer.h | 10 +++++----- 5 files changed, 11 insertions(+), 12 deletions(-) rename src/{solver => utility}/GraphAnalyzer.h (97%) diff --git a/src/modelchecker/EigenDtmcPrctlModelChecker.h b/src/modelchecker/EigenDtmcPrctlModelChecker.h index a7b749129..61867620d 100644 --- a/src/modelchecker/EigenDtmcPrctlModelChecker.h +++ b/src/modelchecker/EigenDtmcPrctlModelChecker.h @@ -12,7 +12,7 @@ #include "src/models/Dtmc.h" #include "src/modelchecker/DtmcPrctlModelChecker.h" -#include "src/solver/GraphAnalyzer.h" +#include "src/utility/GraphAnalyzer.h" #include "src/utility/ConstTemplates.h" #include "src/exceptions/NoConvergenceException.h" @@ -128,7 +128,7 @@ public: // all states that have probability 0 and 1 of satisfying the until-formula. storm::storage::BitVector notExistsPhiUntilPsiStates(this->getModel().getNumberOfStates()); storm::storage::BitVector alwaysPhiUntilPsiStates(this->getModel().getNumberOfStates()); - storm::solver::GraphAnalyzer::getPhiUntilPsiStates(this->getModel(), *leftStates, *rightStates, ¬ExistsPhiUntilPsiStates, &alwaysPhiUntilPsiStates); + storm::utility::GraphAnalyzer::getPhiUntilPsiStates(this->getModel(), *leftStates, *rightStates, ¬ExistsPhiUntilPsiStates, &alwaysPhiUntilPsiStates); notExistsPhiUntilPsiStates.complement(); delete leftStates; diff --git a/src/modelchecker/GmmxxDtmcPrctlModelChecker.h b/src/modelchecker/GmmxxDtmcPrctlModelChecker.h index 009ecd678..a1b11af0a 100644 --- a/src/modelchecker/GmmxxDtmcPrctlModelChecker.h +++ b/src/modelchecker/GmmxxDtmcPrctlModelChecker.h @@ -12,7 +12,7 @@ #include "src/models/Dtmc.h" #include "src/modelchecker/DtmcPrctlModelChecker.h" -#include "src/solver/GraphAnalyzer.h" +#include "src/utility/GraphAnalyzer.h" #include "src/utility/Vector.h" #include "src/utility/ConstTemplates.h" #include "src/utility/Settings.h" @@ -113,7 +113,7 @@ public: // all states that have probability 0 and 1 of satisfying the until-formula. storm::storage::BitVector notExistsPhiUntilPsiStates(this->getModel().getNumberOfStates()); storm::storage::BitVector alwaysPhiUntilPsiStates(this->getModel().getNumberOfStates()); - storm::solver::GraphAnalyzer::getPhiUntilPsiStates(this->getModel(), *leftStates, *rightStates, ¬ExistsPhiUntilPsiStates, &alwaysPhiUntilPsiStates); + storm::utility::GraphAnalyzer::getPhiUntilPsiStates(this->getModel(), *leftStates, *rightStates, ¬ExistsPhiUntilPsiStates, &alwaysPhiUntilPsiStates); notExistsPhiUntilPsiStates.complement(); // Delete sub-results that are obsolete now. @@ -253,7 +253,7 @@ public: // Determine which states have a reward of infinity by definition. storm::storage::BitVector infinityStates(this->getModel().getNumberOfStates()); storm::storage::BitVector trueStates(this->getModel().getNumberOfStates(), true); - storm::solver::GraphAnalyzer::getAlwaysPhiUntilPsiStates(this->getModel(), trueStates, *targetStates, &infinityStates); + storm::utility::GraphAnalyzer::getAlwaysPhiUntilPsiStates(this->getModel(), trueStates, *targetStates, &infinityStates); infinityStates.complement(); // Create resulting vector. diff --git a/src/models/Ctmc.h b/src/models/Ctmc.h index 263a62fe9..ef6cd4658 100644 --- a/src/models/Ctmc.h +++ b/src/models/Ctmc.h @@ -139,7 +139,7 @@ public: */ storm::models::GraphTransitions& getBackwardTransitions() { if (this->backwardTransitions == nullptr) { - this->backwardTransitions = new storm::models::GraphTransitions(this->probabilityMatrix, false); + this->backwardTransitions = new storm::models::GraphTransitions(this->rateMatrix, false); } return *this->backwardTransitions; } diff --git a/src/storm.cpp b/src/storm.cpp index 2015e85e4..f0b528f99 100644 --- a/src/storm.cpp +++ b/src/storm.cpp @@ -26,7 +26,6 @@ #include "src/modelchecker/GmmxxDtmcPrctlModelChecker.h" #include "src/parser/AutoParser.h" #include "src/parser/PrctlParser.h" -#include "src/solver/GraphAnalyzer.h" #include "src/utility/Settings.h" #include "src/formula/Formulas.h" diff --git a/src/solver/GraphAnalyzer.h b/src/utility/GraphAnalyzer.h similarity index 97% rename from src/solver/GraphAnalyzer.h rename to src/utility/GraphAnalyzer.h index 70b6b10f5..0e3479338 100644 --- a/src/solver/GraphAnalyzer.h +++ b/src/utility/GraphAnalyzer.h @@ -5,8 +5,8 @@ * Author: Christian Dehnert */ -#ifndef STORM_SOLVER_GRAPHANALYZER_H_ -#define STORM_SOLVER_GRAPHANALYZER_H_ +#ifndef STORM_UTILITY_GRAPHANALYZER_H_ +#define STORM_UTILITY_GRAPHANALYZER_H_ #include "src/models/Dtmc.h" #include "src/exceptions/InvalidArgumentException.h" @@ -18,7 +18,7 @@ extern log4cplus::Logger logger; namespace storm { -namespace solver { +namespace utility { class GraphAnalyzer { public: @@ -148,8 +148,8 @@ public: }; -} // namespace solver +} // namespace utility } // namespace storm -#endif /* STORM_SOLVER_GRAPHANALYZER_H_ */ +#endif /* STORM_UTILITY_GRAPHANALYZER_H_ */ From 7d95a45633fc8ec43388727484ac9ecc628cedd4 Mon Sep 17 00:00:00 2001 From: dehnert Date: Sun, 10 Feb 2013 23:52:27 +0100 Subject: [PATCH 3/8] Fixed bug in AbstractModelChecker: it does now correctly inherit from a lot more interface classes. NOTE: checking a formula on a model checker that does not support it failed silently. This should NOT be the case. Re-enabled DEBUG option for cmake. NOTE: why was this disabled anyway? Introduced another layer AbstractDeterministicModel and AbstractNonDeterministicModel in model hierarchy to allow for easily distinguishing these classes. Made necessary adaptions in (hopefully) all classes. Move the graph analyzer to utility folder. --- CMakeLists.txt | 14 +- src/formula/ReachabilityReward.h | 1 - src/modelchecker/AbstractModelChecker.h | 13 +- src/modelchecker/DtmcPrctlModelChecker.h | 5 +- src/modelchecker/GmmxxDtmcPrctlModelChecker.h | 28 ++-- src/models/AbstractDeterministicModel.h | 61 +++++++ src/models/AbstractModel.h | 140 +++++++++++++++- src/models/AbstractNonDeterministicModel.h | 49 ++++++ src/models/Ctmc.h | 127 ++------------ src/models/Ctmdp.h | 152 ++--------------- src/models/Dtmc.h | 156 ++---------------- src/models/GraphTransitions.h | 6 +- src/models/Mdp.h | 152 ++--------------- src/parser/AutoParser.cpp | 79 --------- src/parser/AutoParser.h | 76 ++++++++- src/storm.cpp | 2 +- src/utility/GraphAnalyzer.h | 10 +- src/utility/IoUtility.cpp | 2 +- test/parser/ParseMdpTest.cpp | 2 +- 19 files changed, 414 insertions(+), 661 deletions(-) create mode 100644 src/models/AbstractDeterministicModel.h create mode 100644 src/models/AbstractNonDeterministicModel.h delete mode 100644 src/parser/AutoParser.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 0ffe20f22..8cf280117 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -50,13 +50,13 @@ option(USE_POPCNT "Sets whether the popcnt instruction is going to be used." ON) option(USE_BOOST_STATIC_LIBRARIES "Sets whether the Boost libraries should be linked statically." ON) # If the DEBUG option was turned on, we will target a debug version and a release version otherwise -#if (DEBUG) -# set (CMAKE_BUILD_TYPE "DEBUG") -# message(STATUS "Building DEBUG version.") -#else() -# set (CMAKE_BUILD_TYPE "RELEASE") -# message(STATUS "Building RELEASE version.") -#endif() +if (DEBUG) + set (CMAKE_BUILD_TYPE "DEBUG") + message(STATUS "Building DEBUG version.") +else() + set (CMAKE_BUILD_TYPE "RELEASE") + message(STATUS "Building RELEASE version.") +endif() message(STATUS "CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}") message(STATUS "CMAKE_BUILD_TYPE (ENV): $ENV{CMAKE_BUILD_TYPE}") diff --git a/src/formula/ReachabilityReward.h b/src/formula/ReachabilityReward.h index ad8171642..a725e202a 100644 --- a/src/formula/ReachabilityReward.h +++ b/src/formula/ReachabilityReward.h @@ -11,7 +11,6 @@ #include "src/formula/AbstractPathFormula.h" #include "src/formula/AbstractStateFormula.h" #include "src/formula/AbstractFormulaChecker.h" -#include "src/modelchecker/AbstractModelChecker.h" namespace storm { namespace formula { diff --git a/src/modelchecker/AbstractModelChecker.h b/src/modelchecker/AbstractModelChecker.h index 5e0920231..69bbeb9da 100644 --- a/src/modelchecker/AbstractModelChecker.h +++ b/src/modelchecker/AbstractModelChecker.h @@ -33,12 +33,19 @@ template class AbstractModelChecker : public virtual storm::formula::IApModelChecker, public virtual storm::formula::IAndModelChecker, + public virtual storm::formula::IOrModelChecker, + public virtual storm::formula::INotModelChecker, + public virtual storm::formula::IUntilModelChecker, public virtual storm::formula::IEventuallyModelChecker, public virtual storm::formula::IGloballyModelChecker, public virtual storm::formula::INextModelChecker, - public virtual storm::formula::INotModelChecker, - public virtual storm::formula::IOrModelChecker - { + public virtual storm::formula::IBoundedUntilModelChecker, + public virtual storm::formula::IBoundedEventuallyModelChecker, + public virtual storm::formula::INoBoundOperatorModelChecker, + public virtual storm::formula::IPathBoundOperatorModelChecker, + public virtual storm::formula::IReachabilityRewardModelChecker, + public virtual storm::formula::ICumulativeRewardModelChecker, + public virtual storm::formula::IInstantaneousRewardModelChecker { public: template