Storm
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
CuddAddIterator.h
Go to the documentation of this file.
1#ifndef STORM_STORAGE_DD_CUDDADDITERATOR_H_
2#define STORM_STORAGE_DD_CUDDADDITERATOR_H_
3
4#include <cstdint>
5#include <memory>
6#include <set>
7#include <tuple>
8#include <utility>
9
12
13// Include the C++-interface of CUDD.
14#include "cuddObj.hh"
15
16namespace storm {
17namespace dd {
18// Forward-declare the DdManager class.
19template<DdType Type>
20class DdManager;
21
22template<DdType Type, typename ValueType>
24
25template<typename ValueType>
26class AddIterator<DdType::CUDD, ValueType> {
27 public:
28 friend class InternalAdd<DdType::CUDD, ValueType>;
29
30 // Default-instantiate the constructor.
32
33 // Forbid copy-construction and copy assignment, because ownership of the internal pointer is unclear then.
34 AddIterator(AddIterator<DdType::CUDD, ValueType> const& other) = delete;
35 AddIterator& operator=(AddIterator<DdType::CUDD, ValueType> const& other) = delete;
36
37 // Provide move-construction and move-assignment, though.
38 AddIterator(AddIterator<DdType::CUDD, ValueType>&& other);
39 AddIterator& operator=(AddIterator<DdType::CUDD, ValueType>&& other);
40
44 ~AddIterator();
45
49 AddIterator<DdType::CUDD, ValueType>& operator++();
50
57 std::pair<storm::expressions::SimpleValuation, ValueType> operator*() const;
58
66 bool operator==(AddIterator<DdType::CUDD, ValueType> const& other) const;
67
75 bool operator!=(AddIterator<DdType::CUDD, ValueType> const& other) const;
76
77 private:
91 AddIterator(DdManager<DdType::CUDD> const& ddManager, DdGen* generator, int* cube, ValueType const& value, bool isAtEnd,
92 std::set<storm::expressions::Variable> const* metaVariables = nullptr, bool enumerateDontCareMetaVariables = true);
93
97 void treatNewCube();
98
102 void treatNextInCube();
103
104 // The manager responsible for the meta variables (and therefore the underlying DD).
105 DdManager<DdType::CUDD> const* ddManager;
106
107 // The CUDD generator used to enumerate the cubes of the DD.
108 DdGen* generator;
109
110 // The currently considered cube of the DD.
111 int* cube;
112
113 // The function value of the current cube.
114 double valueAsDouble;
115
116 // A flag that indicates whether the iterator is at its end and may not be moved further. This is also used
117 // for the check against the end iterator.
118 bool isAtEnd;
119
120 // The set of meta variables appearing in the DD.
121 std::set<storm::expressions::Variable> const* metaVariables;
122
123 // A flag that indicates whether the iterator is supposed to enumerate meta variable valuations even if
124 // they don't influence the function value.
125 bool enumerateDontCareMetaVariables;
126
127 // A number that represents how many assignments of the current cube have already been returned previously.
128 // This is needed, because cubes may represent many assignments (if they have don't care variables).
129 uint_fast64_t cubeCounter;
130
131 // A vector of tuples of the form <metaVariable, bitIndex>.
132 std::vector<std::tuple<storm::expressions::Variable, uint_fast64_t>> relevantDontCareDdVariables;
133
134 // The current valuation of meta variables.
136};
137} // namespace dd
138} // namespace storm
139
140#endif /* STORM_STORAGE_DD_CUDDADDITERATOR_H_ */
A simple implementation of the valuation interface.
LabParser.cpp.
Definition cli.cpp:18