From 237690581063d32573aa304ced44d9cd583c901f Mon Sep 17 00:00:00 2001 From: dehnert Date: Thu, 24 Sep 2015 17:44:26 +0200 Subject: [PATCH] more work Former-commit-id: 7182125a9eb7da7e54e149a6c3517a238940718e --- src/storage/dd/CuddBdd.cpp | 20 +++--- src/storage/prism/Program.cpp | 10 +++ src/storage/prism/Program.h | 7 ++ .../prism/menu_games/AbstractProgram.cpp | 25 ++------ .../menu_games/AbstractionDdInformation.cpp | 6 +- .../menu_games/AbstractionDdInformation.h | 3 +- .../prism/menu_games/StateSetAbstractor.cpp | 64 +++++++++---------- .../prism/menu_games/StateSetAbstractor.h | 29 ++++++--- .../prism/menu_games/VariablePartition.cpp | 9 +-- .../abstraction/PrismMenuGameTest.cpp | 4 +- 10 files changed, 99 insertions(+), 78 deletions(-) diff --git a/src/storage/dd/CuddBdd.cpp b/src/storage/dd/CuddBdd.cpp index fc673e0f2..b16421332 100644 --- a/src/storage/dd/CuddBdd.cpp +++ b/src/storage/dd/CuddBdd.cpp @@ -395,14 +395,18 @@ namespace storm { storm::expressions::Variable Bdd::toExpressionRec(DdNode const* dd, Cudd const& ddManager, storm::expressions::ExpressionManager& manager, std::vector& expressions, std::unordered_map, storm::expressions::Variable>& countIndexToVariablePair, std::unordered_map& nodeToCounterMap, std::vector& nextCounterForIndex, std::unordered_map const& indexToExpressionMap) const { STORM_LOG_ASSERT(dd == Cudd_Regular(dd), "Expected non-negated BDD node."); - // First, try to look up the current node. - auto nodeCounterIt = nodeToCounterMap.find(dd); - if (nodeCounterIt != nodeToCounterMap.end()) { - // If we have found the node, this means we can look up the counter-index pair and get the corresponding variable. - auto variableIt = countIndexToVariablePair.find(std::make_pair(nodeCounterIt->second, dd->index)); - STORM_LOG_ASSERT(variableIt != countIndexToVariablePair.end(), "Unable to find node."); - return variableIt->second; - } + // First, try to look up the current node if it's not a terminal node. The result of terminal nodes must not + // be reused, since we want to be able to incrementally refine the expression later and that requires + // different variables for the one-leaf. +// if (!Cudd_IsConstant(dd)) { + auto nodeCounterIt = nodeToCounterMap.find(dd); + if (nodeCounterIt != nodeToCounterMap.end()) { + // If we have found the node, this means we can look up the counter-index pair and get the corresponding variable. + auto variableIt = countIndexToVariablePair.find(std::make_pair(nodeCounterIt->second, dd->index)); + STORM_LOG_ASSERT(variableIt != countIndexToVariablePair.end(), "Unable to find node."); + return variableIt->second; + } +// } // If the node was not yet encountered, we create a variable and associate it with the appropriate expression. storm::expressions::Variable newVariable = manager.declareFreshBooleanVariable(); diff --git a/src/storage/prism/Program.cpp b/src/storage/prism/Program.cpp index 7d1486501..06e6fead7 100644 --- a/src/storage/prism/Program.cpp +++ b/src/storage/prism/Program.cpp @@ -360,6 +360,16 @@ namespace storm { return this->labels; } + std::vector Program::getAllGuards() const { + std::vector allGuards; + for (auto const& module : modules) { + for (auto const& command : module.getCommands()) { + allGuards.push_back(command.getGuardExpression()); + } + } + return allGuards; + } + storm::expressions::Expression const& Program::getLabelExpression(std::string const& label) const { auto const& labelIndexPair = labelToIndexMap.find(label); STORM_LOG_THROW(labelIndexPair != labelToIndexMap.end(), storm::exceptions::InvalidArgumentException, "Cannot retrieve expression for unknown label '" << label << "'."); diff --git a/src/storage/prism/Program.h b/src/storage/prism/Program.h index 8185472ee..188fbb58f 100644 --- a/src/storage/prism/Program.h +++ b/src/storage/prism/Program.h @@ -360,6 +360,13 @@ namespace storm { */ std::vector