Storm 1.14.0.1
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
InternalCuddDdManager.h
Go to the documentation of this file.
1#pragma once
2
3#include <boost/optional.hpp>
4#include <functional>
5
6#include "storm-config.h"
12
13#ifdef STORM_HAVE_CUDD
14#include "cuddObj.hh"
15#endif
16
17namespace storm {
18namespace dd {
19template<DdType LibraryType, typename ValueType>
20class InternalAdd;
21
22template<DdType LibraryType>
23class InternalBdd;
24
25template<>
27 public:
28 friend class InternalBdd<DdType::CUDD>;
29
30 template<DdType LibraryType, typename ValueType>
31 friend class InternalAdd;
32
38 explicit InternalDdManager(storm::CuddDdManagerEnvironment const& environment);
39
44
50 InternalBdd<DdType::CUDD> getBddOne() const;
51
57 template<typename ValueType>
58 InternalAdd<DdType::CUDD, ValueType> getAddOne() const;
59
65 InternalBdd<DdType::CUDD> getBddZero() const;
66
72 InternalBdd<DdType::CUDD> getBddEncodingLessOrEqualThan(uint64_t bound, InternalBdd<DdType::CUDD> const& cube, uint64_t numberOfDdVariables) const;
73
79 template<typename ValueType>
80 InternalAdd<DdType::CUDD, ValueType> getAddZero() const;
81
87 template<typename ValueType>
88 InternalAdd<DdType::CUDD, ValueType> getAddUndefined() const;
89
95 template<typename ValueType>
96 InternalAdd<DdType::CUDD, ValueType> getConstant(ValueType const& value) const;
97
105 std::vector<InternalBdd<DdType::CUDD>> createDdVariables(uint64_t numberOfLayers, boost::optional<uint_fast64_t> const& position = boost::none);
106
113 bool supportsOrderedInsertion() const;
114
120 void allowDynamicReordering(bool value);
121
127 bool isDynamicReorderingAllowed() const;
128
132 void triggerReordering();
133
137 void debugCheck() const;
138
146 void execute(std::function<void()> const& f) const;
147
153 uint_fast64_t getNumberOfDdVariables() const;
154
155#ifdef STORM_HAVE_CUDD
161 cudd::Cudd& getCuddManager();
162
168 cudd::Cudd const& getCuddManager() const;
169#endif
170
171 private:
172#ifdef STORM_HAVE_CUDD
173 // Helper function to create the BDD whose encodings are below a given bound.
174 DdNodePtr getBddEncodingLessOrEqualThanRec(uint64_t minimalValue, uint64_t maximalValue, uint64_t bound, DdNodePtr cube,
175 uint64_t remainingDdVariables) const;
176
177 // The manager responsible for the DDs created/modified with this DdManager.
178 cudd::Cudd cuddManager;
179
180 // The technique that is used for dynamic reordering.
181 Cudd_ReorderingType reorderingTechnique;
182
183 // Keeps track of the number of registered DD variables.
184 uint_fast64_t numberOfDdVariables;
185#endif
186};
187} // namespace dd
188} // namespace storm
InternalAdd< DdType::CUDD, ValueType > getAddUndefined() const
Retrieves an ADD representing an undefined value.
InternalAdd< DdType::CUDD, ValueType > getAddZero() const
Retrieves an ADD representing the constant zero function.
void allowDynamicReordering(bool value)
Sets whether or not dynamic reordering is allowed for the DDs managed by this manager.
void triggerReordering()
Triggers a reordering of the DDs managed by this manager.
bool isDynamicReorderingAllowed() const
Retrieves whether dynamic reordering is currently allowed.
std::vector< InternalBdd< DdType::CUDD > > createDdVariables(uint64_t numberOfLayers, boost::optional< uint_fast64_t > const &position=boost::none)
Creates new layered DD variables and returns the cubes as a result.
bool supportsOrderedInsertion() const
Checks whether this manager supports the ordered insertion of variables, i.e.
InternalBdd< DdType::CUDD > getBddOne() const
Retrieves a BDD representing the constant one function.
void debugCheck() const
Performs a debug check if available.
InternalDdManager(storm::CuddDdManagerEnvironment const &environment)
Creates a new internal manager for CUDD DDs.
uint_fast64_t getNumberOfDdVariables() const
Retrieves the number of DD variables managed by this manager.
void execute(std::function< void()> const &f) const
All code that manipulates DDs shall be called through this function.
InternalAdd< DdType::CUDD, ValueType > getConstant(ValueType const &value) const
Retrieves an ADD representing the constant function with the given value.
InternalBdd< DdType::CUDD > getBddEncodingLessOrEqualThan(uint64_t bound, InternalBdd< DdType::CUDD > const &cube, uint64_t numberOfDdVariables) const
Retrieves a BDD that maps to true iff the encoding is less or equal than the given bound.
InternalBdd< DdType::CUDD > getBddZero() const
Retrieves a BDD representing the constant zero function.
InternalAdd< DdType::CUDD, ValueType > getAddOne() const
Retrieves an ADD representing the constant one function.