12 this->cuddManager.SetMaxMemory(
static_cast<unsigned long>(environment.
getMaximalMemory() * 1024ul * 1024ul));
17 this->getCuddManager().AutodynDisable();
20InternalDdManager<DdType::CUDD>::~InternalDdManager() {
24InternalBdd<DdType::CUDD> InternalDdManager<DdType::CUDD>::getBddOne()
const {
25 return InternalBdd<DdType::CUDD>(
this, cuddManager.bddOne());
28template<
typename ValueType>
29InternalAdd<DdType::CUDD, ValueType> InternalDdManager<DdType::CUDD>::getAddOne()
const {
30 return InternalAdd<DdType::CUDD, ValueType>(
this, cuddManager.addOne());
33InternalBdd<DdType::CUDD> InternalDdManager<DdType::CUDD>::getBddZero()
const {
34 return InternalBdd<DdType::CUDD>(
this, cuddManager.bddZero());
37InternalBdd<DdType::CUDD> InternalDdManager<DdType::CUDD>::getBddEncodingLessOrEqualThan(uint64_t bound, InternalBdd<DdType::CUDD>
const& cube,
38 uint64_t numberOfDdVariables)
const {
39 return InternalBdd<DdType::CUDD>(
this, cudd::BDD(cuddManager, this->getBddEncodingLessOrEqualThanRec(0, (1ull << numberOfDdVariables) - 1, bound,
40 cube.getCuddDdNode(), numberOfDdVariables)));
43DdNodePtr InternalDdManager<DdType::CUDD>::getBddEncodingLessOrEqualThanRec(uint64_t minimalValue, uint64_t maximalValue, uint64_t bound, DdNodePtr cube,
44 uint64_t remainingDdVariables)
const {
45 if (maximalValue <= bound) {
46 return Cudd_ReadOne(cuddManager.getManager());
47 }
else if (minimalValue > bound) {
48 return Cudd_ReadLogicZero(cuddManager.getManager());
51 STORM_LOG_ASSERT(remainingDdVariables > 0,
"Expected more remaining DD variables.");
53 uint64_t newRemainingDdVariables = remainingDdVariables - 1;
54 DdNodePtr elseResult =
55 getBddEncodingLessOrEqualThanRec(minimalValue, maximalValue & ~(1ull << newRemainingDdVariables), bound, Cudd_T(cube), newRemainingDdVariables);
57 DdNodePtr thenResult =
58 getBddEncodingLessOrEqualThanRec(minimalValue | (1ull << newRemainingDdVariables), maximalValue, bound, Cudd_T(cube), newRemainingDdVariables);
62 bool complemented = Cudd_IsComplement(thenResult);
64 cuddUniqueInter(cuddManager.getManager(), Cudd_NodeReadIndex(cube), Cudd_Regular(thenResult), complemented ? Cudd_Not(elseResult) : elseResult);
66 result = Cudd_Not(result);
68 Cudd_Deref(thenResult);
69 Cudd_Deref(elseResult);
73template<
typename ValueType>
74InternalAdd<DdType::CUDD, ValueType> InternalDdManager<DdType::CUDD>::getAddZero()
const {
75 return InternalAdd<DdType::CUDD, ValueType>(
this, cuddManager.addZero());
78template<
typename ValueType>
79InternalAdd<DdType::CUDD, ValueType> InternalDdManager<DdType::CUDD>::getAddUndefined()
const {
80 STORM_LOG_THROW(
false, storm::exceptions::NotSupportedException,
"Undefined values are not supported by CUDD.");
83template<
typename ValueType>
84InternalAdd<DdType::CUDD, ValueType> InternalDdManager<DdType::CUDD>::getConstant(ValueType
const& value)
const {
85 return InternalAdd<DdType::CUDD, ValueType>(
this, cuddManager.constant(value));
88std::vector<InternalBdd<DdType::CUDD>> InternalDdManager<DdType::CUDD>::createDdVariables(uint64_t numberOfLayers,
89 boost::optional<uint_fast64_t>
const& position) {
90 std::vector<InternalBdd<DdType::CUDD>> result;
93 for (uint64_t layer = 0; layer < numberOfLayers; ++layer) {
94 result.emplace_back(InternalBdd<DdType::CUDD>(
this, cuddManager.bddNewVarAtLevel(position.get() + layer)));
97 for (uint64_t layer = 0; layer < numberOfLayers; ++layer) {
98 result.emplace_back(InternalBdd<DdType::CUDD>(
this, cuddManager.bddVar()));
105 cuddManager.MakeTreeNode(result.front().getIndex(), numberOfLayers, MTR_FIXED);
108 numberOfDdVariables += numberOfLayers;
113bool InternalDdManager<DdType::CUDD>::supportsOrderedInsertion()
const {
117void InternalDdManager<DdType::CUDD>::allowDynamicReordering(
bool value) {
118 STORM_LOG_THROW(!value, storm::exceptions::NotSupportedException,
"Dynamic reordering is not supported for CUDD.");
121bool InternalDdManager<DdType::CUDD>::isDynamicReorderingAllowed()
const {
125void InternalDdManager<DdType::CUDD>::triggerReordering() {
126 STORM_LOG_THROW(
false, storm::exceptions::NotSupportedException,
"Dynamic reordering is not supported for CUDD.");
129void InternalDdManager<DdType::CUDD>::debugCheck()
const {
130 this->getCuddManager().CheckKeys();
131 this->getCuddManager().DebugCheck();
134void InternalDdManager<DdType::CUDD>::execute(std::function<
void()>
const& f)
const {
138cudd::Cudd& InternalDdManager<DdType::CUDD>::getCuddManager() {
142cudd::Cudd
const& InternalDdManager<DdType::CUDD>::getCuddManager()
const {
146uint_fast64_t InternalDdManager<DdType::CUDD>::getNumberOfDdVariables()
const {
147 return numberOfDdVariables;
154 "This version of Storm was compiled without support for CUDD. Yet, a method was called that requires this support. Please choose a version "
155 "of Storm with CUDD support.");
164 "This version of Storm was compiled without support for CUDD. Yet, a method was called that requires this support. Please choose a version "
165 "of Storm with CUDD support.");
168template<
typename ValueType>
171 "This version of Storm was compiled without support for CUDD. Yet, a method was called that requires this support. Please choose a version "
172 "of Storm with CUDD support.");
177 "This version of Storm was compiled without support for CUDD. Yet, a method was called that requires this support. Please choose a version "
178 "of Storm with CUDD support.");
182 uint64_t numberOfDdVariables)
const {
184 "This version of Storm was compiled without support for CUDD. Yet, a method was called that requires this support. Please choose a version "
185 "of Storm with CUDD support.");
188template<
typename ValueType>
191 "This version of Storm was compiled without support for CUDD. Yet, a method was called that requires this support. Please choose a version "
192 "of Storm with CUDD support.");
195template<
typename ValueType>
198 "This version of Storm was compiled without support for CUDD. Yet, a method was called that requires this support. Please choose a version "
199 "of Storm with CUDD support.");
202template<
typename ValueType>
205 "This version of Storm was compiled without support for CUDD. Yet, a method was called that requires this support. Please choose a version "
206 "of Storm with CUDD support.");
210 boost::optional<uint_fast64_t>
const& position) {
212 "This version of Storm was compiled without support for CUDD. Yet, a method was called that requires this support. Please choose a version "
213 "of Storm with CUDD support.");
218 "This version of Storm was compiled without support for CUDD. Yet, a method was called that requires this support. Please choose a version "
219 "of Storm with CUDD support.");
224 "This version of Storm was compiled without support for CUDD. Yet, a method was called that requires this support. Please choose a version "
225 "of Storm with CUDD support.");
230 "This version of Storm was compiled without support for CUDD. Yet, a method was called that requires this support. Please choose a version "
231 "of Storm with CUDD support.");
236 "This version of Storm was compiled without support for CUDD. Yet, a method was called that requires this support. Please choose a version "
237 "of Storm with CUDD support.");
242 "This version of Storm was compiled without support for CUDD. Yet, a method was called that requires this support. Please choose a version "
243 "of Storm with CUDD support.");
248 "This version of Storm was compiled without support for CUDD. Yet, a method was called that requires this support. Please choose a version "
249 "of Storm with CUDD support.");
254 "This version of Storm was compiled without support for CUDD. Yet, a method was called that requires this support. Please choose a version "
255 "of Storm with CUDD support.");
uint64_t getMaximalMemory() const
Retrieves the maximal amount of memory (in megabytes) that CUDD can occupy.
double getConstantPrecision() const
Retrieves the precision up to which constants are considered to be different.
InternalDdManager(storm::CuddDdManagerEnvironment const &environment)
Creates a new internal manager for CUDD DDs.
#define STORM_LOG_ASSERT(cond, message)
#define STORM_LOG_THROW(cond, exception, message)
The contract of a DD backend.