Storm 1.14.0.1
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
InternalSylvanDdManager.h
Go to the documentation of this file.
1#pragma once
2
3#include <boost/optional.hpp>
4
5#include "storm-config.h"
12
13namespace storm {
14namespace dd {
15template<DdType LibraryType, typename ValueType>
16class InternalAdd;
17
18template<DdType LibraryType>
19class InternalBdd;
20
21template<>
23 public:
24 friend class InternalBdd<DdType::Sylvan>;
25
26 template<DdType LibraryType, typename ValueType>
27 friend class InternalAdd;
28
34 explicit InternalDdManager(storm::SylvanDdManagerEnvironment const& environment);
35
40
46 InternalBdd<DdType::Sylvan> getBddOne() const;
47
53 template<typename ValueType>
54 InternalAdd<DdType::Sylvan, ValueType> getAddOne() const;
55
61 InternalBdd<DdType::Sylvan> getBddZero() const;
62
68 InternalBdd<DdType::Sylvan> getBddEncodingLessOrEqualThan(uint64_t bound, InternalBdd<DdType::Sylvan> const& cube, uint64_t numberOfDdVariables) const;
69
75 template<typename ValueType>
76 InternalAdd<DdType::Sylvan, ValueType> getAddZero() const;
77
83 template<typename ValueType>
84 InternalAdd<DdType::Sylvan, ValueType> getAddUndefined() const;
85
91 template<typename ValueType>
92 InternalAdd<DdType::Sylvan, ValueType> getConstant(ValueType const& value) const;
93
101 std::vector<InternalBdd<DdType::Sylvan>> createDdVariables(uint64_t numberOfLayers, boost::optional<uint_fast64_t> const& position = boost::none);
102
109 bool supportsOrderedInsertion() const;
110
116 void allowDynamicReordering(bool value);
117
123 bool isDynamicReorderingAllowed() const;
124
128 void triggerReordering();
129
133 void debugCheck() const;
134
143 void execute(std::function<void()> const& f) const;
144
150 uint_fast64_t getNumberOfDdVariables() const;
151
152 private:
153#ifdef STORM_HAVE_SYLVAN
154
155 // Helper function to create the BDD whose encodings are below a given bound.
156 BDD getBddEncodingLessOrEqualThanRec(uint64_t minimalValue, uint64_t maximalValue, uint64_t bound, BDD cube, uint64_t remainingDdVariables) const;
157
158 // A counter for the number of instances of this class. This is used to determine when to initialize and
159 // quit the sylvan. This is because Sylvan does not know the concept of managers but implicitly has a
160 // 'global' manager.
161 static uint_fast64_t numberOfInstances;
162
163 // Since the sylvan (more specifically: lace) processes do busy waiting, we suspend them as long as
164 // sylvan is not used. This flag keeps track of whether we are currently suspending.
165 static bool suspended;
166
167 // The index of the next free variable index. This needs to be shared across all instances since the sylvan
168 // manager is implicitly 'global'.
169 static uint_fast64_t nextFreeVariableIndex;
170#endif
171};
172
173} // namespace dd
174} // namespace storm
InternalAdd< DdType::Sylvan, ValueType > getAddUndefined() const
Retrieves an ADD representing an undefined value.
void debugCheck() const
Performs a debug check if available.
std::vector< InternalBdd< DdType::Sylvan > > 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.
InternalAdd< DdType::Sylvan, 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.
InternalAdd< DdType::Sylvan, ValueType > getConstant(ValueType const &value) const
Retrieves an ADD representing the constant function with the given value.
InternalAdd< DdType::Sylvan, ValueType > getAddOne() const
Retrieves an ADD representing the constant one function.
void triggerReordering()
Triggers a reordering of the DDs managed by this manager.
InternalBdd< DdType::Sylvan > getBddZero() const
Retrieves a BDD representing the constant zero function.
bool supportsOrderedInsertion() const
Checks whether this manager supports the ordered insertion of variables, i.e.
InternalBdd< DdType::Sylvan > getBddEncodingLessOrEqualThan(uint64_t bound, InternalBdd< DdType::Sylvan > const &cube, uint64_t numberOfDdVariables) const
Retrieves a BDD that maps to true iff the encoding is less or equal than the given bound.
InternalDdManager(storm::SylvanDdManagerEnvironment const &environment)
Creates a new internal manager for Sylvan DDs.
InternalBdd< DdType::Sylvan > getBddOne() const
Retrieves a BDD representing the constant one function.
bool isDynamicReorderingAllowed() const
Retrieves whether dynamic reordering is currently allowed.
void execute(std::function< void()> const &f) const
All code that manipulates DDs shall be called through this function.
uint_fast64_t getNumberOfDdVariables() const
Retrieves the number of DD variables managed by this manager.