5#include <unordered_map>
8#include "storm-config.h"
23template<DdType LibraryType>
31 template<DdType LibraryType,
typename ValueType>
34#ifdef STORM_HAVE_SYLVAN
55 std::vector<uint_fast64_t>
const& sortedDdVariableIndices,
56 std::function<
bool(uint64_t)>
const& filter);
129 template<
typename ValueType>
278 uint_fast64_t
getNonZeroCount(uint_fast64_t numberOfDdVariables)
const;
328 void exportToDot(std::string
const& filename, std::vector<std::string>
const& ddVariableNamesAsStrings,
bool showVariablesIfPossible =
true)
const;
342 template<
typename ValueType>
362 std::pair<std::vector<storm::expressions::Expression>, std::unordered_map<uint_fast64_t, storm::expressions::Variable>>
toExpression(
371 Odd createOdd(std::vector<uint_fast64_t>
const& ddVariableIndices)
const;
381 template<
typename ValueType>
382 void filterExplicitVector(
Odd const& odd, std::vector<uint_fast64_t>
const& ddVariableIndices, std::vector<ValueType>
const& sourceValues,
383 std::vector<ValueType>& targetValues)
const;
402 std::vector<InternalBdd<DdType::Sylvan>>
splitIntoGroups(std::vector<uint_fast64_t>
const& ddGroupVariableIndices)
const;
406#ifdef STORM_HAVE_SYLVAN
412 sylvan::Bdd& getSylvanBdd();
419 sylvan::Bdd const& getSylvanBdd() const;
423#ifdef STORM_HAVE_SYLVAN
435 static BDD fromVectorRec(uint_fast64_t& currentOffset, uint_fast64_t currentLevel, uint_fast64_t maxLevel, Odd const& odd,
436 std::vector<uint_fast64_t> const& ddVariableIndices, std::function<bool(uint64_t)> const& filter);
441 std::size_t operator()(std::pair<BDD, bool>
const& key)
const;
456 static std::shared_ptr<Odd> createOddRec(BDD
dd,
bool complement, uint_fast64_t currentLevel, uint_fast64_t maxLevel,
457 std::vector<uint_fast64_t>
const& ddVariableIndices,
458 std::vector<std::unordered_map<std::pair<BDD, bool>, std::shared_ptr<Odd>, HashFunctor>>& uniqueTableForLevels);
472 void toVectorRec(BDD
dd,
storm::storage::BitVector& result,
Odd const& rowOdd,
bool complement, uint_fast64_t currentRowLevel, uint_fast64_t maxLevel,
473 uint_fast64_t currentRowOffset, std::vector<uint_fast64_t>
const& ddRowVariableIndices)
const;
488 template<
typename ValueType>
489 static void filterExplicitVectorRec(BDD
dd, uint_fast64_t currentLevel,
bool complement, uint_fast64_t maxLevel,
490 std::vector<uint_fast64_t>
const& ddVariableIndices, uint_fast64_t currentOffset,
storm::dd::Odd const& odd,
491 std::vector<ValueType>& result, uint_fast64_t& currentIndex, std::vector<ValueType>
const& values);
506 static void filterExplicitVectorRec(BDD
dd, 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,
529 std::unordered_map<uint_fast64_t, storm::expressions::Variable>& indexToVariableMap,
531 std::unordered_map<BDD, uint_fast64_t>& nodeToCounterMap, std::vector<uint_fast64_t>& nextCounterForIndex);
534 uint_fast64_t currentLevel, uint_fast64_t maxLevel)
const;
540 sylvan::Bdd sylvanBdd;
548struct hash<
storm::dd::InternalBdd<storm::dd::DdType::Sylvan>> {
549#ifdef STORM_HAVE_SYLVAN
551 return static_cast<std::size_t
>(key.sylvanBdd.GetBDD());
556 "This version of Storm was compiled without support for Sylvan. Yet, a method was called that requires this support. Please choose a "
557 "version of Storm with Sylvan support.");
InternalBdd< DdType::Sylvan > swapVariables(std::vector< InternalBdd< DdType::Sylvan > > const &from, std::vector< InternalBdd< DdType::Sylvan > > const &to) const
Swaps the given pairs of DD variables in the BDD.
InternalBdd< DdType::Sylvan > & operator|=(InternalBdd< DdType::Sylvan > const &other)
Performs a logical or of the current and the given BDD and assigns it to the current BDD.
InternalBdd< DdType::Sylvan > ite(InternalBdd< DdType::Sylvan > const &thenBdd, InternalBdd< DdType::Sylvan > const &elseBdd) const
Performs an if-then-else with the given operands, i.e.
InternalBdd< DdType::Sylvan > constrain(InternalBdd< DdType::Sylvan > const &constraint) const
Computes the constraint of the current BDD with the given constraint.
InternalBdd< DdType::Sylvan > operator||(InternalBdd< DdType::Sylvan > const &other) const
Performs a logical or of the current and the given BDD.
InternalAdd< DdType::Sylvan, ValueType > toAdd() const
Converts a BDD to an equivalent ADD.
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...
bool operator!=(InternalBdd< DdType::Sylvan > const &other) const
Retrieves whether the two BDDs represent different functions.
InternalBdd(InternalBdd< DdType::Sylvan > const &other)=default
InternalBdd< DdType::Sylvan > restrict(InternalBdd< DdType::Sylvan > const &constraint) const
Computes the restriction of the current BDD with the given constraint.
uint_fast64_t getNodeCount() const
Retrieves the number of nodes necessary to represent the DD.
InternalBdd< DdType::Sylvan > & operator&=(InternalBdd< DdType::Sylvan > const &other)
Performs a logical and of the current and the given BDD and assigns it to the current BDD.
InternalBdd< DdType::Sylvan > getSupport() const
Retrieves the support of the current BDD.
InternalBdd< DdType::Sylvan > relationalProduct(InternalBdd< DdType::Sylvan > const &relation, std::vector< InternalBdd< DdType::Sylvan > > const &rowVariables, std::vector< InternalBdd< DdType::Sylvan > > const &columnVariables) const
Computes the relational product of the current BDD and the given BDD representing a relation.
InternalBdd< DdType::Sylvan > exclusiveOr(InternalBdd< DdType::Sylvan > const &other) const
Performs a logical exclusive-or of the current and the given BDD.
uint_fast64_t getLevel() const
Retrieves the level of the topmost variable in the BDD.
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.
uint_fast64_t getIndex() const
Retrieves the index of the topmost variable in the BDD.
Odd createOdd(std::vector< uint_fast64_t > const &ddVariableIndices) const
Creates an ODD based on the current BDD.
InternalBdd< DdType::Sylvan > andExists(InternalBdd< DdType::Sylvan > const &other, InternalBdd< storm::dd::DdType::Sylvan > const &cube) const
Computes the logical and of the current and the given BDD and existentially abstracts from the given ...
bool isZero() const
Retrieves whether this DD represents the constant zero function.
InternalBdd< DdType::Sylvan > inverseRelationalProductWithExtendedRelation(InternalBdd< DdType::Sylvan > const &relation, std::vector< InternalBdd< DdType::Sylvan > > const &rowVariables, std::vector< InternalBdd< DdType::Sylvan > > const &columnVariables) const
Computes the inverse relational product of the current BDD and the given BDD representing a relation ...
InternalBdd< DdType::Sylvan > operator!() const
Logically inverts the current BDD.
InternalBdd & operator=(InternalBdd< DdType::Sylvan > const &other)=default
InternalBdd< DdType::Sylvan > operator&&(InternalBdd< DdType::Sylvan > const &other) const
Performs a logical and of the current and the given BDD.
std::vector< InternalBdd< DdType::Sylvan > > 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 ...
uint_fast64_t getLeafCount() const
Retrieves the number of leaves of the DD.
InternalBdd< DdType::Sylvan > implies(InternalBdd< DdType::Sylvan > const &other) const
Performs a logical implication 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::Sylvan > universalAbstract(InternalBdd< DdType::Sylvan > const &cube) const
Universally abstracts from the given cube.
bool operator==(InternalBdd< DdType::Sylvan > const &other) const
Retrieves whether the two BDDs represent the same function.
InternalBdd(InternalBdd< DdType::Sylvan > &&other)=default
bool isOne() const
Retrieves whether this DD represents the constant one function.
InternalBdd< DdType::Sylvan > inverseRelationalProduct(InternalBdd< DdType::Sylvan > const &relation, std::vector< InternalBdd< DdType::Sylvan > > const &rowVariables, std::vector< InternalBdd< DdType::Sylvan > > const &columnVariables) const
Computes the inverse relational product of the current BDD and the given BDD representing a relation.
InternalBdd< DdType::Sylvan > & complement()
Logically complements the current BDD.
InternalBdd< DdType::Sylvan > iff(InternalBdd< DdType::Sylvan > const &other) const
Performs a logical iff 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.
InternalBdd & operator=(InternalBdd< DdType::Sylvan > &&other)=default
InternalBdd< DdType::Sylvan > existsAbstract(InternalBdd< DdType::Sylvan > const &cube) const
Existentially abstracts from the given cube.
void exportToText(std::string const &filename) const
Exports the DD to the given file in a textual format as specified in Sylvan.
InternalBdd< DdType::Sylvan > existsAbstractRepresentative(InternalBdd< DdType::Sylvan > const &cube) const
Similar to existsAbstract, but does not abstract but rather picks a valuation for the variables of th...
uint_fast64_t getNonZeroCount(uint_fast64_t numberOfDdVariables) const
Retrieves the number of encodings that are mapped to a non-zero value.
static InternalBdd< storm::dd::DdType::Sylvan > fromVector(InternalDdManager< DdType::Sylvan > const *ddManager, Odd const &odd, std::vector< uint_fast64_t > const &sortedDdVariableIndices, std::function< bool(uint64_t)> const &filter)
Builds a BDD representing the values that make the given filter function evaluate to true.
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::Sylvan > const &) const