Browse Source

commit to switch workplace

Former-commit-id: c50e423557
tempestpy_adaptions
dehnert 9 years ago
parent
commit
4b24be7204
  1. 24
      src/storage/dd/CuddBdd.cpp
  2. 14
      src/storage/dd/CuddBdd.h

24
src/storage/dd/CuddBdd.cpp

@ -367,6 +367,30 @@ namespace storm {
return result; return result;
} }
std::pair<std::vector<storm::expressions::Expression>, std::unordered_map<std::pair<uint_fast64_t, uint_fast64_t>, storm::expressions::Variable>> Bdd<DdType::CUDD>::toExpression(storm::expressions::ExpressionManager& manager, std::unordered_map<uint_fast64_t, storm::expressions::Expression> const& indexToExpressionMap) const {
std::pair<std::vector<storm::expressions::Expression>, std::unordered_map<std::pair<uint_fast64_t, uint_fast64_t>, storm::expressions::Variable>> result;
// Create (and maintain) a mapping from the DD nodes to a counter that says the how-many-th node (within the
// nodes of equal index) the node was.
std::unordered_map<DdNode*, uint_fast64_t> nodeToCounterMap;
this->toExpressionRec(this->getCuddDdNode(), this->getDdManager()->getCuddManager(), manager, result.first, result.second, nodeToCounterMap);
return result;
}
void Bdd<DdType::CUDD>::toExpressionRec(DdNode const* f, Cudd const& ddManager, storm::expressions::ExpressionManager& manager, std::vector<storm::expressions::Expression>& expressions, std::unordered_map<std::pair<uint_fast64_t, uint_fast64_t>, storm::expressions::Variable>& countIndexToVariablePair, std::unordered_map<DdNode*, uint_fast64_t>& nodeToCounterMap) const {
DdNode const* F = Cudd_Regular(f);
// Terminal cases.
if (F == Cudd_ReadOne(ddManager.getManager())) {
}
// Non-terminal cases.
// (1) Check if we have seen the node before.
auto nodeIt = nodeToCounterMap.find();
}
void Bdd<DdType::CUDD>::toVectorRec(DdNode const* dd, Cudd const& manager, storm::storage::BitVector& result, Odd<DdType::CUDD> const& rowOdd, bool complement, uint_fast64_t currentRowLevel, uint_fast64_t maxLevel, uint_fast64_t currentRowOffset, std::vector<uint_fast64_t> const& ddRowVariableIndices) const { void Bdd<DdType::CUDD>::toVectorRec(DdNode const* dd, Cudd const& manager, storm::storage::BitVector& result, Odd<DdType::CUDD> const& rowOdd, bool complement, uint_fast64_t currentRowLevel, uint_fast64_t maxLevel, uint_fast64_t currentRowOffset, std::vector<uint_fast64_t> const& ddRowVariableIndices) const {
// If there are no more values to select, we can directly return. // If there are no more values to select, we can directly return.
if (dd == Cudd_ReadLogicZero(manager.getManager()) && !complement) { if (dd == Cudd_ReadLogicZero(manager.getManager()) && !complement) {

14
src/storage/dd/CuddBdd.h

@ -1,6 +1,7 @@
#ifndef STORM_STORAGE_DD_CUDDBDD_H_ #ifndef STORM_STORAGE_DD_CUDDBDD_H_
#define STORM_STORAGE_DD_CUDDBDD_H_ #define STORM_STORAGE_DD_CUDDBDD_H_
#include <unordered_map>
#include <boost/functional/hash.hpp> #include <boost/functional/hash.hpp>
#include "src/storage/dd/Bdd.h" #include "src/storage/dd/Bdd.h"
@ -303,6 +304,17 @@ namespace storm {
*/ */
storm::storage::BitVector toVector(storm::dd::Odd<DdType::CUDD> const& rowOdd) const; storm::storage::BitVector toVector(storm::dd::Odd<DdType::CUDD> const& rowOdd) const;
/*!
* Translates the function the BDD is representing to a set of expressions that characterize the function.
*
* @param manager The manager that is used to build the expression and, in particular, create new variables in.
* @param indexToExpressionMap A mapping from indices (of DD variables) to expressions with which they are
* to be replaced.
* @return A pair consisting of the created expressions and a mapping from pairs (i, j) to variables such
* that the i-th variable of level j is represented by the mapped-to variable.
*/
std::pair<std::vector<storm::expressions::Expression>, std::unordered_map<std::pair<uint_fast64_t, uint_fast64_t>, storm::expressions::Variable>> toExpression(storm::expressions::ExpressionManager& manager, std::unordered_map<uint_fast64_t, storm::expressions::Expression> const& indexToExpressionMap) const;
private: private:
/*! /*!
* Retrieves the CUDD BDD object associated with this DD. * Retrieves the CUDD BDD object associated with this DD.
@ -370,6 +382,8 @@ namespace storm {
*/ */
void toVectorRec(DdNode const* dd, Cudd const& manager, storm::storage::BitVector& result, Odd<DdType::CUDD> const& rowOdd, bool complement, uint_fast64_t currentRowLevel, uint_fast64_t maxLevel, uint_fast64_t currentRowOffset, std::vector<uint_fast64_t> const& ddRowVariableIndices) const; void toVectorRec(DdNode const* dd, Cudd const& manager, storm::storage::BitVector& result, Odd<DdType::CUDD> const& rowOdd, bool complement, uint_fast64_t currentRowLevel, uint_fast64_t maxLevel, uint_fast64_t currentRowOffset, std::vector<uint_fast64_t> const& ddRowVariableIndices) const;
void toExpressionRec(DdNode const* dd, Cudd const& ddManager, storm::expressions::ExpressionManager& manager, std::vector<storm::expressions::Expression>& expressions, std::unordered_map<std::pair<uint_fast64_t, uint_fast64_t>, storm::expressions::Variable>& countIndexToVariablePair, std::unordered_map<DdNode*, uint_fast64_t>& nodeToCounterMap) const;
// The BDD created by CUDD. // The BDD created by CUDD.
BDD cuddBdd; BDD cuddBdd;
}; };

Loading…
Cancel
Save