Storm
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
SylvanAddIterator.h
Go to the documentation of this file.
1#ifndef STORM_STORAGE_DD_SYLVAN_SYLVANADDITERATOR_H_
2#define STORM_STORAGE_DD_SYLVAN_SYLVANADDITERATOR_H_
3
4#include <unordered_map>
5
8
10
11namespace storm {
12namespace dd {
13// Forward-declare the DdManager class.
14template<DdType Type>
15class DdManager;
16
17template<DdType Type, typename ValueType>
18class InternalAdd;
19
20template<typename ValueType>
21class AddIterator<DdType::Sylvan, ValueType> {
22 public:
23 friend class InternalAdd<DdType::Sylvan, ValueType>;
24
25 // Default-instantiate the constructor.
27
28 // Forbid copy-construction and copy assignment, because ownership of the internal pointer is unclear then.
29 AddIterator(AddIterator<DdType::Sylvan, ValueType> const& other) = delete;
30 AddIterator& operator=(AddIterator<DdType::Sylvan, ValueType> const& other) = delete;
31
32 // Provide move-construction and move-assignment, though.
33 AddIterator(AddIterator<DdType::Sylvan, ValueType>&& other) = default;
34 AddIterator& operator=(AddIterator<DdType::Sylvan, ValueType>&& other) = default;
35
39 AddIterator<DdType::Sylvan, ValueType>& operator++();
40
47 std::pair<storm::expressions::SimpleValuation, ValueType> operator*() const;
48
56 bool operator==(AddIterator<DdType::Sylvan, ValueType> const& other) const;
57
65 bool operator!=(AddIterator<DdType::Sylvan, ValueType> const& other) const;
66
67 private:
81 AddIterator(DdManager<DdType::Sylvan> const& ddManager, sylvan::Mtbdd mtbdd, sylvan::Bdd variables, uint_fast64_t numberOfDdVariables, bool isAtEnd,
82 std::set<storm::expressions::Variable> const* metaVariables, bool enumerateDontCareMetaVariables);
83
95 static AddIterator createBeginIterator(DdManager<DdType::Sylvan> const& ddManager, sylvan::Mtbdd mtbdd, sylvan::Bdd variables,
96 uint_fast64_t numberOfDdVariables, std::set<storm::expressions::Variable> const* metaVariables,
97 bool enumerateDontCareMetaVariables = true);
98
104 static AddIterator createEndIterator(DdManager<DdType::Sylvan> const& ddManager);
105
109 void treatNewCube();
110
114 void treatNextInCube();
115
119 void createGlobalToLocalIndexMapping();
120
121 // The manager responsible for the meta variables (and therefore the underlying DD).
122 DdManager<DdType::Sylvan> const* ddManager;
123
124 // The MTBDD over which to iterate.
125 sylvan::Mtbdd mtbdd;
126
127 // The cube of variables in the MTBDD.
128 sylvan::Bdd variables;
129
130 // The currently considered cube of the DD.
131 std::vector<uint8_t> cube;
132
133 // The function value of the current cube, represented by the corresponding leaf.
134 MTBDD leaf;
135
136 // A flag that indicates whether the iterator is at its end and may not be moved further. This is also used
137 // for the check against the end iterator.
138 bool isAtEnd;
139
140 // The set of meta variables appearing in the DD.
141 std::set<storm::expressions::Variable> const* metaVariables;
142
143 // A mapping from global variable indices to local (i.e. appearing the MTBDD) ones.
144 std::unordered_map<uint_fast64_t, uint_fast64_t> globalToLocalIndexMap;
145
146 // A flag that indicates whether the iterator is supposed to enumerate meta variable valuations even if
147 // they don't influence the function value.
148 bool enumerateDontCareMetaVariables;
149
150 // A number that represents how many assignments of the current cube have already been returned previously.
151 // This is needed, because cubes may represent many assignments (if they have don't care variables).
152 uint_fast64_t cubeCounter;
153
154 // A vector of tuples of the form <metaVariable, bitIndex>.
155 std::vector<std::tuple<storm::expressions::Variable, uint_fast64_t>> relevantDontCareDdVariables;
156
157 // The current valuation of meta variables.
159};
160} // namespace dd
161} // namespace storm
162
163#endif /* STORM_STORAGE_DD_SYLVAN_SYLVANADDITERATOR_H_ */
A simple implementation of the valuation interface.
LabParser.cpp.
Definition cli.cpp:18