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