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