Storm 1.11.1.1
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
Dd.h
Go to the documentation of this file.
1#pragma once
2
3#include <set>
4#include <string>
5#include <vector>
6
9
10namespace storm {
11namespace dd {
12// Forward-declare some classes.
13template<DdType LibraryType>
14class DdManager;
15
16template<DdType LibraryType>
17class Bdd;
18
19template<DdType LibraryType>
20class Dd {
21 public:
22 // Declare the DdManager so it can access the internals of a DD.
23 friend class DdManager<LibraryType>;
24
25 // Instantiate all copy/move constructors/assignments with the default implementation.
26 Dd() = default;
27 Dd(Dd<LibraryType> const& other) = default;
28 Dd& operator=(Dd<LibraryType> const& other) = default;
29 Dd(Dd<LibraryType>&& other) = default;
30 Dd& operator=(Dd<LibraryType>&& other) = default;
31
32 virtual ~Dd() = default;
33
39 virtual Bdd<LibraryType> getSupport() const = 0;
40
46 virtual uint_fast64_t getNonZeroCount() const = 0;
47
53 virtual uint_fast64_t getLeafCount() const = 0;
54
60 virtual uint_fast64_t getNodeCount() const = 0;
61
67 virtual uint_fast64_t getIndex() const = 0;
68
74 virtual uint_fast64_t getLevel() const = 0;
75
82 bool containsMetaVariable(storm::expressions::Variable const& metaVariable) const;
83
90 bool containsMetaVariables(std::set<storm::expressions::Variable> const& metaVariables) const;
91
97 std::set<storm::expressions::Variable> const& getContainedMetaVariables() const;
98
104 virtual void exportToDot(std::string const& filename, bool showVariablesIfPossible = true) const = 0;
105
111 virtual void exportToText(std::string const& filename) const = 0;
112
119
125 std::set<storm::expressions::Variable>& getContainedMetaVariables();
126
132 void addMetaVariables(std::set<storm::expressions::Variable> const& metaVariables);
133
139 void addMetaVariable(storm::expressions::Variable const& metaVariable);
140
146 void removeMetaVariable(storm::expressions::Variable const& metaVariable);
147
153 void removeMetaVariables(std::set<storm::expressions::Variable> const& metaVariables);
154
155 protected:
161 std::vector<uint_fast64_t> getSortedVariableIndices() const;
162
169 Dd(DdManager<LibraryType> const& ddManager,
170 std::set<storm::expressions::Variable> const& containedMetaVariables = std::set<storm::expressions::Variable>());
171
179 static std::set<storm::expressions::Variable> joinMetaVariables(storm::dd::Dd<LibraryType> const& first, storm::dd::Dd<LibraryType> const& second);
180
188 static std::set<storm::expressions::Variable> subtractMetaVariables(storm::dd::Dd<LibraryType> const& first, storm::dd::Dd<LibraryType> const& second);
189
190 private:
191 // A pointer to the manager responsible for this DD.
192 DdManager<LibraryType>* ddManager;
193
194 // The meta variables that appear in this DD.
195 std::set<storm::expressions::Variable> containedMetaVariables;
196};
197} // namespace dd
198} // namespace storm
void addMetaVariable(storm::expressions::Variable const &metaVariable)
Adds the given meta variable to the set of meta variables that are contained in this DD.
Definition Dd.cpp:51
Dd()=default
virtual uint_fast64_t getNonZeroCount() const =0
Retrieves the number of encodings that are mapped to a non-zero value.
virtual void exportToText(std::string const &filename) const =0
Exports the DD to the given file in the dot format.
static std::set< storm::expressions::Variable > joinMetaVariables(storm::dd::Dd< LibraryType > const &first, storm::dd::Dd< LibraryType > const &second)
Retrieves the set of meta variables contained in both DDs.
Definition Dd.cpp:74
virtual uint_fast64_t getNodeCount() const =0
Retrieves the number of nodes necessary to represent the DD.
Dd & operator=(Dd< LibraryType > &&other)=default
virtual Bdd< LibraryType > getSupport() const =0
Retrieves the support of the current DD.
void addMetaVariables(std::set< storm::expressions::Variable > const &metaVariables)
Adds the given set of meta variables to the DD.
Definition Dd.cpp:43
virtual uint_fast64_t getLeafCount() const =0
Retrieves the number of leaves of the DD.
void removeMetaVariables(std::set< storm::expressions::Variable > const &metaVariables)
Removes the given set of meta variables from the DD.
Definition Dd.cpp:61
bool containsMetaVariable(storm::expressions::Variable const &metaVariable) const
Retrieves whether the given meta variable is contained in the DD.
Definition Dd.cpp:18
Dd & operator=(Dd< LibraryType > const &other)=default
void removeMetaVariable(storm::expressions::Variable const &metaVariable)
Removes the given meta variable to the set of meta variables that are contained in this DD.
Definition Dd.cpp:56
std::vector< uint_fast64_t > getSortedVariableIndices() const
Retrieves the (sorted) list of the variable indices of DD variables contained in this DD.
Definition Dd.cpp:69
Dd(Dd< LibraryType > &&other)=default
virtual uint_fast64_t getIndex() const =0
Retrieves the index of the topmost variable in the DD.
static std::set< storm::expressions::Variable > subtractMetaVariables(storm::dd::Dd< LibraryType > const &first, storm::dd::Dd< LibraryType > const &second)
Retrieves the set of meta variables that are contained in the first but not the second DD.
Definition Dd.cpp:82
virtual uint_fast64_t getLevel() const =0
Retrieves the level of the topmost variable in the DD.
std::set< storm::expressions::Variable > const & getContainedMetaVariables() const
Retrieves the set of all meta variables contained in the DD.
Definition Dd.cpp:28
virtual void exportToDot(std::string const &filename, bool showVariablesIfPossible=true) const =0
Exports the DD to the given file in the dot format.
DdManager< LibraryType > & getDdManager() const
Retrieves the manager that is responsible for this DD.
Definition Dd.cpp:38
Dd(Dd< LibraryType > const &other)=default
virtual ~Dd()=default
bool containsMetaVariables(std::set< storm::expressions::Variable > const &metaVariables) const
Retrieves whether the given meta variables are all contained in the DD.
Definition Dd.cpp:23