3#include <boost/algorithm/string/join.hpp>
18template<DdType LibraryType,
typename ValueType>
20 std::set<storm::expressions::Variable>
const& containedMetaVariables)
21 :
Dd<LibraryType>(ddManager, containedMetaVariables), internalAdd(internalAdd) {
25template<DdType LibraryType,
typename ValueType>
27 return internalAdd == other.internalAdd;
30template<DdType LibraryType,
typename ValueType>
32 return internalAdd != other.internalAdd;
35template<DdType LibraryType,
typename ValueType>
40template<DdType LibraryType,
typename ValueType>
43 internalAdd += other.internalAdd;
47template<DdType LibraryType,
typename ValueType>
52template<DdType LibraryType,
typename ValueType>
55 internalAdd *= other.internalAdd;
59template<DdType LibraryType,
typename ValueType>
64template<DdType LibraryType,
typename ValueType>
66 return this->
getDdManager().template getAddZero<ValueType>() - *
this;
69template<DdType LibraryType,
typename ValueType>
72 internalAdd -= other.internalAdd;
76template<DdType LibraryType,
typename ValueType>
81template<DdType LibraryType,
typename ValueType>
84 internalAdd /= other.internalAdd;
88template<DdType LibraryType,
typename ValueType>
93template<DdType LibraryType,
typename ValueType>
98template<DdType LibraryType,
typename ValueType>
103template<DdType LibraryType,
typename ValueType>
108template<DdType LibraryType,
typename ValueType>
113template<DdType LibraryType,
typename ValueType>
118template<DdType LibraryType,
typename ValueType>
123template<DdType LibraryType,
typename ValueType>
128template<DdType LibraryType,
typename ValueType>
133template<DdType LibraryType,
typename ValueType>
138template<DdType LibraryType,
typename ValueType>
143template<DdType LibraryType,
typename ValueType>
148 this->getContainedMetaVariables());
151template<DdType LibraryType,
typename ValueType>
156template<DdType LibraryType,
typename ValueType>
161template<DdType LibraryType,
typename ValueType>
168template<DdType LibraryType,
typename ValueType>
175template<DdType LibraryType,
typename ValueType>
181template<DdType LibraryType,
typename ValueType>
188template<DdType LibraryType,
typename ValueType>
194template<DdType LibraryType,
typename ValueType>
196 return internalAdd.equalModuloPrecision(other, precision, relative);
199template<DdType LibraryType,
typename ValueType>
201 std::set<storm::expressions::Variable>
const& to)
const {
202 std::vector<InternalBdd<LibraryType>> fromBdds;
203 std::vector<InternalBdd<LibraryType>> toBdds;
205 for (
auto const& metaVariable : from) {
207 "Cannot rename variable '" << metaVariable.getName() <<
"' that is not present.");
209 for (
auto const& ddVariable : ddMetaVariable.getDdVariables()) {
210 fromBdds.push_back(ddVariable.getInternalBdd());
213 for (
auto const& metaVariable : to) {
214 STORM_LOG_THROW(!this->containsMetaVariable(metaVariable), storm::exceptions::InvalidOperationException,
215 "Cannot rename to variable '" << metaVariable.getName() <<
"' that is already present.");
217 for (
auto const& ddVariable : ddMetaVariable.getDdVariables()) {
218 toBdds.push_back(ddVariable.getInternalBdd());
222 std::set<storm::expressions::Variable> newContainedMetaVariables = to;
223 std::set_difference(this->getContainedMetaVariables().begin(), this->getContainedMetaVariables().end(), from.begin(), from.end(),
224 std::inserter(newContainedMetaVariables, newContainedMetaVariables.begin()));
226 STORM_LOG_THROW(fromBdds.size() == toBdds.size(), storm::exceptions::InvalidArgumentException,
"Unable to rename mismatching meta variables.");
230template<DdType LibraryType,
typename ValueType>
232 std::set<storm::expressions::Variable>
const& to)
const {
233 std::vector<InternalBdd<LibraryType>> fromBdds;
234 std::vector<InternalBdd<LibraryType>> toBdds;
236 for (
auto const& metaVariable : from) {
238 "Cannot rename variable '" << metaVariable.getName() <<
"' that is not present.");
240 for (
auto const& ddVariable : ddMetaVariable.getDdVariables()) {
241 fromBdds.push_back(ddVariable.getInternalBdd());
244 std::sort(fromBdds.begin(), fromBdds.end(),
246 for (
auto const& metaVariable : to) {
247 STORM_LOG_THROW(!this->containsMetaVariable(metaVariable), storm::exceptions::InvalidOperationException,
248 "Cannot rename to variable '" << metaVariable.getName() <<
"' that is already present.");
250 for (
auto const& ddVariable : ddMetaVariable.getDdVariables()) {
251 toBdds.push_back(ddVariable.getInternalBdd());
254 std::sort(toBdds.begin(), toBdds.end(), [](InternalBdd<LibraryType>
const& a, InternalBdd<LibraryType>
const& b) { return a.getLevel() < b.getLevel(); });
256 std::set<storm::expressions::Variable> newContainedMetaVariables = to;
257 std::set_difference(this->getContainedMetaVariables().begin(), this->getContainedMetaVariables().end(), from.begin(), from.end(),
258 std::inserter(newContainedMetaVariables, newContainedMetaVariables.begin()));
260 STORM_LOG_ASSERT(fromBdds.size() >= toBdds.size(),
"Unable to perform rename-abstract with mismatching sizes.");
262 if (fromBdds.size() == toBdds.size()) {
266 for (uint64_t index = toBdds.size(); index < fromBdds.size(); ++index) {
267 cube &= fromBdds[index];
269 fromBdds.resize(toBdds.size());
271 return Add<LibraryType, ValueType>(this->getDdManager(), internalAdd.sumAbstract(cube).permuteVariables(fromBdds, toBdds), newContainedMetaVariables);
275template<DdType LibraryType,
typename ValueType>
277 std::vector<std::pair<storm::expressions::Variable, storm::expressions::Variable>>
const& metaVariablePairs)
const {
278 std::set<storm::expressions::Variable> newContainedMetaVariables;
279 std::set<storm::expressions::Variable> deletedMetaVariables;
280 std::vector<InternalBdd<LibraryType>> from;
281 std::vector<InternalBdd<LibraryType>> to;
282 for (
auto const& metaVariablePair : metaVariablePairs) {
291 newContainedMetaVariables.insert(metaVariablePair.second);
292 deletedMetaVariables.insert(metaVariablePair.first);
295 if (!this->containsMetaVariable(metaVariablePair.second)) {
298 newContainedMetaVariables.insert(metaVariablePair.first);
299 deletedMetaVariables.insert(metaVariablePair.second);
302 for (
auto const& ddVariable : variable1.getDdVariables()) {
303 from.push_back(ddVariable.getInternalBdd());
305 for (
auto const& ddVariable : variable2.getDdVariables()) {
306 to.push_back(ddVariable.getInternalBdd());
310 std::set<storm::expressions::Variable> tmp;
311 std::set_difference(this->getContainedMetaVariables().begin(), this->getContainedMetaVariables().end(), deletedMetaVariables.begin(),
312 deletedMetaVariables.end(), std::inserter(tmp, tmp.begin()));
313 std::set<storm::expressions::Variable> containedMetaVariables;
314 std::set_union(tmp.begin(), tmp.end(), newContainedMetaVariables.begin(), newContainedMetaVariables.end(),
315 std::inserter(containedMetaVariables, containedMetaVariables.begin()));
316 STORM_LOG_THROW(from.size() == to.size(), storm::exceptions::InvalidArgumentException,
"Unable to swap mismatching meta variables.");
320template<DdType LibraryType,
typename ValueType>
322 std::vector<std::pair<storm::expressions::Variable, storm::expressions::Variable>>
const& metaVariablePairs)
const {
323 std::set<storm::expressions::Variable> newContainedMetaVariables;
324 std::set<storm::expressions::Variable> deletedMetaVariables;
325 std::vector<InternalBdd<LibraryType>> from;
326 std::vector<InternalBdd<LibraryType>> to;
327 for (
auto const& metaVariablePair : metaVariablePairs) {
333 deletedMetaVariables.insert(metaVariablePair.first);
334 newContainedMetaVariables.insert(metaVariablePair.second);
337 for (
auto const& ddVariable : variable1.getDdVariables()) {
338 from.push_back(ddVariable.getInternalBdd());
340 for (
auto const& ddVariable : variable2.getDdVariables()) {
341 to.push_back(ddVariable.getInternalBdd());
345 std::set<storm::expressions::Variable> tmp;
346 std::set_difference(this->getContainedMetaVariables().begin(), this->getContainedMetaVariables().end(), deletedMetaVariables.begin(),
347 deletedMetaVariables.end(), std::inserter(tmp, tmp.begin()));
348 std::set<storm::expressions::Variable> containedMetaVariables;
349 std::set_union(tmp.begin(), tmp.end(), newContainedMetaVariables.begin(), newContainedMetaVariables.end(),
350 std::inserter(containedMetaVariables, containedMetaVariables.begin()));
351 STORM_LOG_THROW(from.size() == to.size(), storm::exceptions::InvalidArgumentException,
"Unable to swap mismatching meta variables.");
355template<DdType LibraryType,
typename ValueType>
357 std::set<storm::expressions::Variable>
const& summationMetaVariables)
const {
359 std::vector<InternalBdd<LibraryType>> summationDdVariables;
360 for (
auto const& metaVariable : summationMetaVariables) {
361 for (
auto const& ddVariable : this->
getDdManager().getMetaVariable(metaVariable).getDdVariables()) {
362 summationDdVariables.push_back(ddVariable.getInternalBdd());
367 std::set<storm::expressions::Variable> containedMetaVariables;
368 std::set_difference(unionOfMetaVariables.begin(), unionOfMetaVariables.end(), summationMetaVariables.begin(), summationMetaVariables.end(),
369 std::inserter(containedMetaVariables, containedMetaVariables.begin()));
371 return Add<LibraryType, ValueType>(this->getDdManager(), internalAdd.multiplyMatrix(otherMatrix, summationDdVariables), containedMetaVariables);
374template<DdType LibraryType,
typename ValueType>
376 std::set<storm::expressions::Variable>
const& summationMetaVariables)
const {
378 std::vector<InternalBdd<LibraryType>> summationDdVariables;
379 for (
auto const& metaVariable : summationMetaVariables) {
380 for (
auto const& ddVariable : this->
getDdManager().getMetaVariable(metaVariable).getDdVariables()) {
381 summationDdVariables.push_back(ddVariable.getInternalBdd());
386 std::set<storm::expressions::Variable> containedMetaVariables;
387 std::set_difference(unionOfMetaVariables.begin(), unionOfMetaVariables.end(), summationMetaVariables.begin(), summationMetaVariables.end(),
388 std::inserter(containedMetaVariables, containedMetaVariables.begin()));
391 containedMetaVariables);
394template<DdType LibraryType,
typename ValueType>
399template<DdType LibraryType,
typename ValueType>
404template<DdType LibraryType,
typename ValueType>
409template<DdType LibraryType,
typename ValueType>
414template<DdType LibraryType,
typename ValueType>
419template<DdType LibraryType,
typename ValueType>
424template<DdType LibraryType,
typename ValueType>
429template<DdType LibraryType,
typename ValueType>
434template<DdType LibraryType,
typename ValueType>
436 std::size_t numberOfDdVariables = 0;
438 numberOfDdVariables += this->
getDdManager().getMetaVariable(metaVariable).getNumberOfDdVariables();
440 return internalAdd.getNonZeroCount(numberOfDdVariables);
443template<DdType LibraryType,
typename ValueType>
445 return internalAdd.getLeafCount();
448template<DdType LibraryType,
typename ValueType>
450 return internalAdd.getNodeCount();
453template<DdType LibraryType,
typename ValueType>
455 return internalAdd.getMin();
458template<DdType LibraryType,
typename ValueType>
460 return internalAdd.getMax();
463template<DdType LibraryType,
typename ValueType>
465 std::map<storm::expressions::Variable, int_fast64_t> metaVariableToValueMap;
466 metaVariableToValueMap.emplace(metaVariable, variableValue);
467 this->
setValue(metaVariableToValueMap, targetValue);
470template<DdType LibraryType,
typename ValueType>
473 std::map<storm::expressions::Variable, int_fast64_t> metaVariableToValueMap;
474 metaVariableToValueMap.emplace(metaVariable1, variableValue1);
475 metaVariableToValueMap.emplace(metaVariable2, variableValue2);
476 this->
setValue(metaVariableToValueMap, targetValue);
479template<DdType LibraryType,
typename ValueType>
482 for (
auto const& nameValuePair : metaVariableToValueMap) {
483 valueEncoding &= this->
getDdManager().getEncoding(nameValuePair.first, nameValuePair.second);
488 internalAdd = valueEncoding.
ite(this->getDdManager().getConstant(targetValue), *
this);
491template<DdType LibraryType,
typename ValueType>
495 for (
auto const& nameValuePair : metaVariableToValueMap) {
496 valueEncoding &= this->
getDdManager().getEncoding(nameValuePair.first, nameValuePair.second);
498 remainingMetaVariables.erase(nameValuePair.first);
502 STORM_LOG_THROW(remainingMetaVariables.empty(), storm::exceptions::InvalidArgumentException,
503 "Cannot evaluate function for which not all inputs were given.");
506 value = value.
sumAbstract(this->getContainedMetaVariables());
507 return value.internalAdd.getValue();
510template<DdType LibraryType,
typename ValueType>
512 return internalAdd.isOne();
515template<DdType LibraryType,
typename ValueType>
517 return internalAdd.isZero();
520template<DdType LibraryType,
typename ValueType>
522 return internalAdd.isConstant();
525template<DdType LibraryType,
typename ValueType>
527 return internalAdd.getIndex();
530template<DdType LibraryType,
typename ValueType>
532 return internalAdd.getLevel();
535template<DdType LibraryType,
typename ValueType>
540template<DdType LibraryType,
typename ValueType>
544 internalAdd.composeWithExplicitVector(rowOdd, ddVariableIndices, result, std::plus<ValueType>());
548template<DdType LibraryType,
typename ValueType>
550 std::vector<uint_fast64_t>
const& rowGroupIndices,
551 std::set<storm::expressions::Variable>
const& rowMetaVariables,
552 std::set<storm::expressions::Variable>
const& columnMetaVariables,
553 std::set<storm::expressions::Variable>
const& groupMetaVariables,
555 std::vector<uint_fast64_t> ddRowVariableIndices;
556 std::vector<uint_fast64_t> ddColumnVariableIndices;
557 std::vector<uint_fast64_t> ddGroupVariableIndices;
558 std::set<storm::expressions::Variable> rowAndColumnMetaVariables;
560 for (
auto const& variable : rowMetaVariables) {
562 for (
auto const& ddVariable : metaVariable.getDdVariables()) {
563 ddRowVariableIndices.push_back(ddVariable.getIndex());
565 rowAndColumnMetaVariables.insert(variable);
567 std::sort(ddRowVariableIndices.begin(), ddRowVariableIndices.end());
568 for (
auto const& variable : columnMetaVariables) {
569 DdMetaVariable<LibraryType>
const& metaVariable = this->getDdManager().getMetaVariable(variable);
570 for (
auto const& ddVariable : metaVariable.getDdVariables()) {
571 ddColumnVariableIndices.push_back(ddVariable.getIndex());
573 rowAndColumnMetaVariables.insert(variable);
575 std::sort(ddColumnVariableIndices.begin(), ddColumnVariableIndices.end());
576 for (
auto const& variable : groupMetaVariables) {
578 for (
auto const& ddVariable : metaVariable.getDdVariables()) {
579 ddGroupVariableIndices.push_back(ddVariable.getIndex());
582 std::sort(ddGroupVariableIndices.begin(), ddGroupVariableIndices.end());
587 std::vector<uint_fast64_t> mutableRowGroupIndices = rowGroupIndices;
590 std::vector<ValueType> explicitVector(mutableRowGroupIndices.back());
594 matrix.internalAdd.splitIntoGroups(*
this, ddGroupVariableIndices);
596 for (
auto const& internalAdd : internalAddGroups) {
601 std::vector<InternalAdd<LibraryType, uint_fast64_t>> statesWithGroupEnabled(groups.size());
602 for (uint_fast64_t i = 0; i < groups.size(); ++i) {
603 std::pair<Add<LibraryType, ValueType>, Add<LibraryType, ValueType>>
const& ddPair = groups[i];
604 Bdd<LibraryType> matrixDdNotZero = ddPair.first.notZero();
605 Bdd<LibraryType> vectorDdNotZero = ddPair.second.notZero();
607 ddPair.second.internalAdd.composeWithExplicitVector(rowOdd, ddRowVariableIndices, mutableRowGroupIndices, explicitVector, std::plus<ValueType>());
609 InternalAdd<LibraryType, uint_fast64_t> statesWithGroupEnabled =
610 (matrixDdNotZero.existsAbstract(columnMetaVariables) || vectorDdNotZero).template toAdd<uint_fast64_t>();
611 statesWithGroupEnabled.composeWithExplicitVector(rowOdd, ddRowVariableIndices, mutableRowGroupIndices, std::plus<uint_fast64_t>());
614 return explicitVector;
617template<DdType LibraryType,
typename ValueType>
619 std::set<storm::expressions::Variable> rowVariables;
620 std::set<storm::expressions::Variable> columnVariables;
623 if (variable.getName().size() > 0 && variable.getName().back() ==
'\'') {
624 columnVariables.insert(variable);
626 rowVariables.insert(variable);
630 return toMatrix(rowVariables, columnVariables, this->sumAbstract(rowVariables).createOdd(), this->sumAbstract(columnVariables).createOdd());
633template<DdType LibraryType,
typename ValueType>
635 std::set<storm::expressions::Variable> rowMetaVariables;
636 std::set<storm::expressions::Variable> columnMetaVariables;
639 if (variable.getName().size() > 0 && variable.getName().back() ==
'\'') {
640 columnMetaVariables.insert(variable);
642 rowMetaVariables.insert(variable);
646 return toMatrix(rowMetaVariables, columnMetaVariables, rowOdd, columnOdd);
649template<DdType LibraryType,
typename ValueType>
651 std::set<storm::expressions::Variable>
const& columnMetaVariables,
653 std::vector<uint_fast64_t> ddRowVariableIndices;
654 std::vector<uint_fast64_t> ddColumnVariableIndices;
656 for (
auto const& variable : rowMetaVariables) {
658 for (
auto const& ddVariable : metaVariable.getDdVariables()) {
659 ddRowVariableIndices.push_back(ddVariable.getIndex());
662 std::sort(ddRowVariableIndices.begin(), ddRowVariableIndices.end());
664 for (
auto const& variable : columnMetaVariables) {
666 for (
auto const& ddVariable : metaVariable.getDdVariables()) {
667 ddColumnVariableIndices.push_back(ddVariable.getIndex());
670 std::sort(ddColumnVariableIndices.begin(), ddColumnVariableIndices.end());
673 std::vector<uint_fast64_t> rowIndications(rowOdd.
getTotalOffset() + 1);
674 std::vector<storm::storage::MatrixEntry<uint_fast64_t, ValueType>> columnsAndValues(this->
getNonZeroCount());
677 std::vector<uint_fast64_t> trivialRowGroupIndices(rowIndications.size());
679 for (
auto& entry : trivialRowGroupIndices) {
685 rowIndications = this->
notZero().template toAdd<uint_fast64_t>().sumAbstract(columnMetaVariables).toVector(rowOdd);
686 rowIndications.emplace_back();
689 uint_fast64_t tmp = 0;
690 uint_fast64_t tmp2 = 0;
691 for (uint_fast64_t i = 1; i < rowIndications.size(); ++i) {
692 tmp2 = rowIndications[i];
693 rowIndications[i] = rowIndications[i - 1] + tmp;
694 std::swap(tmp, tmp2);
696 rowIndications[0] = 0;
699 internalAdd.toMatrixComponents(trivialRowGroupIndices, rowIndications, columnsAndValues, rowOdd, columnOdd, ddRowVariableIndices, ddColumnVariableIndices,
703 for (uint_fast64_t i = rowIndications.size() - 1; i > 0; --i) {
704 rowIndications[i] = rowIndications[i - 1];
706 rowIndications[0] = 0;
712template<DdType LibraryType,
typename ValueType>
715 std::set<storm::expressions::Variable> rowMetaVariables;
716 std::set<storm::expressions::Variable> columnMetaVariables;
720 if (groupMetaVariables.contains(variable)) {
724 if (variable.getName().size() > 0 && variable.getName().back() ==
'\'') {
725 columnMetaVariables.insert(variable);
727 rowMetaVariables.insert(variable);
732 return toLabeledMatrix(rowMetaVariables, columnMetaVariables, groupMetaVariables, rowOdd, columnOdd).matrix;
735template<DdType LibraryType,
typename ValueType>
737 std::set<storm::expressions::Variable>
const& rowMetaVariables, std::set<storm::expressions::Variable>
const& columnMetaVariables,
739 std::vector<std::set<storm::expressions::Variable>>
const& labelMetaVariables)
const {
740 std::vector<uint_fast64_t> ddRowVariableIndices;
741 std::vector<uint_fast64_t> ddColumnVariableIndices;
742 std::vector<uint_fast64_t> ddGroupVariableIndices;
743 std::vector<storm::storage::BitVector> ddLabelVariableIndicesVector;
744 std::set<storm::expressions::Variable> rowAndColumnMetaVariables;
745 bool buildLabeling = !labelMetaVariables.empty();
746 MatrixAndLabeling result;
748 for (
auto const& variable : rowMetaVariables) {
750 for (
auto const& ddVariable : metaVariable.getDdVariables()) {
751 ddRowVariableIndices.push_back(ddVariable.getIndex());
753 rowAndColumnMetaVariables.insert(variable);
755 std::sort(ddRowVariableIndices.begin(), ddRowVariableIndices.end());
756 for (
auto const& variable : columnMetaVariables) {
758 for (
auto const& ddVariable : metaVariable.getDdVariables()) {
759 ddColumnVariableIndices.push_back(ddVariable.getIndex());
761 rowAndColumnMetaVariables.insert(variable);
763 std::sort(ddColumnVariableIndices.begin(), ddColumnVariableIndices.end());
764 for (
auto const& variable : groupMetaVariables) {
766 for (
auto const& ddVariable : metaVariable.getDdVariables()) {
767 ddGroupVariableIndices.push_back(ddVariable.getIndex());
770 std::sort(ddGroupVariableIndices.begin(), ddGroupVariableIndices.end());
772 for (
auto const& labelMetaVariableSet : labelMetaVariables) {
773 std::set<uint64_t> ddLabelVariableIndicesSet;
774 for (
auto const& variable : labelMetaVariableSet) {
776 for (
auto const& ddVariable : metaVariable.getDdVariables()) {
777 ddLabelVariableIndicesSet.insert(ddVariable.getIndex());
781 ddLabelVariableIndicesVector.emplace_back(ddGroupVariableIndices.size());
782 uint64_t position = 0;
783 for (
auto const& index : ddGroupVariableIndices) {
784 if (ddLabelVariableIndicesSet.contains(index)) {
785 ddLabelVariableIndicesVector.back().set(position);
796 this->
notZero().existsAbstract(columnMetaVariables).template toAdd<uint_fast64_t>().sumAbstract(groupMetaVariables);
797 std::vector<uint_fast64_t> rowGroupIndices = stateToNumberOfChoices.
toVector(rowOdd);
798 rowGroupIndices.resize(rowGroupIndices.size() + 1);
799 uint_fast64_t tmp = 0;
800 uint_fast64_t tmp2 = 0;
801 for (uint_fast64_t i = 1; i < rowGroupIndices.size(); ++i) {
802 tmp2 = rowGroupIndices[i];
803 rowGroupIndices[i] = rowGroupIndices[i - 1] + tmp;
804 std::swap(tmp, tmp2);
806 rowGroupIndices[0] = 0;
810 std::vector<InternalAdd<LibraryType, ValueType>> internalAddGroups = internalAdd.splitIntoGroups(ddGroupVariableIndices);
811 std::vector<Add<LibraryType, ValueType>> groups;
812 for (
auto const& internalAdd : internalAddGroups) {
817 std::vector<std::vector<uint64_t>> groupLabelings;
819 for (
auto const& ddLabelVariableIndices : ddLabelVariableIndicesVector) {
820 groupLabelings.emplace_back(internalAdd.decodeGroupLabels(ddGroupVariableIndices, ddLabelVariableIndices));
821 STORM_LOG_ASSERT(groupLabelings.back().size() == groups.size(),
"Mismatching label sizes.");
826 std::vector<storm::storage::MatrixEntry<uint_fast64_t, ValueType>> columnsAndValues(this->getNonZeroCount());
829 std::vector<uint_fast64_t> rowIndications(rowGroupIndices.back() + 1);
832 for (uint64_t i = 0;
i < labelMetaVariables.size(); ++
i) {
833 result.labelings.emplace_back(rowGroupIndices.back());
837 std::vector<InternalAdd<LibraryType, uint_fast64_t>> statesWithGroupEnabled(groups.size());
838 InternalAdd<LibraryType, uint_fast64_t> stateToRowGroupCount = this->getDdManager().template getAddZero<uint_fast64_t>();
839 for (uint_fast64_t i = 0;
i < groups.size(); ++
i) {
840 auto const& group = groups[
i];
841 auto groupNotZero = group.notZero();
843 std::vector<uint64_t> tmpRowIndications = groupNotZero.template toAdd<uint_fast64_t>().sumAbstract(columnMetaVariables).toVector(rowOdd);
844 for (uint64_t offset = 0; offset < tmpRowIndications.size(); ++offset) {
845 rowIndications[rowGroupIndices[offset]] += tmpRowIndications[offset];
848 statesWithGroupEnabled[
i] = groupNotZero.existsAbstract(columnMetaVariables).template toAdd<uint_fast64_t>();
850 for (uint64_t j = 0; j < labelMetaVariables.size(); ++j) {
851 uint64_t currentLabel = groupLabelings[j][
i];
852 statesWithGroupEnabled[
i].forEach(rowOdd, ddRowVariableIndices,
853 [currentLabel, &rowGroupIndices, &result, j](uint64_t
const& offset, uint_fast64_t
const& value) {
854 result.labelings[j][rowGroupIndices[offset]] = currentLabel;
858 statesWithGroupEnabled[
i].composeWithExplicitVector(rowOdd, ddRowVariableIndices, rowGroupIndices, std::plus<uint_fast64_t>());
862 stateToNumberOfChoices.internalAdd.composeWithExplicitVector(rowOdd, ddRowVariableIndices, rowGroupIndices, std::minus<uint_fast64_t>());
867 for (uint_fast64_t i = 1;
i < rowIndications.size(); ++
i) {
868 tmp2 = rowIndications[
i];
869 rowIndications[
i] = rowIndications[
i - 1] + tmp;
870 std::swap(tmp, tmp2);
872 rowIndications[0] = 0;
875 for (uint_fast64_t i = 0;
i < groups.size(); ++
i) {
876 auto const& group = groups[
i];
878 group.internalAdd.toMatrixComponents(rowGroupIndices, rowIndications, columnsAndValues, rowOdd, columnOdd, ddRowVariableIndices,
879 ddColumnVariableIndices,
true);
881 statesWithGroupEnabled[
i].composeWithExplicitVector(rowOdd, ddRowVariableIndices, rowGroupIndices, std::plus<uint_fast64_t>());
885 stateToNumberOfChoices.internalAdd.composeWithExplicitVector(rowOdd, ddRowVariableIndices, rowGroupIndices, std::minus<uint_fast64_t>());
888 for (uint_fast64_t i = rowIndications.size() - 1; i > 0; --i) {
889 rowIndications[
i] = rowIndications[
i - 1];
891 rowIndications[0] = 0;
899template<DdType LibraryType,
typename ValueType>
903 std::set<storm::expressions::Variable> rowMetaVariables;
904 std::set<storm::expressions::Variable> columnMetaVariables;
908 if (groupMetaVariables.contains(variable)) {
912 if (variable.getName().size() > 0 && variable.getName().back() ==
'\'') {
913 columnMetaVariables.insert(variable);
915 rowMetaVariables.insert(variable);
920 return toMatrixVector(vector, rowMetaVariables, columnMetaVariables, groupMetaVariables, rowOdd, columnOdd);
923template<DdType LibraryType,
typename ValueType>
926 std::set<storm::expressions::Variable>
const& columnMetaVariables, std::set<storm::expressions::Variable>
const& groupMetaVariables,
929 std::vector<uint_fast64_t> rowGroupIndices = (this->notZero().existsAbstract(columnMetaVariables) || vector.
notZero())
930 .
template toAdd<uint_fast64_t>()
931 .sumAbstract(groupMetaVariables)
933 return toMatrixVector(std::move(rowGroupIndices), vector, rowMetaVariables, columnMetaVariables, groupMetaVariables, rowOdd, columnOdd);
936template<DdType LibraryType,
typename ValueType>
939 std::set<storm::expressions::Variable>
const& rowMetaVariables, std::set<storm::expressions::Variable>
const& columnMetaVariables,
940 std::set<storm::expressions::Variable>
const& groupMetaVariables,
storm::dd::Odd const& rowOdd,
storm::dd::Odd const& columnOdd)
const {
941 auto resultAsVector =
toMatrixVectors(std::move(rowGroupIndices), {vector}, rowMetaVariables, columnMetaVariables, groupMetaVariables, rowOdd, columnOdd);
942 return std::make_pair(resultAsVector.first, resultAsVector.second.front());
945template<DdType LibraryType,
typename ValueType>
949 std::set<storm::expressions::Variable> rowMetaVariables;
950 std::set<storm::expressions::Variable> columnMetaVariables;
954 if (groupMetaVariables.contains(variable)) {
958 if (variable.getName().size() > 0 && variable.getName().back() ==
'\'') {
959 columnMetaVariables.insert(variable);
961 rowMetaVariables.insert(variable);
966 for (
auto const& v : vectors) {
967 vectorsNotZero |= v.notZero();
969 std::vector<uint_fast64_t> rowGroupIndices = (this->
notZero().existsAbstract(columnMetaVariables) || vectorsNotZero)
970 .
template toAdd<uint_fast64_t>()
971 .sumAbstract(groupMetaVariables)
973 return toMatrixVectors(std::move(rowGroupIndices), vectors, rowMetaVariables, columnMetaVariables, groupMetaVariables, rowOdd, columnOdd);
976template<DdType LibraryType,
typename ValueType>
979 std::set<storm::expressions::Variable>
const& rowMetaVariables, std::set<storm::expressions::Variable>
const& columnMetaVariables,
980 std::set<storm::expressions::Variable>
const& groupMetaVariables,
storm::dd::Odd const& rowOdd,
storm::dd::Odd const& columnOdd)
const {
981 std::vector<uint_fast64_t> ddRowVariableIndices;
982 std::vector<uint_fast64_t> ddColumnVariableIndices;
983 std::vector<uint_fast64_t> ddGroupVariableIndices;
984 std::set<storm::expressions::Variable> rowAndColumnMetaVariables;
986 for (
auto const& variable : rowMetaVariables) {
988 for (
auto const& ddVariable : metaVariable.getDdVariables()) {
989 ddRowVariableIndices.push_back(ddVariable.getIndex());
991 rowAndColumnMetaVariables.insert(variable);
993 std::sort(ddRowVariableIndices.begin(), ddRowVariableIndices.end());
994 for (
auto const& variable : columnMetaVariables) {
996 for (
auto const& ddVariable : metaVariable.getDdVariables()) {
997 ddColumnVariableIndices.push_back(ddVariable.getIndex());
999 rowAndColumnMetaVariables.insert(variable);
1001 std::sort(ddColumnVariableIndices.begin(), ddColumnVariableIndices.end());
1002 for (
auto const& variable : groupMetaVariables) {
1004 for (
auto const& ddVariable : metaVariable.getDdVariables()) {
1005 ddGroupVariableIndices.push_back(ddVariable.getIndex());
1008 std::sort(ddGroupVariableIndices.begin(), ddGroupVariableIndices.end());
1013 rowGroupIndices.resize(rowGroupIndices.size() + 1);
1014 uint_fast64_t tmp = 0;
1015 uint_fast64_t tmp2 = 0;
1016 for (uint_fast64_t i = 1; i < rowGroupIndices.size(); ++i) {
1017 tmp2 = rowGroupIndices[i];
1018 rowGroupIndices[i] = rowGroupIndices[i - 1] + tmp;
1019 std::swap(tmp, tmp2);
1021 rowGroupIndices[0] = 0;
1024 std::vector<std::vector<ValueType>> explicitVectors(vectors.size());
1025 for (
auto& v : explicitVectors) {
1026 v.resize(rowGroupIndices.back());
1030 std::vector<std::vector<Add<LibraryType, ValueType>>> groups;
1031 if (vectors.size() == 1) {
1034 internalAdd.splitIntoGroups(vectors.front(), ddGroupVariableIndices);
1035 for (
auto const& internalAdd : internalAddGroups) {
1040 std::vector<InternalAdd<LibraryType, ValueType>> internalVectors;
1042 internalVectors.push_back(v.getInternalAdd());
1044 std::vector<std::vector<InternalAdd<LibraryType, ValueType>>> internalAddGroups = internalAdd.splitIntoGroups(internalVectors, ddGroupVariableIndices);
1045 for (
auto const& internalAddGroup : internalAddGroups) {
1046 STORM_LOG_ASSERT(internalAddGroup.size() == vectors.size() + 1,
"Unexpected group size.");
1047 std::vector<Add<LibraryType, ValueType>> group;
1048 for (uint64_t vectorIndex = 0; vectorIndex < vectors.size(); ++vectorIndex) {
1053 groups.push_back(std::move(group));
1058 std::vector<storm::storage::MatrixEntry<uint_fast64_t, ValueType>> columnsAndValues(this->
getNonZeroCount());
1061 std::vector<uint_fast64_t> rowIndications(rowGroupIndices.back() + 1);
1063 std::vector<InternalAdd<LibraryType, uint_fast64_t>> statesWithGroupEnabled(groups.size());
1065 for (uint_fast64_t i = 0; i < groups.size(); ++i) {
1066 std::vector<Add<LibraryType, ValueType>>
const& group = groups[i];
1069 std::vector<uint64_t> tmpRowIndications = matrixDdNotZero.template toAdd<uint_fast64_t>().sumAbstract(columnMetaVariables).
toVector(rowOdd);
1070 for (uint64_t offset = 0; offset < tmpRowIndications.size(); ++offset) {
1071 rowIndications[rowGroupIndices[offset]] += tmpRowIndications[offset];
1075 for (uint64_t vectorIndex = 0; vectorIndex < vectors.size(); ++vectorIndex) {
1076 vectorDdNotZero |= group[vectorIndex].notZero();
1077 group[vectorIndex].internalAdd.composeWithExplicitVector(rowOdd, ddRowVariableIndices, rowGroupIndices, explicitVectors[vectorIndex],
1078 std::plus<ValueType>());
1081 statesWithGroupEnabled[i] = (matrixDdNotZero.
existsAbstract(columnMetaVariables) || vectorDdNotZero).template toAdd<uint_fast64_t>();
1082 stateToRowGroupCount += statesWithGroupEnabled[i];
1083 statesWithGroupEnabled[i].composeWithExplicitVector(rowOdd, ddRowVariableIndices, rowGroupIndices, std::plus<uint_fast64_t>());
1087 stateToRowGroupCount.composeWithExplicitVector(rowOdd, ddRowVariableIndices, rowGroupIndices, std::minus<uint_fast64_t>());
1092 for (uint_fast64_t i = 1; i < rowIndications.size(); ++i) {
1093 tmp2 = rowIndications[i];
1094 rowIndications[i] = rowIndications[i - 1] + tmp;
1095 std::swap(tmp, tmp2);
1097 rowIndications[0] = 0;
1100 for (uint_fast64_t i = 0; i < groups.size(); ++i) {
1101 auto const&
dd = groups[i].back();
1103 dd.internalAdd.toMatrixComponents(rowGroupIndices, rowIndications, columnsAndValues, rowOdd, columnOdd, ddRowVariableIndices, ddColumnVariableIndices,
1105 statesWithGroupEnabled[i].composeWithExplicitVector(rowOdd, ddRowVariableIndices, rowGroupIndices, std::plus<uint_fast64_t>());
1109 stateToRowGroupCount.composeWithExplicitVector(rowOdd, ddRowVariableIndices, rowGroupIndices, std::minus<uint_fast64_t>());
1112 for (uint_fast64_t i = rowIndications.size() - 1; i > 0; --i) {
1113 rowIndications[i] = rowIndications[i - 1];
1115 rowIndications[0] = 0;
1117 return std::make_pair(
1119 std::move(explicitVectors));
1122template<DdType LibraryType,
typename ValueType>
1124 internalAdd.exportToDot(filename, this->
getDdManager().getDdVariableNames(), showVariablesIfPossible);
1127template<DdType LibraryType,
typename ValueType>
1129 internalAdd.exportToText(filename);
1132template<DdType LibraryType,
typename ValueType>
1134 uint_fast64_t numberOfDdVariables = 0;
1136 auto const& ddMetaVariable = this->
getDdManager().getMetaVariable(metaVariable);
1144template<DdType LibraryType,
typename ValueType>
1149template<DdType LibraryType,
typename ValueType>
1153 std::vector<std::string> variableNames;
1155 variableNames.push_back(variable.getName());
1157 out <<
"contained variables: " << boost::algorithm::join(variableNames,
", ") <<
'\n';
1161template<DdType LibraryType,
typename ValueType>
1163 Odd const& odd, std::set<storm::expressions::Variable>
const& metaVariables) {
1166 ddManager.getSortedVariableIndices(metaVariables)),
1170template<DdType LibraryType,
typename ValueType>
1175template<DdType LibraryType,
typename ValueType>
1180template<DdType LibraryType,
typename ValueType>
1185template<DdType LibraryType,
typename ValueType>
1187 return internalAdd.getInternalDdManager();
1190template<DdType LibraryType,
typename ValueType>
1195template<DdType LibraryType,
typename ValueType>
1196template<
typename TargetValueType>
1201template<DdType LibraryType,
typename ValueType>
1202template<
typename TargetValueType>
Add< LibraryType, ValueType > restrict(Add< LibraryType, ValueType > const &constraint) const
Computes the restriction of the current ADD with the given constraint.
Add< LibraryType, ValueType > swapVariables(std::vector< std::pair< storm::expressions::Variable, storm::expressions::Variable > > const &metaVariablePairs) const
Swaps the given pairs of meta variables in the ADD.
MatrixAndLabeling toLabeledMatrix(std::set< storm::expressions::Variable > const &rowMetaVariables, std::set< storm::expressions::Variable > const &columnMetaVariables, std::set< storm::expressions::Variable > const &groupMetaVariables, storm::dd::Odd const &rowOdd, storm::dd::Odd const &columnOdd, std::vector< std::set< storm::expressions::Variable > > const &labelMetaVariables=std::vector< std::set< storm::expressions::Variable > >()) const
Add< LibraryType, ValueType > pow(Add< LibraryType, ValueType > const &other) const
Retrieves the function that represents the current ADD to the power of the given ADD.
Bdd< LibraryType > equals(Add< LibraryType, ValueType > const &other) const
Retrieves the function that maps all evaluations to one that have identical function values.
bool isOne() const
Retrieves whether this ADD represents the constant one function.
Add< LibraryType, ValueType > operator+(Add< LibraryType, ValueType > const &other) const
Adds the two ADDs.
Add< LibraryType, ValueType > operator*(Add< LibraryType, ValueType > const &other) const
Multiplies the two ADDs.
ValueType getMax() const
Retrieves the highest function value of any encoding.
void exportToDot(std::string const &filename, bool showVariablesIfPossible=true) const override
Exports the DD to the given file in the dot format.
InternalAdd< LibraryType, ValueType > const & getInternalAdd() const
Retrieves the internal ADD.
Add< LibraryType, ValueType > floor() const
Retrieves the function that floors all values in the current ADD.
Bdd< LibraryType > lessOrEqual(Add< LibraryType, ValueType > const &other) const
Retrieves the function that maps all evaluations to one whose function value in the first ADD are les...
std::pair< storm::storage::SparseMatrix< ValueType >, std::vector< std::vector< ValueType > > > toMatrixVectors(std::vector< storm::dd::Add< LibraryType, ValueType > > const &vectors, std::set< storm::expressions::Variable > const &groupMetaVariables, storm::dd::Odd const &rowOdd, storm::dd::Odd const &columnOdd) const
Converts the ADD to a row-grouped (sparse) matrix and the given vectors to row-grouped vectors.
virtual uint_fast64_t getLevel() const override
Retrieves the level of the topmost variable in the DD.
bool operator==(Add< LibraryType, ValueType > const &other) const
Retrieves whether the two DDs represent the same function.
Add< LibraryType, ValueType > logxy(Add< LibraryType, ValueType > const &other) const
Retrieves the function that represents the logarithm of the current ADD to the bases given by the sec...
Add< LibraryType, ValueType > minimum(Add< LibraryType, ValueType > const &other) const
Retrieves the function that maps all evaluations to the minimum of the function values of the two ADD...
Add< LibraryType, ValueType > & operator+=(Add< LibraryType, ValueType > const &other)
Adds the given ADD to the current one.
storm::storage::SparseMatrix< ValueType > toMatrix() const
Converts the ADD to a (sparse) matrix.
ValueType getMin() const
Retrieves the lowest function value of any encoding.
Bdd< LibraryType > greater(Add< LibraryType, ValueType > const &other) const
Retrieves the function that maps all evaluations to one whose function value in the first ADD are gre...
Add< LibraryType, ValueType > maximum(Add< LibraryType, ValueType > const &other) const
Retrieves the function that maps all evaluations to the maximum of the function values of the two ADD...
ValueType getValue(std::map< storm::expressions::Variable, int_fast64_t > const &metaVariableToValueMap=std::map< storm::expressions::Variable, int_fast64_t >()) const
Retrieves the value of the function when all meta variables are assigned the values of the given mapp...
Add< LibraryType, storm::RationalNumber > sharpenKwekMehlhorn(uint64_t precision) const
Retrieves the function that sharpens all values in the current ADD with the Kwek-Mehlhorn algorithm.
Add< LibraryType, ValueType > renameVariables(std::set< storm::expressions::Variable > const &from, std::set< storm::expressions::Variable > const &to) const
Renames the given meta variables in the ADD.
Add< LibraryType, ValueType > maxAbstract(std::set< storm::expressions::Variable > const &metaVariables) const
Max-abstracts from the given meta variables.
std::pair< storm::storage::SparseMatrix< ValueType >, std::vector< ValueType > > toMatrixVector(storm::dd::Add< LibraryType, ValueType > const &vector, std::set< storm::expressions::Variable > const &groupMetaVariables, storm::dd::Odd const &rowOdd, storm::dd::Odd const &columnOdd) const
Converts the ADD to a row-grouped (sparse) matrix and the given vector to a row-grouped vector.
static Add< LibraryType, ValueType > fromVector(DdManager< LibraryType > const &ddManager, std::vector< ValueType > const &values, Odd const &odd, std::set< storm::expressions::Variable > const &metaVariables)
Builds an ADD representing the given vector.
Add< LibraryType, ValueType > operator-(Add< LibraryType, ValueType > const &other) const
Subtracts the given ADD from the current one.
AddIterator< LibraryType, ValueType > begin(bool enumerateDontCareMetaVariables=true) const
Retrieves an iterator that points to the first meta variable assignment with a non-zero function valu...
InternalDdManager< LibraryType > const & getInternalDdManager() const
Retrieves the internal ADD.
virtual uint_fast64_t getNonZeroCount() const override
Retrieves the number of encodings that are mapped to a non-zero value.
Add< LibraryType, ValueType > sumAbstract(std::set< storm::expressions::Variable > const &metaVariables) const
Sum-abstracts from the given meta variables.
std::enable_if_t< std::is_same_v< TargetValueType, ValueType >, Add< LibraryType, TargetValueType > > toValueType() const
Replaces the leaves in this MTBDD, converting them to double if possible, and -1.0 else.
virtual uint_fast64_t getNodeCount() const override
Retrieves the number of nodes necessary to represent the DD.
Bdd< LibraryType > getSupport() const override
Retrieves the support of the current ADD.
Bdd< LibraryType > minAbstractRepresentative(std::set< storm::expressions::Variable > const &metaVariables) const
Similar to minAbstract, but does not abstract from the variables but rather picks a valuation of each...
Bdd< LibraryType > greaterOrEqual(Add< LibraryType, ValueType > const &other) const
Retrieves the function that maps all evaluations to one whose function value in the first ADD are gre...
Add< LibraryType, ValueType > minAbstract(std::set< storm::expressions::Variable > const &metaVariables) const
Min-abstracts from the given meta variables.
Odd createOdd() const
Creates an ODD based on the current ADD.
AddIterator< LibraryType, ValueType > end() const
Retrieves an iterator that points past the end of the container.
virtual uint_fast64_t getIndex() const override
Retrieves the index of the topmost variable in the DD.
bool isZero() const
Retrieves whether this ADD represents the constant zero function.
Add< LibraryType, ValueType > multiplyMatrix(Add< LibraryType, ValueType > const &otherMatrix, std::set< storm::expressions::Variable > const &summationMetaVariables) const
Multiplies the current ADD (representing a matrix) with the given matrix by summing over the given me...
Add< LibraryType, ValueType > & operator-=(Add< LibraryType, ValueType > const &other)
Subtracts the given ADD from the current one and assigns the result to the current ADD.
Add< LibraryType, ValueType > mod(Add< LibraryType, ValueType > const &other) const
Retrieves the function that represents the current ADD modulo the given ADD.
Add< LibraryType, ValueType > & operator*=(Add< LibraryType, ValueType > const &other)
Multiplies the given ADD with the current one and assigns the result to the current ADD.
Add< LibraryType, ValueType > operator/(Add< LibraryType, ValueType > const &other) const
Divides the current ADD by the given one.
virtual uint_fast64_t getLeafCount() const override
Retrieves the number of leaves of the ADD.
bool isConstant() const
Retrieves whether this ADD represents a constant function.
Bdd< LibraryType > toBdd() const
Converts the ADD to a BDD by mapping all values unequal to zero to 1.
Add< LibraryType, ValueType > constrain(Add< LibraryType, ValueType > const &constraint) const
Computes the constraint of the current ADD with the given constraint.
bool equalModuloPrecision(Add< LibraryType, ValueType > const &other, ValueType const &precision, bool relative=true) const
Checks whether the current and the given ADD represent the same function modulo some given precision.
Bdd< LibraryType > notEquals(Add< LibraryType, ValueType > const &other) const
Retrieves the function that maps all evaluations to one that have distinct function values.
virtual void exportToText(std::string const &filename) const override
Exports the DD to the given file in the dot format.
void setValue(storm::expressions::Variable const &metaVariable, int_fast64_t variableValue, ValueType const &targetValue)
Sets the function values of all encodings that have the given value of the meta variable to the given...
Bdd< LibraryType > notZero() const
Computes a BDD that represents the function in which all assignments with a function value unequal to...
Add< LibraryType, ValueType > ceil() const
Retrieves the function that ceils all values in the current ADD.
Add< LibraryType, ValueType > & operator/=(Add< LibraryType, ValueType > const &other)
Divides the current ADD by the given one and assigns the result to the current ADD.
Bdd< LibraryType > maxAbstractRepresentative(std::set< storm::expressions::Variable > const &metaVariables) const
Similar to maxAbstract, but does not abstract from the variables but rather picks a valuation of each...
bool operator!=(Add< LibraryType, ValueType > const &other) const
Retrieves whether the two DDs represent different functions.
std::vector< ValueType > toVector() const
Converts the ADD to a vector.
Add< LibraryType, ValueType > renameVariablesAbstract(std::set< storm::expressions::Variable > const &from, std::set< storm::expressions::Variable > const &to) const
Renames the given meta variables in the ADD.
Add< LibraryType, ValueType > permuteVariables(std::vector< std::pair< storm::expressions::Variable, storm::expressions::Variable > > const &metaVariablePairs) const
Permutes the given pairs of meta variables in the ADD.
Bdd< LibraryType > less(Add< LibraryType, ValueType > const &other) const
Retrieves the function that maps all evaluations to one whose function value in the first ADD are les...
Bdd< LibraryType > existsAbstract(std::set< storm::expressions::Variable > const &metaVariables) const
Existentially abstracts from the given meta variables.
storm::storage::BitVector toVector(storm::dd::Odd const &rowOdd) const
Converts the BDD to a bit vector.
static Bdd< LibraryType > getCube(DdManager< LibraryType > const &manager, std::set< storm::expressions::Variable > const &metaVariables)
Retrieves the cube of all given meta variables.
Bdd< LibraryType > ite(Bdd< LibraryType > const &thenBdd, Bdd< LibraryType > const &elseBdd) const
Performs an if-then-else with the given operands, i.e.
InternalBdd< LibraryType > const & getInternalBdd() const
Retrieves the internal BDD.
void addMetaVariable(storm::expressions::Variable const &metaVariable)
Adds the given meta variable to the set of meta variables that are contained in this DD.
static std::set< storm::expressions::Variable > joinMetaVariables(storm::dd::Dd< LibraryType > const &first, storm::dd::Dd< LibraryType > const &second)
Retrieves the set of meta variables contained in both DDs.
void addMetaVariables(std::set< storm::expressions::Variable > const &metaVariables)
Adds the given set of meta variables to the DD.
bool containsMetaVariable(storm::expressions::Variable const &metaVariable) const
Retrieves whether the given meta variable is contained in the DD.
std::vector< uint_fast64_t > getSortedVariableIndices() const
Retrieves the (sorted) list of the variable indices of DD variables contained in this DD.
static std::set< storm::expressions::Variable > subtractMetaVariables(storm::dd::Dd< LibraryType > const &first, storm::dd::Dd< LibraryType > const &second)
Retrieves the set of meta variables that are contained in the first but not the second DD.
std::set< storm::expressions::Variable > const & getContainedMetaVariables() const
Retrieves the set of all meta variables contained in the DD.
DdManager< LibraryType > & getDdManager() const
Retrieves the manager that is responsible for this DD.
uint_fast64_t getTotalOffset() const
Retrieves the total offset, i.e., the sum of the then- and else-offset.
A class that holds a possibly non-square matrix in the compressed row storage format.
#define STORM_LOG_ASSERT(cond, message)
#define STORM_LOG_THROW(cond, exception, message)
constexpr bool SupportsSharpening
Whether the Kwek-Mehlhorn sharpening is available: the backend has to support rational numbers and th...
std::ostream & operator<<(std::ostream &out, Add< LibraryType, ValueType > const &add)
The contract of a DD backend.
Converts the ADD to a row-grouped (sparse) matrix.