From 2d8cc2efcd8d8f1cb269cb3f29207e3fbdaec7d0 Mon Sep 17 00:00:00 2001 From: dehnert Date: Tue, 6 May 2014 18:14:45 +0200 Subject: [PATCH] Added reordering functionality to DD interface. Former-commit-id: ffb8ad62f132a26a650a988ba117f27c967fb524 --- src/storage/dd/CuddDdManager.cpp | 21 +++++++++++++++++++++ src/storage/dd/CuddDdManager.h | 26 ++++++++++++++++++++++++++ src/storage/prism/Program.cpp | 2 +- 3 files changed, 48 insertions(+), 1 deletion(-) diff --git a/src/storage/dd/CuddDdManager.cpp b/src/storage/dd/CuddDdManager.cpp index 64261d0aa..b3854ee36 100644 --- a/src/storage/dd/CuddDdManager.cpp +++ b/src/storage/dd/CuddDdManager.cpp @@ -224,6 +224,10 @@ namespace storm { Cudd& DdManager::getCuddManager() { return this->cuddManager; } + + Cudd const& DdManager::getCuddManager() const { + return this->cuddManager; + } std::vector DdManager::getDdVariableNames() const { // First, we initialize a list DD variables and their names. @@ -246,5 +250,22 @@ namespace storm { return result; } + + void DdManager::allowDynamicReordering(bool value) { + if (value) { + this->getCuddManager().AutodynEnable(CUDD_REORDER_GROUP_SIFT_CONV); + } else { + this->getCuddManager().AutodynDisable(); + } + } + + bool DdManager::isDynamicReorderingAllowed() const { + Cudd_ReorderingType type; + return this->getCuddManager().ReorderingStatus(&type); + } + + void DdManager::triggerReordering() { + this->getCuddManager().ReduceHeap(CUDD_REORDER_GROUP_SIFT_CONV, 0); + } } } \ No newline at end of file diff --git a/src/storage/dd/CuddDdManager.h b/src/storage/dd/CuddDdManager.h index 25844598c..6fba4d254 100644 --- a/src/storage/dd/CuddDdManager.h +++ b/src/storage/dd/CuddDdManager.h @@ -138,6 +138,25 @@ namespace storm { */ bool hasMetaVariable(std::string const& metaVariableName) const; + /*! + * Sets whether or not dynamic reordering is allowed for the DDs managed by this manager. + * + * @param value If set to true, dynamic reordering is allowed and forbidden otherwise. + */ + void allowDynamicReordering(bool value); + + /*! + * Retrieves whether dynamic reordering is currently allowed. + * + * @return True iff dynamic reordering is currently allowed. + */ + bool isDynamicReorderingAllowed() const; + + /*! + * Triggers a reordering of the DDs managed by this manager. + */ + void triggerReordering(); + private: /*! * Retrieves a list of names of the DD variables in the order of their index. @@ -153,6 +172,13 @@ namespace storm { */ Cudd& getCuddManager(); + /*! + * Retrieves the underlying CUDD manager. + * + * @return The underlying CUDD manager. + */ + Cudd const& getCuddManager() const; + // A mapping from variable names to the meta variable information. std::unordered_map> metaVariableMap; diff --git a/src/storage/prism/Program.cpp b/src/storage/prism/Program.cpp index 10a1114e6..617a1c52b 100644 --- a/src/storage/prism/Program.cpp +++ b/src/storage/prism/Program.cpp @@ -13,7 +13,7 @@ namespace storm { Program::Program(ModelType modelType, std::vector const& constants, std::vector const& globalBooleanVariables, std::vector const& globalIntegerVariables, std::vector const& formulas, std::vector const& modules, std::vector const& rewardModels, bool fixInitialConstruct, storm::prism::InitialConstruct const& initialConstruct, std::vector