Storm
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
Dd.h
Go to the documentation of this file.
1#ifndef STORM_STORAGE_DD_DD_H_
2#define STORM_STORAGE_DD_DD_H_
3
4#include <set>
5#include <string>
6#include <vector>
7
10
11namespace storm {
12namespace dd {
13// Forward-declare some classes.
14template<DdType LibraryType>
15class DdManager;
16
17template<DdType LibraryType>
18class Bdd;
19
20template<DdType LibraryType>
21class Dd {
22 public:
23 // Declare the DdManager so it can access the internals of a DD.
24 friend class DdManager<LibraryType>;
25
26 // Instantiate all copy/move constructors/assignments with the default implementation.
27 Dd() = default;
28 Dd(Dd<LibraryType> const& other) = default;
29 Dd& operator=(Dd<LibraryType> const& other) = default;
30 Dd(Dd<LibraryType>&& other) = default;
31 Dd& operator=(Dd<LibraryType>&& other) = default;
32
33 virtual ~Dd() = default;
34
40 virtual Bdd<LibraryType> getSupport() const = 0;
41
47 virtual uint_fast64_t getNonZeroCount() const = 0;
48
54 virtual uint_fast64_t getLeafCount() const = 0;
55
61 virtual uint_fast64_t getNodeCount() const = 0;
62
68 virtual uint_fast64_t getIndex() const = 0;
69
75 virtual uint_fast64_t getLevel() const = 0;
76
83 bool containsMetaVariable(storm::expressions::Variable const& metaVariable) const;
84
91 bool containsMetaVariables(std::set<storm::expressions::Variable> const& metaVariables) const;
92
98 std::set<storm::expressions::Variable> const& getContainedMetaVariables() const;
99
105 virtual void exportToDot(std::string const& filename, bool showVariablesIfPossible = true) const = 0;
106
112 virtual void exportToText(std::string const& filename) const = 0;
113
120
126 std::set<storm::expressions::Variable>& getContainedMetaVariables();
127
133 void addMetaVariables(std::set<storm::expressions::Variable> const& metaVariables);
134
140 void addMetaVariable(storm::expressions::Variable const& metaVariable);
141
147 void removeMetaVariable(storm::expressions::Variable const& metaVariable);
148
154 void removeMetaVariables(std::set<storm::expressions::Variable> const& metaVariables);
155
156 protected:
162 std::vector<uint_fast64_t> getSortedVariableIndices() const;
163
170 Dd(DdManager<LibraryType> const& ddManager,
171 std::set<storm::expressions::Variable> const& containedMetaVariables = std::set<storm::expressions::Variable>());
172
180 static std::set<storm::expressions::Variable> joinMetaVariables(storm::dd::Dd<LibraryType> const& first, storm::dd::Dd<LibraryType> const& second);
181
189 static std::set<storm::expressions::Variable> subtractMetaVariables(storm::dd::Dd<LibraryType> const& first, storm::dd::Dd<LibraryType> const& second);
190
191 private:
192 // A pointer to the manager responsible for this DD.
193 DdManager<LibraryType>* ddManager;
194
195 // The meta variables that appear in this DD.
196 std::set<storm::expressions::Variable> containedMetaVariables;
197};
198} // namespace dd
199} // namespace storm
200
201#endif /* STORM_STORAGE_DD_DD_H_ */
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:52
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:75
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:44
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:62
bool containsMetaVariable(storm::expressions::Variable const &metaVariable) const
Retrieves whether the given meta variable is contained in the DD.
Definition Dd.cpp:19
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:57
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:70
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:83
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:29
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:39
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:24
LabParser.cpp.
Definition cli.cpp:18