diff --git a/src/storm/models/sparse/ItemLabeling.cpp b/src/storm/models/sparse/ItemLabeling.cpp index b310b40e3..3cd32700b 100644 --- a/src/storm/models/sparse/ItemLabeling.cpp +++ b/src/storm/models/sparse/ItemLabeling.cpp @@ -93,6 +93,17 @@ namespace storm { return result; } + + void ItemLabeling::permuteItems(std::vector const& inversePermutation) { + STORM_LOG_THROW(inversePermutation.size() == itemCount, storm::exceptions::InvalidArgumentException, "Permutation does not match number of items"); + std::vector newLabelings; + for (storm::storage::BitVector const& source : this->labelings) { + newLabelings.push_back(source.permute(inversePermutation)); + } + + this->labelings = newLabelings; + } + void ItemLabeling::addLabel(std::string const& label, storage::BitVector const& labeling) { STORM_LOG_THROW(!this->containsLabel(label), storm::exceptions::InvalidArgumentException, "Label '" << label << "' already exists."); STORM_LOG_THROW(labeling.size() == itemCount, storm::exceptions::InvalidArgumentException, "Labeling vector has invalid size. Expected: " << itemCount << " Actual: " << labeling.size()); diff --git a/src/storm/models/sparse/ItemLabeling.h b/src/storm/models/sparse/ItemLabeling.h index 04d9950d2..0f774b792 100644 --- a/src/storm/models/sparse/ItemLabeling.h +++ b/src/storm/models/sparse/ItemLabeling.h @@ -113,8 +113,8 @@ namespace storm { */ std::size_t getNumberOfItems() const; - + void permuteItems(std::vector const& inversePermutation); /*! * Prints information about the labeling to the specified stream. *