3#include "storm-config.h"
8#include <unordered_map>
28template<DdType LibraryType>
31template<DdType LibraryType,
typename ValueType>
39 template<DdType LibraryType,
typename ValueType>
70 std::vector<uint_fast64_t>
const& sortedDdVariableIndices,
71 std::function<
bool(uint64_t)>
const& filter);
143 template<
typename ValueType>
291 uint_fast64_t
getNonZeroCount(uint_fast64_t numberOfDdVariables)
const;
341 void exportToDot(std::string
const& filename, std::vector<std::string>
const& ddVariableNamesAsStrings,
bool showVariablesIfPossible =
true)
const;
355 template<
typename ValueType>
375 std::pair<std::vector<storm::expressions::Expression>, std::unordered_map<uint_fast64_t, storm::expressions::Variable>>
toExpression(
384 Odd createOdd(std::vector<uint_fast64_t>
const& ddVariableIndices)
const;
394 template<
typename ValueType>
395 void filterExplicitVector(
Odd const& odd, std::vector<uint_fast64_t>
const& ddVariableIndices, std::vector<ValueType>
const& sourceValues,
396 std::vector<ValueType>& targetValues)
const;
415 std::vector<InternalBdd<DdType::CUDD>>
splitIntoGroups(std::vector<uint_fast64_t>
const& ddGroupVariableIndices)
const;
419#ifdef STORM_HAVE_CUDD
425 cudd::BDD getCuddBdd() const;
432 DdNode* getCuddDdNode() const;
436#ifdef STORM_HAVE_CUDD
449 static DdNode* fromVectorRec(::DdManager* manager, uint_fast64_t& currentOffset, uint_fast64_t currentLevel, uint_fast64_t maxLevel, Odd const& odd,
450 std::vector<uint_fast64_t> const& ddVariableIndices, std::function<bool(uint64_t)> const& filter);
465 void toVectorRec(DdNode const* dd, cudd::Cudd const& manager, storm::storage::BitVector& result, Odd const& rowOdd, bool complement,
466 uint_fast64_t currentRowLevel, uint_fast64_t maxLevel, uint_fast64_t currentRowOffset,
467 std::vector<uint_fast64_t> const& ddRowVariableIndices) const;
472 std::size_t operator()(std::pair<DdNode const*, bool>
const& key)
const;
487 static std::shared_ptr<Odd> createOddRec(DdNode
const*
dd, cudd::Cudd
const& manager, uint_fast64_t currentLevel, uint_fast64_t maxLevel,
488 std::vector<uint_fast64_t>
const& ddVariableIndices,
489 std::vector<std::unordered_map<DdNode
const*, std::shared_ptr<Odd>>>& uniqueTableForLevels);
505 template<
typename ValueType>
506 static void filterExplicitVectorRec(DdNode
const*
dd, cudd::Cudd
const& manager, uint_fast64_t currentLevel,
bool complement, uint_fast64_t maxLevel,
507 std::vector<uint_fast64_t>
const& ddVariableIndices, uint_fast64_t currentOffset,
storm::dd::Odd const& odd,
508 std::vector<ValueType>& result, uint_fast64_t& currentIndex, std::vector<ValueType>
const& values);
524 static void filterExplicitVectorRec(DdNode
const*
dd, cudd::Cudd
const& manager, uint_fast64_t currentLevel,
bool complement, uint_fast64_t maxLevel,
525 std::vector<uint_fast64_t>
const& ddVariableIndices, uint_fast64_t currentOffset,
storm::dd::Odd const& odd,
548 std::unordered_map<uint_fast64_t, storm::expressions::Variable>& indexToVariableMap,
550 std::unordered_map<DdNode const*, uint_fast64_t>& nodeToCounterMap, std::vector<uint_fast64_t>& nextCounterForIndex);
552 void splitIntoGroupsRec(DdNode*
dd,
bool negated, std::vector<
InternalBdd<DdType::CUDD>>& groups, std::vector<uint_fast64_t>
const& ddGroupVariableIndices,
553 uint_fast64_t currentLevel, uint_fast64_t maxLevel)
const;
565struct hash<
storm::dd::InternalBdd<storm::dd::DdType::CUDD>> {
566#ifdef STORM_HAVE_CUDD
568 return reinterpret_cast<std::size_t
>(key.cuddBdd.getNode());
573 "This version of Storm was compiled without support for CUDD. Yet, a method was called that requires this support. Please choose a "
574 "version of Storm with CUDD support.");
static InternalBdd< storm::dd::DdType::CUDD > fromVector(InternalDdManager< DdType::CUDD > const *ddManager, Odd const &odd, std::vector< uint_fast64_t > const &sortedDdVariableIndices, std::function< bool(uint64_t)> const &filter)
Builds a BDD representing the indices that make the given filter function evaluate to true.
uint_fast64_t getIndex() const
Retrieves the index of the topmost variable in the BDD.
InternalBdd< DdType::CUDD > exclusiveOr(InternalBdd< DdType::CUDD > const &other) const
Performs a logical exclusive-or of the current and the given BDD.
void filterExplicitVector(Odd const &odd, std::vector< uint_fast64_t > const &ddVariableIndices, std::vector< ValueType > const &sourceValues, std::vector< ValueType > &targetValues) const
Uses the current BDD to filter values from the explicit vector.
uint_fast64_t getNodeCount() const
Retrieves the number of nodes necessary to represent the DD.
InternalBdd(InternalBdd< DdType::CUDD > &&other)=default
InternalBdd< DdType::CUDD > & operator|=(InternalBdd< DdType::CUDD > const &other)
Performs a logical or of the current and the given BDD and assigns it to the current BDD.
uint_fast64_t getLevel() const
Retrieves the level of the topmost variable in the BDD.
InternalBdd & operator=(InternalBdd< DdType::CUDD > &&other)=default
InternalBdd(InternalBdd< DdType::CUDD > const &other)=default
InternalBdd & operator=(InternalBdd< DdType::CUDD > const &other)=default
void exportToDot(std::string const &filename, std::vector< std::string > const &ddVariableNamesAsStrings, bool showVariablesIfPossible=true) const
Exports the BDD to the given file in the dot format.
std::vector< InternalBdd< DdType::CUDD > > splitIntoGroups(std::vector< uint_fast64_t > const &ddGroupVariableIndices) const
Splits the BDD into several BDDs that differ in the encoding of the given group variables (given via ...
InternalBdd< DdType::CUDD > swapVariables(std::vector< InternalBdd< DdType::CUDD > > const &from, std::vector< InternalBdd< DdType::CUDD > > const &to) const
Swaps the given pairs of DD variables in the BDD.
void exportToText(std::string const &filename) const
Exports the DD to the given file in a textual format as specified in Sylvan.
InternalBdd< DdType::CUDD > ite(InternalBdd< DdType::CUDD > const &thenBdd, InternalBdd< DdType::CUDD > const &elseBdd) const
Performs an if-then-else with the given operands, i.e.
InternalBdd< DdType::CUDD > operator&&(InternalBdd< DdType::CUDD > const &other) const
Performs a logical and of the current and the given BDD.
bool operator==(InternalBdd< DdType::CUDD > const &other) const
Retrieves whether the two BDDs represent the same function.
InternalBdd< DdType::CUDD > existsAbstract(InternalBdd< DdType::CUDD > const &cube) const
Existentially abstracts from the given cube.
InternalBdd< DdType::CUDD > inverseRelationalProductWithExtendedRelation(InternalBdd< DdType::CUDD > const &relation, std::vector< InternalBdd< DdType::CUDD > > const &rowVariables, std::vector< InternalBdd< DdType::CUDD > > const &columnVariables) const
Computes the inverse relational product of the current BDD and the given BDD representing a relation ...
InternalBdd< DdType::CUDD > & complement()
Logically complements the current BDD.
InternalBdd< DdType::CUDD > operator||(InternalBdd< DdType::CUDD > const &other) const
Performs a logical or of the current and the given BDD.
storm::storage::BitVector toVector(storm::dd::Odd const &rowOdd, std::vector< uint_fast64_t > const &ddVariableIndices) const
Converts the BDD to a bit vector.
InternalBdd< DdType::CUDD > implies(InternalBdd< DdType::CUDD > const &other) const
Performs a logical implication of the current and the given BDD.
bool isOne() const
Retrieves whether this DD represents the constant one function.
std::pair< std::vector< storm::expressions::Expression >, std::unordered_map< uint_fast64_t, storm::expressions::Variable > > toExpression(storm::expressions::ExpressionManager &manager) const
Translates the function the BDD is representing to a set of expressions that characterize the functio...
InternalBdd< DdType::CUDD > restrict(InternalBdd< DdType::CUDD > const &constraint) const
Computes the restriction of the current BDD with the given constraint.
InternalBdd< DdType::CUDD > universalAbstract(InternalBdd< DdType::CUDD > const &cube) const
Universally abstracts from the given cube.
InternalBdd< DdType::CUDD > relationalProduct(InternalBdd< DdType::CUDD > const &relation, std::vector< InternalBdd< DdType::CUDD > > const &rowVariables, std::vector< InternalBdd< DdType::CUDD > > const &columnVariables) const
Computes the relational product of the current BDD and the given BDD representing a relation.
bool isZero() const
Retrieves whether this DD represents the constant zero function.
bool operator!=(InternalBdd< DdType::CUDD > const &other) const
Retrieves whether the two BDDs represent different functions.
InternalBdd< DdType::CUDD > inverseRelationalProduct(InternalBdd< DdType::CUDD > const &relation, std::vector< InternalBdd< DdType::CUDD > > const &rowVariables, std::vector< InternalBdd< DdType::CUDD > > const &columnVariables) const
Computes the inverse relational product of the current BDD and the given BDD representing a relation.
InternalAdd< DdType::CUDD, ValueType > toAdd() const
Converts a BDD to an equivalent ADD.
Odd createOdd(std::vector< uint_fast64_t > const &ddVariableIndices) const
Creates an ODD based on the current BDD.
uint_fast64_t getLeafCount() const
Retrieves the number of leaves of the DD.
InternalBdd< DdType::CUDD > getSupport() const
Retrieves the support of the current BDD.
InternalBdd< DdType::CUDD > constrain(InternalBdd< DdType::CUDD > const &constraint) const
Computes the constraint of the current BDD with the given constraint.
uint_fast64_t getNonZeroCount(uint_fast64_t numberOfDdVariables) const
Retrieves the number of encodings that are mapped to a non-zero value.
InternalBdd< DdType::CUDD > existsAbstractRepresentative(InternalBdd< DdType::CUDD > const &cube) const
Similar to existsAbstract, but does not abstract but rather picks a valuation for the variables of th...
InternalBdd< DdType::CUDD > operator!() const
Logically inverts the current BDD.
InternalBdd< DdType::CUDD > iff(InternalBdd< DdType::CUDD > const &other) const
Performs a logical iff of the current and the given BDD.
InternalBdd< DdType::CUDD > andExists(InternalBdd< DdType::CUDD > const &other, InternalBdd< storm::dd::DdType::CUDD > const &cube) const
Computes the logical and of the current and the given BDD and existentially abstracts from the given ...
InternalBdd< DdType::CUDD > & operator&=(InternalBdd< DdType::CUDD > const &other)
Performs a logical and of the current and the given BDD and assigns it to the current BDD.
This class is responsible for managing a set of typed variables and all expressions using these varia...
A bit vector that is internally represented as a vector of 64-bit values.
#define STORM_LOG_THROW(cond, exception, message)
std::size_t operator()(storm::dd::InternalBdd< storm::dd::DdType::CUDD > const &) const