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>
145 STORM_LOG_THROW(
false, storm::exceptions::NotSupportedException,
"Operation not supported.");
151 this->getContainedMetaVariables());
157 this->getContainedMetaVariables());
160template<DdType LibraryType,
typename ValueType>
165template<DdType LibraryType,
typename ValueType>
170template<DdType LibraryType,
typename ValueType>
177template<DdType LibraryType,
typename ValueType>
184template<DdType LibraryType,
typename ValueType>
190template<DdType LibraryType,
typename ValueType>
197template<DdType LibraryType,
typename ValueType>
203template<DdType LibraryType,
typename ValueType>
205 return internalAdd.equalModuloPrecision(other, precision, relative);
208template<DdType LibraryType,
typename ValueType>
210 std::set<storm::expressions::Variable>
const& to)
const {
211 std::vector<InternalBdd<LibraryType>> fromBdds;
212 std::vector<InternalBdd<LibraryType>> toBdds;
214 for (
auto const& metaVariable : from) {
216 "Cannot rename variable '" << metaVariable.getName() <<
"' that is not present.");
218 for (
auto const& ddVariable : ddMetaVariable.getDdVariables()) {
219 fromBdds.push_back(ddVariable.getInternalBdd());
222 for (
auto const& metaVariable : to) {
223 STORM_LOG_THROW(!this->containsMetaVariable(metaVariable), storm::exceptions::InvalidOperationException,
224 "Cannot rename to variable '" << metaVariable.getName() <<
"' that is already present.");
226 for (
auto const& ddVariable : ddMetaVariable.getDdVariables()) {
227 toBdds.push_back(ddVariable.getInternalBdd());
231 std::set<storm::expressions::Variable> newContainedMetaVariables = to;
232 std::set_difference(this->getContainedMetaVariables().begin(), this->getContainedMetaVariables().end(), from.begin(), from.end(),
233 std::inserter(newContainedMetaVariables, newContainedMetaVariables.begin()));
235 STORM_LOG_THROW(fromBdds.size() == toBdds.size(), storm::exceptions::InvalidArgumentException,
"Unable to rename mismatching meta variables.");
239template<DdType LibraryType,
typename ValueType>
241 std::set<storm::expressions::Variable>
const& to)
const {
242 std::vector<InternalBdd<LibraryType>> fromBdds;
243 std::vector<InternalBdd<LibraryType>> toBdds;
245 for (
auto const& metaVariable : from) {
247 "Cannot rename variable '" << metaVariable.getName() <<
"' that is not present.");
249 for (
auto const& ddVariable : ddMetaVariable.getDdVariables()) {
250 fromBdds.push_back(ddVariable.getInternalBdd());
253 std::sort(fromBdds.begin(), fromBdds.end(),
254 [](InternalBdd<LibraryType>
const& a, InternalBdd<LibraryType>
const& b) { return a.getLevel() < b.getLevel(); });
255 for (
auto const& metaVariable : to) {
256 STORM_LOG_THROW(!this->containsMetaVariable(metaVariable), storm::exceptions::InvalidOperationException,
257 "Cannot rename to variable '" << metaVariable.getName() <<
"' that is already present.");
259 for (
auto const& ddVariable : ddMetaVariable.getDdVariables()) {
260 toBdds.push_back(ddVariable.getInternalBdd());
263 std::sort(toBdds.begin(), toBdds.end(), [](InternalBdd<LibraryType>
const& a, InternalBdd<LibraryType>
const& b) { return a.getLevel() < b.getLevel(); });
265 std::set<storm::expressions::Variable> newContainedMetaVariables = to;
267 std::inserter(newContainedMetaVariables, newContainedMetaVariables.begin()));
269 STORM_LOG_ASSERT(fromBdds.size() >= toBdds.size(),
"Unable to perform rename-abstract with mismatching sizes.");
271 if (fromBdds.size() == toBdds.size()) {
275 for (uint64_t index = toBdds.size(); index < fromBdds.size(); ++index) {
276 cube &= fromBdds[index];
278 fromBdds.resize(toBdds.size());
280 return Add<LibraryType, ValueType>(this->getDdManager(), internalAdd.sumAbstract(cube).permuteVariables(fromBdds, toBdds), newContainedMetaVariables);
284template<DdType LibraryType,
typename ValueType>
286 std::vector<std::pair<storm::expressions::Variable, storm::expressions::Variable>>
const& metaVariablePairs)
const {
287 std::set<storm::expressions::Variable> newContainedMetaVariables;
288 std::set<storm::expressions::Variable> deletedMetaVariables;
289 std::vector<InternalBdd<LibraryType>> from;
290 std::vector<InternalBdd<LibraryType>> to;
291 for (
auto const& metaVariablePair : metaVariablePairs) {
300 newContainedMetaVariables.insert(metaVariablePair.second);
301 deletedMetaVariables.insert(metaVariablePair.first);
304 if (!this->containsMetaVariable(metaVariablePair.second)) {
307 newContainedMetaVariables.insert(metaVariablePair.first);
308 deletedMetaVariables.insert(metaVariablePair.second);
311 for (
auto const& ddVariable : variable1.getDdVariables()) {
312 from.push_back(ddVariable.getInternalBdd());
314 for (
auto const& ddVariable : variable2.getDdVariables()) {
315 to.push_back(ddVariable.getInternalBdd());
319 std::set<storm::expressions::Variable> tmp;
321 deletedMetaVariables.end(), std::inserter(tmp, tmp.begin()));
322 std::set<storm::expressions::Variable> containedMetaVariables;
323 std::set_union(tmp.begin(), tmp.end(), newContainedMetaVariables.begin(), newContainedMetaVariables.end(),
324 std::inserter(containedMetaVariables, containedMetaVariables.begin()));
325 STORM_LOG_THROW(from.size() == to.size(), storm::exceptions::InvalidArgumentException,
"Unable to swap mismatching meta variables.");
329template<DdType LibraryType,
typename ValueType>
331 std::vector<std::pair<storm::expressions::Variable, storm::expressions::Variable>>
const& metaVariablePairs)
const {
332 std::set<storm::expressions::Variable> newContainedMetaVariables;
333 std::set<storm::expressions::Variable> deletedMetaVariables;
334 std::vector<InternalBdd<LibraryType>> from;
335 std::vector<InternalBdd<LibraryType>> to;
336 for (
auto const& metaVariablePair : metaVariablePairs) {
342 deletedMetaVariables.insert(metaVariablePair.first);
343 newContainedMetaVariables.insert(metaVariablePair.second);
346 for (
auto const& ddVariable : variable1.getDdVariables()) {
347 from.push_back(ddVariable.getInternalBdd());
349 for (
auto const& ddVariable : variable2.getDdVariables()) {
350 to.push_back(ddVariable.getInternalBdd());
354 std::set<storm::expressions::Variable> tmp;
355 std::set_difference(this->getContainedMetaVariables().begin(), this->getContainedMetaVariables().end(), deletedMetaVariables.begin(),
356 deletedMetaVariables.end(), std::inserter(tmp, tmp.begin()));
357 std::set<storm::expressions::Variable> containedMetaVariables;
358 std::set_union(tmp.begin(), tmp.end(), newContainedMetaVariables.begin(), newContainedMetaVariables.end(),
359 std::inserter(containedMetaVariables, containedMetaVariables.begin()));
360 STORM_LOG_THROW(from.size() == to.size(), storm::exceptions::InvalidArgumentException,
"Unable to swap mismatching meta variables.");
364template<DdType LibraryType,
typename ValueType>
366 std::set<storm::expressions::Variable>
const& summationMetaVariables)
const {
368 std::vector<InternalBdd<LibraryType>> summationDdVariables;
369 for (
auto const& metaVariable : summationMetaVariables) {
370 for (
auto const& ddVariable : this->
getDdManager().getMetaVariable(metaVariable).getDdVariables()) {
371 summationDdVariables.push_back(ddVariable.getInternalBdd());
376 std::set<storm::expressions::Variable> containedMetaVariables;
377 std::set_difference(unionOfMetaVariables.begin(), unionOfMetaVariables.end(), summationMetaVariables.begin(), summationMetaVariables.end(),
378 std::inserter(containedMetaVariables, containedMetaVariables.begin()));
380 return Add<LibraryType, ValueType>(this->getDdManager(), internalAdd.multiplyMatrix(otherMatrix, summationDdVariables), containedMetaVariables);
383template<DdType LibraryType,
typename ValueType>
385 std::set<storm::expressions::Variable>
const& summationMetaVariables)
const {
387 std::vector<InternalBdd<LibraryType>> summationDdVariables;
388 for (
auto const& metaVariable : summationMetaVariables) {
389 for (
auto const& ddVariable : this->
getDdManager().getMetaVariable(metaVariable).getDdVariables()) {
390 summationDdVariables.push_back(ddVariable.getInternalBdd());
395 std::set<storm::expressions::Variable> containedMetaVariables;
396 std::set_difference(unionOfMetaVariables.begin(), unionOfMetaVariables.end(), summationMetaVariables.begin(), summationMetaVariables.end(),
397 std::inserter(containedMetaVariables, containedMetaVariables.begin()));
400 containedMetaVariables);
403template<DdType LibraryType,
typename ValueType>
408template<DdType LibraryType,
typename ValueType>
413template<DdType LibraryType,
typename ValueType>
418template<DdType LibraryType,
typename ValueType>
423template<DdType LibraryType,
typename ValueType>
428template<DdType LibraryType,
typename ValueType>
433template<DdType LibraryType,
typename ValueType>
438template<DdType LibraryType,
typename ValueType>
443template<DdType LibraryType,
typename ValueType>
445 std::size_t numberOfDdVariables = 0;
447 numberOfDdVariables += this->
getDdManager().getMetaVariable(metaVariable).getNumberOfDdVariables();
449 return internalAdd.getNonZeroCount(numberOfDdVariables);
452template<DdType LibraryType,
typename ValueType>
454 return internalAdd.getLeafCount();
457template<DdType LibraryType,
typename ValueType>
459 return internalAdd.getNodeCount();
462template<DdType LibraryType,
typename ValueType>
464 return internalAdd.getMin();
467template<DdType LibraryType,
typename ValueType>
469 return internalAdd.getMax();
472template<DdType LibraryType,
typename ValueType>
474 std::map<storm::expressions::Variable, int_fast64_t> metaVariableToValueMap;
475 metaVariableToValueMap.emplace(metaVariable, variableValue);
476 this->
setValue(metaVariableToValueMap, targetValue);
479template<DdType LibraryType,
typename ValueType>
482 std::map<storm::expressions::Variable, int_fast64_t> metaVariableToValueMap;
483 metaVariableToValueMap.emplace(metaVariable1, variableValue1);
484 metaVariableToValueMap.emplace(metaVariable2, variableValue2);
485 this->
setValue(metaVariableToValueMap, targetValue);
488template<DdType LibraryType,
typename ValueType>
491 for (
auto const& nameValuePair : metaVariableToValueMap) {
492 valueEncoding &= this->
getDdManager().getEncoding(nameValuePair.first, nameValuePair.second);
497 internalAdd = valueEncoding.
ite(this->getDdManager().getConstant(targetValue), *
this);
500template<DdType LibraryType,
typename ValueType>
504 for (
auto const& nameValuePair : metaVariableToValueMap) {
505 valueEncoding &= this->
getDdManager().getEncoding(nameValuePair.first, nameValuePair.second);
507 remainingMetaVariables.erase(nameValuePair.first);
511 STORM_LOG_THROW(remainingMetaVariables.empty(), storm::exceptions::InvalidArgumentException,
512 "Cannot evaluate function for which not all inputs were given.");
516 return value.internalAdd.getValue();
519template<DdType LibraryType,
typename ValueType>
521 return internalAdd.isOne();
524template<DdType LibraryType,
typename ValueType>
526 return internalAdd.isZero();
529template<DdType LibraryType,
typename ValueType>
531 return internalAdd.isConstant();
534template<DdType LibraryType,
typename ValueType>
536 return internalAdd.getIndex();
539template<DdType LibraryType,
typename ValueType>
541 return internalAdd.getLevel();
544template<DdType LibraryType,
typename ValueType>
549template<DdType LibraryType,
typename ValueType>
553 internalAdd.composeWithExplicitVector(rowOdd, ddVariableIndices, result, std::plus<ValueType>());
557template<DdType LibraryType,
typename ValueType>
559 std::vector<uint_fast64_t>
const& rowGroupIndices,
560 std::set<storm::expressions::Variable>
const& rowMetaVariables,
561 std::set<storm::expressions::Variable>
const& columnMetaVariables,
562 std::set<storm::expressions::Variable>
const& groupMetaVariables,
564 std::vector<uint_fast64_t> ddRowVariableIndices;
565 std::vector<uint_fast64_t> ddColumnVariableIndices;
566 std::vector<uint_fast64_t> ddGroupVariableIndices;
567 std::set<storm::expressions::Variable> rowAndColumnMetaVariables;
569 for (
auto const& variable : rowMetaVariables) {
571 for (
auto const& ddVariable : metaVariable.getDdVariables()) {
572 ddRowVariableIndices.push_back(ddVariable.getIndex());
574 rowAndColumnMetaVariables.insert(variable);
576 std::sort(ddRowVariableIndices.begin(), ddRowVariableIndices.end());
577 for (
auto const& variable : columnMetaVariables) {
578 DdMetaVariable<LibraryType>
const& metaVariable = this->getDdManager().getMetaVariable(variable);
579 for (
auto const& ddVariable : metaVariable.getDdVariables()) {
580 ddColumnVariableIndices.push_back(ddVariable.getIndex());
582 rowAndColumnMetaVariables.insert(variable);
584 std::sort(ddColumnVariableIndices.begin(), ddColumnVariableIndices.end());
585 for (
auto const& variable : groupMetaVariables) {
586 DdMetaVariable<LibraryType>
const& metaVariable = this->getDdManager().getMetaVariable(variable);
587 for (
auto const& ddVariable : metaVariable.getDdVariables()) {
588 ddGroupVariableIndices.push_back(ddVariable.getIndex());
591 std::sort(ddGroupVariableIndices.begin(), ddGroupVariableIndices.end());
593 Bdd<LibraryType> columnVariableCube = Bdd<LibraryType>::getCube(this->getDdManager(), columnMetaVariables);
596 std::vector<uint_fast64_t> mutableRowGroupIndices = rowGroupIndices;
599 std::vector<ValueType> explicitVector(mutableRowGroupIndices.back());
602 std::vector<std::pair<InternalAdd<LibraryType, ValueType>, InternalAdd<LibraryType, ValueType>>> internalAddGroups =
603 matrix.internalAdd.splitIntoGroups(*
this, ddGroupVariableIndices);
604 std::vector<std::pair<Add<LibraryType, ValueType>, Add<LibraryType, ValueType>>> groups;
605 for (
auto const& internalAdd : internalAddGroups) {
606 groups.push_back(std::make_pair(Add<LibraryType, ValueType>(this->getDdManager(), internalAdd.first, rowAndColumnMetaVariables),
607 Add<LibraryType, ValueType>(this->getDdManager(), internalAdd.second, rowMetaVariables)));
610 std::vector<InternalAdd<LibraryType, uint_fast64_t>> statesWithGroupEnabled(groups.size());
611 for (uint_fast64_t i = 0; i < groups.size(); ++i) {
616 ddPair.second.internalAdd.composeWithExplicitVector(rowOdd, ddRowVariableIndices, mutableRowGroupIndices, explicitVector, std::plus<ValueType>());
619 (matrixDdNotZero.
existsAbstract(columnMetaVariables) || vectorDdNotZero).template toAdd<uint_fast64_t>();
620 statesWithGroupEnabled.composeWithExplicitVector(rowOdd, ddRowVariableIndices, mutableRowGroupIndices, std::plus<uint_fast64_t>());
623 return explicitVector;
626template<DdType LibraryType,
typename ValueType>
628 std::set<storm::expressions::Variable> rowVariables;
629 std::set<storm::expressions::Variable> columnVariables;
632 if (variable.getName().size() > 0 && variable.getName().back() ==
'\'') {
633 columnVariables.insert(variable);
635 rowVariables.insert(variable);
642template<DdType LibraryType,
typename ValueType>
644 std::set<storm::expressions::Variable> rowMetaVariables;
645 std::set<storm::expressions::Variable> columnMetaVariables;
648 if (variable.getName().size() > 0 && variable.getName().back() ==
'\'') {
649 columnMetaVariables.insert(variable);
651 rowMetaVariables.insert(variable);
655 return toMatrix(rowMetaVariables, columnMetaVariables, rowOdd, columnOdd);
658template<DdType LibraryType,
typename ValueType>
660 std::set<storm::expressions::Variable>
const& columnMetaVariables,
662 std::vector<uint_fast64_t> ddRowVariableIndices;
663 std::vector<uint_fast64_t> ddColumnVariableIndices;
665 for (
auto const& variable : rowMetaVariables) {
667 for (
auto const& ddVariable : metaVariable.getDdVariables()) {
668 ddRowVariableIndices.push_back(ddVariable.getIndex());
671 std::sort(ddRowVariableIndices.begin(), ddRowVariableIndices.end());
673 for (
auto const& variable : columnMetaVariables) {
675 for (
auto const& ddVariable : metaVariable.getDdVariables()) {
676 ddColumnVariableIndices.push_back(ddVariable.getIndex());
679 std::sort(ddColumnVariableIndices.begin(), ddColumnVariableIndices.end());
682 std::vector<uint_fast64_t> rowIndications(rowOdd.
getTotalOffset() + 1);
683 std::vector<storm::storage::MatrixEntry<uint_fast64_t, ValueType>> columnsAndValues(this->
getNonZeroCount());
686 std::vector<uint_fast64_t> trivialRowGroupIndices(rowIndications.size());
688 for (
auto& entry : trivialRowGroupIndices) {
694 rowIndications = this->notZero().template toAdd<uint_fast64_t>().sumAbstract(columnMetaVariables).toVector(rowOdd);
695 rowIndications.emplace_back();
698 uint_fast64_t tmp = 0;
699 uint_fast64_t tmp2 = 0;
700 for (uint_fast64_t i = 1; i < rowIndications.size(); ++i) {
701 tmp2 = rowIndications[i];
702 rowIndications[i] = rowIndications[i - 1] + tmp;
703 std::swap(tmp, tmp2);
705 rowIndications[0] = 0;
708 internalAdd.toMatrixComponents(trivialRowGroupIndices, rowIndications, columnsAndValues, rowOdd, columnOdd, ddRowVariableIndices, ddColumnVariableIndices,
712 for (uint_fast64_t i = rowIndications.size() - 1; i > 0; --i) {
713 rowIndications[i] = rowIndications[i - 1];
715 rowIndications[0] = 0;
721template<DdType LibraryType,
typename ValueType>
724 std::set<storm::expressions::Variable> rowMetaVariables;
725 std::set<storm::expressions::Variable> columnMetaVariables;
729 if (groupMetaVariables.contains(variable)) {
733 if (variable.getName().size() > 0 && variable.getName().back() ==
'\'') {
734 columnMetaVariables.insert(variable);
736 rowMetaVariables.insert(variable);
741 return toLabeledMatrix(rowMetaVariables, columnMetaVariables, groupMetaVariables, rowOdd, columnOdd).matrix;
744template<DdType LibraryType,
typename ValueType>
746 std::set<storm::expressions::Variable>
const& rowMetaVariables, std::set<storm::expressions::Variable>
const& columnMetaVariables,
748 std::vector<std::set<storm::expressions::Variable>>
const& labelMetaVariables)
const {
749 std::vector<uint_fast64_t> ddRowVariableIndices;
750 std::vector<uint_fast64_t> ddColumnVariableIndices;
751 std::vector<uint_fast64_t> ddGroupVariableIndices;
752 std::vector<storm::storage::BitVector> ddLabelVariableIndicesVector;
753 std::set<storm::expressions::Variable> rowAndColumnMetaVariables;
754 bool buildLabeling = !labelMetaVariables.empty();
755 MatrixAndLabeling result;
757 for (
auto const& variable : rowMetaVariables) {
759 for (
auto const& ddVariable : metaVariable.getDdVariables()) {
760 ddRowVariableIndices.push_back(ddVariable.getIndex());
762 rowAndColumnMetaVariables.insert(variable);
764 std::sort(ddRowVariableIndices.begin(), ddRowVariableIndices.end());
765 for (
auto const& variable : columnMetaVariables) {
767 for (
auto const& ddVariable : metaVariable.getDdVariables()) {
768 ddColumnVariableIndices.push_back(ddVariable.getIndex());
770 rowAndColumnMetaVariables.insert(variable);
772 std::sort(ddColumnVariableIndices.begin(), ddColumnVariableIndices.end());
773 for (
auto const& variable : groupMetaVariables) {
775 for (
auto const& ddVariable : metaVariable.getDdVariables()) {
776 ddGroupVariableIndices.push_back(ddVariable.getIndex());
779 std::sort(ddGroupVariableIndices.begin(), ddGroupVariableIndices.end());
781 for (
auto const& labelMetaVariableSet : labelMetaVariables) {
782 std::set<uint64_t> ddLabelVariableIndicesSet;
783 for (
auto const& variable : labelMetaVariableSet) {
785 for (
auto const& ddVariable : metaVariable.getDdVariables()) {
786 ddLabelVariableIndicesSet.insert(ddVariable.getIndex());
790 ddLabelVariableIndicesVector.emplace_back(ddGroupVariableIndices.size());
791 uint64_t position = 0;
792 for (
auto const& index : ddGroupVariableIndices) {
793 if (ddLabelVariableIndicesSet.contains(index)) {
794 ddLabelVariableIndicesVector.back().set(position);
801 Bdd<LibraryType> columnVariableCube = Bdd<LibraryType>::getCube(this->getDdManager(), columnMetaVariables);
804 Add<LibraryType, uint_fast64_t> stateToNumberOfChoices =
805 this->notZero().existsAbstract(columnMetaVariables).template toAdd<uint_fast64_t>().sumAbstract(groupMetaVariables);
806 std::vector<uint_fast64_t> rowGroupIndices = stateToNumberOfChoices.toVector(rowOdd);
807 rowGroupIndices.resize(rowGroupIndices.size() + 1);
808 uint_fast64_t tmp = 0;
809 uint_fast64_t tmp2 = 0;
810 for (uint_fast64_t i = 1;
i < rowGroupIndices.size(); ++
i) {
811 tmp2 = rowGroupIndices[
i];
812 rowGroupIndices[
i] = rowGroupIndices[
i - 1] + tmp;
813 std::swap(tmp, tmp2);
815 rowGroupIndices[0] = 0;
819 std::vector<InternalAdd<LibraryType, ValueType>> internalAddGroups = internalAdd.splitIntoGroups(ddGroupVariableIndices);
820 std::vector<Add<LibraryType, ValueType>> groups;
821 for (
auto const& internalAdd : internalAddGroups) {
822 groups.push_back(Add<LibraryType, ValueType>(this->getDdManager(), internalAdd, rowAndColumnMetaVariables));
826 std::vector<std::vector<uint64_t>> groupLabelings;
828 for (
auto const& ddLabelVariableIndices : ddLabelVariableIndicesVector) {
829 groupLabelings.emplace_back(internalAdd.decodeGroupLabels(ddGroupVariableIndices, ddLabelVariableIndices));
830 STORM_LOG_ASSERT(groupLabelings.back().size() == groups.size(),
"Mismatching label sizes.");
835 std::vector<storm::storage::MatrixEntry<uint_fast64_t, ValueType>> columnsAndValues(this->getNonZeroCount());
838 std::vector<uint_fast64_t> rowIndications(rowGroupIndices.back() + 1);
841 for (uint64_t i = 0;
i < labelMetaVariables.size(); ++
i) {
842 result.labelings.emplace_back(rowGroupIndices.back());
846 std::vector<InternalAdd<LibraryType, uint_fast64_t>> statesWithGroupEnabled(groups.size());
847 InternalAdd<LibraryType, uint_fast64_t> stateToRowGroupCount = this->getDdManager().template getAddZero<uint_fast64_t>();
848 for (uint_fast64_t i = 0;
i < groups.size(); ++
i) {
849 auto const& group = groups[
i];
850 auto groupNotZero = group.notZero();
852 std::vector<uint64_t> tmpRowIndications = groupNotZero.template toAdd<uint_fast64_t>().sumAbstract(columnMetaVariables).toVector(rowOdd);
853 for (uint64_t offset = 0; offset < tmpRowIndications.size(); ++offset) {
854 rowIndications[rowGroupIndices[offset]] += tmpRowIndications[offset];
857 statesWithGroupEnabled[
i] = groupNotZero.existsAbstract(columnMetaVariables).template toAdd<uint_fast64_t>();
859 for (uint64_t j = 0; j < labelMetaVariables.size(); ++j) {
860 uint64_t currentLabel = groupLabelings[j][
i];
861 statesWithGroupEnabled[
i].forEach(rowOdd, ddRowVariableIndices,
862 [currentLabel, &rowGroupIndices, &result, j](uint64_t
const& offset, uint_fast64_t
const& value) {
863 result.labelings[j][rowGroupIndices[offset]] = currentLabel;
867 statesWithGroupEnabled[
i].composeWithExplicitVector(rowOdd, ddRowVariableIndices, rowGroupIndices, std::plus<uint_fast64_t>());
871 stateToNumberOfChoices.internalAdd.composeWithExplicitVector(rowOdd, ddRowVariableIndices, rowGroupIndices, std::minus<uint_fast64_t>());
876 for (uint_fast64_t i = 1;
i < rowIndications.size(); ++
i) {
877 tmp2 = rowIndications[
i];
878 rowIndications[
i] = rowIndications[
i - 1] + tmp;
879 std::swap(tmp, tmp2);
881 rowIndications[0] = 0;
884 for (uint_fast64_t i = 0;
i < groups.size(); ++
i) {
885 auto const& group = groups[
i];
887 group.internalAdd.toMatrixComponents(rowGroupIndices, rowIndications, columnsAndValues, rowOdd, columnOdd, ddRowVariableIndices,
888 ddColumnVariableIndices,
true);
890 statesWithGroupEnabled[
i].composeWithExplicitVector(rowOdd, ddRowVariableIndices, rowGroupIndices, std::plus<uint_fast64_t>());
894 stateToNumberOfChoices.internalAdd.composeWithExplicitVector(rowOdd, ddRowVariableIndices, rowGroupIndices, std::minus<uint_fast64_t>());
897 for (uint_fast64_t i = rowIndications.size() - 1; i > 0; --i) {
898 rowIndications[
i] = rowIndications[
i - 1];
900 rowIndications[0] = 0;
908template<DdType LibraryType,
typename ValueType>
912 std::set<storm::expressions::Variable> rowMetaVariables;
913 std::set<storm::expressions::Variable> columnMetaVariables;
917 if (groupMetaVariables.contains(variable)) {
921 if (variable.getName().size() > 0 && variable.getName().back() ==
'\'') {
922 columnMetaVariables.insert(variable);
924 rowMetaVariables.insert(variable);
929 return toMatrixVector(vector, rowMetaVariables, columnMetaVariables, groupMetaVariables, rowOdd, columnOdd);
932template<DdType LibraryType,
typename ValueType>
935 std::set<storm::expressions::Variable>
const& columnMetaVariables, std::set<storm::expressions::Variable>
const& groupMetaVariables,
938 std::vector<uint_fast64_t> rowGroupIndices = (this->notZero().existsAbstract(columnMetaVariables) || vector.
notZero())
939 .
template toAdd<uint_fast64_t>()
940 .sumAbstract(groupMetaVariables)
942 return toMatrixVector(std::move(rowGroupIndices), vector, rowMetaVariables, columnMetaVariables, groupMetaVariables, rowOdd, columnOdd);
945template<DdType LibraryType,
typename ValueType>
948 std::set<storm::expressions::Variable>
const& rowMetaVariables, std::set<storm::expressions::Variable>
const& columnMetaVariables,
949 std::set<storm::expressions::Variable>
const& groupMetaVariables,
storm::dd::Odd const& rowOdd,
storm::dd::Odd const& columnOdd)
const {
950 auto resultAsVector =
toMatrixVectors(std::move(rowGroupIndices), {vector}, rowMetaVariables, columnMetaVariables, groupMetaVariables, rowOdd, columnOdd);
951 return std::make_pair(resultAsVector.first, resultAsVector.second.front());
954template<DdType LibraryType,
typename ValueType>
958 std::set<storm::expressions::Variable> rowMetaVariables;
959 std::set<storm::expressions::Variable> columnMetaVariables;
963 if (groupMetaVariables.contains(variable)) {
967 if (variable.getName().size() > 0 && variable.getName().back() ==
'\'') {
968 columnMetaVariables.insert(variable);
970 rowMetaVariables.insert(variable);
975 for (
auto const& v : vectors) {
976 vectorsNotZero |= v.notZero();
978 std::vector<uint_fast64_t> rowGroupIndices = (this->
notZero().existsAbstract(columnMetaVariables) || vectorsNotZero)
979 .
template toAdd<uint_fast64_t>()
980 .sumAbstract(groupMetaVariables)
982 return toMatrixVectors(std::move(rowGroupIndices), vectors, rowMetaVariables, columnMetaVariables, groupMetaVariables, rowOdd, columnOdd);
985template<DdType LibraryType,
typename ValueType>
988 std::set<storm::expressions::Variable>
const& rowMetaVariables, std::set<storm::expressions::Variable>
const& columnMetaVariables,
989 std::set<storm::expressions::Variable>
const& groupMetaVariables,
storm::dd::Odd const& rowOdd,
storm::dd::Odd const& columnOdd)
const {
990 std::vector<uint_fast64_t> ddRowVariableIndices;
991 std::vector<uint_fast64_t> ddColumnVariableIndices;
992 std::vector<uint_fast64_t> ddGroupVariableIndices;
993 std::set<storm::expressions::Variable> rowAndColumnMetaVariables;
995 for (
auto const& variable : rowMetaVariables) {
997 for (
auto const& ddVariable : metaVariable.getDdVariables()) {
998 ddRowVariableIndices.push_back(ddVariable.getIndex());
1000 rowAndColumnMetaVariables.insert(variable);
1002 std::sort(ddRowVariableIndices.begin(), ddRowVariableIndices.end());
1003 for (
auto const& variable : columnMetaVariables) {
1005 for (
auto const& ddVariable : metaVariable.getDdVariables()) {
1006 ddColumnVariableIndices.push_back(ddVariable.getIndex());
1008 rowAndColumnMetaVariables.insert(variable);
1010 std::sort(ddColumnVariableIndices.begin(), ddColumnVariableIndices.end());
1011 for (
auto const& variable : groupMetaVariables) {
1013 for (
auto const& ddVariable : metaVariable.getDdVariables()) {
1014 ddGroupVariableIndices.push_back(ddVariable.getIndex());
1017 std::sort(ddGroupVariableIndices.begin(), ddGroupVariableIndices.end());
1022 rowGroupIndices.resize(rowGroupIndices.size() + 1);
1023 uint_fast64_t tmp = 0;
1024 uint_fast64_t tmp2 = 0;
1025 for (uint_fast64_t i = 1; i < rowGroupIndices.size(); ++i) {
1026 tmp2 = rowGroupIndices[i];
1027 rowGroupIndices[i] = rowGroupIndices[i - 1] + tmp;
1028 std::swap(tmp, tmp2);
1030 rowGroupIndices[0] = 0;
1033 std::vector<std::vector<ValueType>> explicitVectors(vectors.size());
1034 for (
auto& v : explicitVectors) {
1035 v.resize(rowGroupIndices.back());
1039 std::vector<std::vector<Add<LibraryType, ValueType>>> groups;
1040 if (vectors.size() == 1) {
1043 internalAdd.splitIntoGroups(vectors.front(), ddGroupVariableIndices);
1044 for (
auto const& internalAdd : internalAddGroups) {
1049 std::vector<InternalAdd<LibraryType, ValueType>> internalVectors;
1051 internalVectors.push_back(v.getInternalAdd());
1053 std::vector<std::vector<InternalAdd<LibraryType, ValueType>>> internalAddGroups = internalAdd.splitIntoGroups(internalVectors, ddGroupVariableIndices);
1054 for (
auto const& internalAddGroup : internalAddGroups) {
1055 STORM_LOG_ASSERT(internalAddGroup.size() == vectors.size() + 1,
"Unexpected group size.");
1056 std::vector<Add<LibraryType, ValueType>> group;
1057 for (uint64_t vectorIndex = 0; vectorIndex < vectors.size(); ++vectorIndex) {
1062 groups.push_back(std::move(group));
1067 std::vector<storm::storage::MatrixEntry<uint_fast64_t, ValueType>> columnsAndValues(this->
getNonZeroCount());
1070 std::vector<uint_fast64_t> rowIndications(rowGroupIndices.back() + 1);
1072 std::vector<InternalAdd<LibraryType, uint_fast64_t>> statesWithGroupEnabled(groups.size());
1074 for (uint_fast64_t i = 0; i < groups.size(); ++i) {
1075 std::vector<Add<LibraryType, ValueType>>
const& group = groups[i];
1078 std::vector<uint64_t> tmpRowIndications = matrixDdNotZero.template toAdd<uint_fast64_t>().sumAbstract(columnMetaVariables).
toVector(rowOdd);
1079 for (uint64_t offset = 0; offset < tmpRowIndications.size(); ++offset) {
1080 rowIndications[rowGroupIndices[offset]] += tmpRowIndications[offset];
1084 for (uint64_t vectorIndex = 0; vectorIndex < vectors.size(); ++vectorIndex) {
1085 vectorDdNotZero |= group[vectorIndex].notZero();
1086 group[vectorIndex].internalAdd.composeWithExplicitVector(rowOdd, ddRowVariableIndices, rowGroupIndices, explicitVectors[vectorIndex],
1087 std::plus<ValueType>());
1090 statesWithGroupEnabled[i] = (matrixDdNotZero.
existsAbstract(columnMetaVariables) || vectorDdNotZero).template toAdd<uint_fast64_t>();
1091 stateToRowGroupCount += statesWithGroupEnabled[i];
1092 statesWithGroupEnabled[i].composeWithExplicitVector(rowOdd, ddRowVariableIndices, rowGroupIndices, std::plus<uint_fast64_t>());
1096 stateToRowGroupCount.composeWithExplicitVector(rowOdd, ddRowVariableIndices, rowGroupIndices, std::minus<uint_fast64_t>());
1101 for (uint_fast64_t i = 1; i < rowIndications.size(); ++i) {
1102 tmp2 = rowIndications[i];
1103 rowIndications[i] = rowIndications[i - 1] + tmp;
1104 std::swap(tmp, tmp2);
1106 rowIndications[0] = 0;
1109 for (uint_fast64_t i = 0; i < groups.size(); ++i) {
1110 auto const&
dd = groups[i].back();
1112 dd.internalAdd.toMatrixComponents(rowGroupIndices, rowIndications, columnsAndValues, rowOdd, columnOdd, ddRowVariableIndices, ddColumnVariableIndices,
1114 statesWithGroupEnabled[i].composeWithExplicitVector(rowOdd, ddRowVariableIndices, rowGroupIndices, std::plus<uint_fast64_t>());
1118 stateToRowGroupCount.composeWithExplicitVector(rowOdd, ddRowVariableIndices, rowGroupIndices, std::minus<uint_fast64_t>());
1121 for (uint_fast64_t i = rowIndications.size() - 1; i > 0; --i) {
1122 rowIndications[i] = rowIndications[i - 1];
1124 rowIndications[0] = 0;
1126 return std::make_pair(
1128 std::move(explicitVectors));
1131template<DdType LibraryType,
typename ValueType>
1133 internalAdd.exportToDot(filename, this->
getDdManager().getDdVariableNames(), showVariablesIfPossible);
1136template<DdType LibraryType,
typename ValueType>
1138 internalAdd.exportToText(filename);
1141template<DdType LibraryType,
typename ValueType>
1143 uint_fast64_t numberOfDdVariables = 0;
1145 auto const& ddMetaVariable = this->
getDdManager().getMetaVariable(metaVariable);
1153template<DdType LibraryType,
typename ValueType>
1158template<DdType LibraryType,
typename ValueType>
1162 std::vector<std::string> variableNames;
1164 variableNames.push_back(variable.getName());
1166 out <<
"contained variables: " << boost::algorithm::join(variableNames,
", ") <<
'\n';
1170template<DdType LibraryType,
typename ValueType>
1172 Odd const& odd, std::set<storm::expressions::Variable>
const& metaVariables) {
1175 ddManager.getSortedVariableIndices(metaVariables)),
1179template<DdType LibraryType,
typename ValueType>
1184template<DdType LibraryType,
typename ValueType>
1189template<DdType LibraryType,
typename ValueType>
1194template<DdType LibraryType,
typename ValueType>
1196 return internalAdd.getInternalDdManager();
1199template<DdType LibraryType,
typename ValueType>
1204template<DdType LibraryType,
typename ValueType>
1205template<
typename TargetValueType>
1210template<DdType LibraryType,
typename ValueType>
1211template<
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.
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.
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, 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
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.
AddIterator< LibraryType, ValueType > end() const
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)
std::ostream & operator<<(std::ostream &out, Add< LibraryType, ValueType > const &add)
Converts the ADD to a row-grouped (sparse) matrix.