1#ifndef STORM_STORAGE_DD_BDD_H_
2#define STORM_STORAGE_DD_BDD_H_
19template<DdType LibraryType,
typename ValueType>
24template<DdType LibraryType>
25class Bdd :
public Dd<LibraryType> {
29 template<DdType LibraryTypePrime,
typename ValueTypePrime>
40 std::set<storm::expressions::Variable>
const& containedMetaVariables = std::set<storm::expressions::Variable>());
58 std::set<storm::expressions::Variable>
const& metaVariables);
69 std::set<storm::expressions::Variable>
const& metaVariables);
81 template<
typename ValueType>
121 template<
typename ValueType>
258 std::set<storm::expressions::Variable>
const& columnMetaVariables)
const;
271 std::set<storm::expressions::Variable>
const& columnMetaVariables)
const;
284 std::set<storm::expressions::Variable>
const& rowMetaVariables,
285 std::set<storm::expressions::Variable>
const& columnMetaVariables)
const;
294 Bdd<LibraryType> swapVariables(std::vector<std::pair<storm::expressions::Variable, storm::expressions::Variable>>
const& metaVariablePairs)
const;
352 template<
typename ValueType>
358 std::vector<Bdd<LibraryType>>
split(std::set<storm::expressions::Variable>
const& variables)
const;
376 std::pair<std::vector<storm::expressions::Expression>, std::unordered_map<uint_fast64_t, storm::expressions::Variable>>
toExpression(
387 virtual uint_fast64_t
getIndex()
const override;
389 virtual uint_fast64_t
getLevel()
const override;
391 virtual void exportToDot(std::string
const& filename,
bool showVariablesIfPossible =
true)
const override;
393 virtual void exportToText(std::string
const& filename)
const override;
417 template<
typename ValueType>
436 template<DdType LibraryTypePrime, typename ValueType>
447template<storm::dd::DdType LibraryType>
450 return std::hash<storm::dd::InternalBdd<LibraryType>>().
operator()(key.internalBdd);
Bdd< LibraryType > renameVariablesAbstract(std::set< storm::expressions::Variable > const &from, std::set< storm::expressions::Variable > const &to) const
Renames the given meta variables in the BDD.
virtual uint_fast64_t getLevel() const override
Retrieves the level of the topmost variable in the DD.
static Bdd< LibraryType > fromVector(DdManager< LibraryType > const &ddManager, storm::storage::BitVector const &truthValues, storm::dd::Odd const &odd, std::set< storm::expressions::Variable > const &metaVariables)
Constructs a BDD representation of all encodings whose value is true in the given list of truth value...
Bdd< LibraryType > existsAbstract(std::set< storm::expressions::Variable > const &metaVariables) const
Existentially abstracts from the given meta variables.
Bdd< LibraryType > inverseRelationalProduct(Bdd< LibraryType > const &relation, std::set< storm::expressions::Variable > const &rowMetaVariables, std::set< storm::expressions::Variable > const &columnMetaVariables) const
Computes the inverse 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.
virtual uint_fast64_t getNonZeroCount() const override
Retrieves the number of encodings that are mapped to a non-zero value.
bool operator!=(Bdd< LibraryType > const &other) const
Retrieves whether the two BDDs represent different functions.
virtual uint_fast64_t getIndex() const override
Retrieves the index of the topmost variable in the DD.
Bdd< LibraryType > & operator&=(Bdd< LibraryType > const &other)
Performs a logical and of the current and the given BDD and assigns it to the current BDD.
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...
Bdd< LibraryType > andExists(Bdd< LibraryType > const &other, std::set< storm::expressions::Variable > const &existentialVariables) const
Computes the logical and of the current and the given BDD and existentially abstracts from the given ...
static Bdd< LibraryType > getEncoding(DdManager< LibraryType > const &ddManager, uint64_t targetOffset, storm::dd::Odd const &odd, std::set< storm::expressions::Variable > const &metaVariables)
Constructs the BDD representation of the encoding with the given offset.
virtual uint_fast64_t getNodeCount() const override
Retrieves the number of nodes necessary to represent the DD.
Bdd< LibraryType > swapVariables(std::vector< std::pair< storm::expressions::Variable, storm::expressions::Variable > > const &metaVariablePairs) const
Swaps the given pairs of meta variables in the BDD.
Bdd & operator=(Bdd< LibraryType > &&other)=default
Bdd & operator=(Bdd< LibraryType > const &other)=default
Bdd< LibraryType > & complement()
Logically complements the current BDD.
Odd createOdd() const
Creates an ODD based on the current BDD.
Bdd< LibraryType > operator&&(Bdd< LibraryType > const &other) const
Performs a logical and of the current and the given BDD.
storm::storage::BitVector toVector(storm::dd::Odd const &rowOdd) const
Converts the BDD to a bit vector.
Bdd< LibraryType > existsAbstractRepresentative(std::set< storm::expressions::Variable > const &metaVariables) const
Similar to existsAbstract, but does not abstract from the variables but rather picks a valuation of e...
static Bdd< LibraryType > getCube(DdManager< LibraryType > const &manager, std::set< storm::expressions::Variable > const &metaVariables)
Retrieves the cube of all given meta variables.
Bdd< LibraryType > universalAbstract(std::set< storm::expressions::Variable > const &metaVariables) const
Universally abstracts from the given meta variables.
virtual Bdd< LibraryType > getSupport() const override
Retrieves the support of the current DD.
Add< LibraryType, ValueType > toAdd() const
Converts a BDD to an equivalent ADD.
Bdd< LibraryType > constrain(Bdd< LibraryType > const &constraint) const
Computes the constraint of the current BDD with the given constraint.
Bdd< LibraryType > & operator|=(Bdd< LibraryType > const &other)
Performs a logical or of the current and the given BDD and assigns it to the current BDD.
std::vector< Bdd< LibraryType > > split(std::set< storm::expressions::Variable > const &variables) const
Splits the BDD along the given variables (must be at the top).
Bdd< LibraryType > ite(Bdd< LibraryType > const &thenBdd, Bdd< LibraryType > const &elseBdd) const
Performs an if-then-else with the given operands, i.e.
Bdd< LibraryType > operator!() const
Logically inverts the current BDD.
Bdd< LibraryType > iff(Bdd< LibraryType > const &other) const
Performs a logical iff of the current and the given BDD.
virtual void exportToDot(std::string const &filename, bool showVariablesIfPossible=true) const override
Exports the DD to the given file in the dot format.
Bdd< LibraryType > renameVariables(std::set< storm::expressions::Variable > const &from, std::set< storm::expressions::Variable > const &to) const
Renames the given meta variables in the BDD.
Bdd< LibraryType > inverseRelationalProductWithExtendedRelation(Bdd< LibraryType > const &relation, std::set< storm::expressions::Variable > const &rowMetaVariables, std::set< storm::expressions::Variable > const &columnMetaVariables) const
Computes the inverse relational product of the current BDD and the given BDD representing a relation ...
bool isOne() const
Retrieves whether this DD represents the constant one function.
Bdd< LibraryType > exclusiveOr(Bdd< LibraryType > const &other) const
Performs a logical exclusive-or of the current and the given BDD.
Bdd< LibraryType > relationalProduct(Bdd< LibraryType > const &relation, std::set< storm::expressions::Variable > const &rowMetaVariables, std::set< storm::expressions::Variable > const &columnMetaVariables) const
Computes the relational product of the current BDD and the given BDD representing a relation.
virtual void exportToText(std::string const &filename) const override
Exports the DD to the given file in the dot format.
Bdd(Bdd< LibraryType > &&other)=default
Bdd< LibraryType > restrict(Bdd< LibraryType > const &constraint) const
Computes the restriction of the current BDD with the given constraint.
Bdd< LibraryType > implies(Bdd< LibraryType > const &other) const
Performs a logical implication of the current and the given BDD.
Bdd(Bdd< LibraryType > const &other)=default
Bdd< LibraryType > renameVariablesConcretize(std::set< storm::expressions::Variable > const &from, std::set< storm::expressions::Variable > const &to) const
Renames the given meta variables in the BDD.
InternalBdd< LibraryType > const & getInternalBdd() const
Retrieves the internal BDD.
std::vector< ValueType > filterExplicitVector(Odd const &odd, std::vector< ValueType > const &values) const
Filters the given explicit vector using the symbolic representation of which values to select.
bool operator==(Bdd< LibraryType > const &other) const
Retrieves whether the two BDDs represent the same function.
Bdd< LibraryType > operator||(Bdd< LibraryType > const &other) const
Performs a logical or of the current and the given BDD.
virtual uint_fast64_t getLeafCount() const override
Retrieves the number of leaves of the DD.
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.