Storm 1.14.0.1
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
QuotientData.cpp
Go to the documentation of this file.
2
3#include <algorithm>
4#include <limits>
5
9
10namespace storm::bisimulation {
11
12template<typename ValueType>
15 uint64_t constexpr Undef = std::numeric_limits<uint64_t>::max();
16 toQuotientState.assign(partition.getNumberOfElements(), Undef);
17 toRepresentativeState.reserve(partition.getNumberOfBlocks());
18 // Number the quotient states in the order of the smallest state of their block, so that the quotient resembles the order of the original states.
19 for (uint64_t state = 0; state < partition.getNumberOfElements(); ++state) {
20 if (toQuotientState[state] != Undef) {
21 continue;
22 }
23 auto const block = partition.getBlockOfElement(state);
24 uint64_t const quotientState = toRepresentativeState.size();
25 for (auto const s : block) {
26 toQuotientState[s] = quotientState;
27 }
28 // Unless a preferred representative is available, the first state of the block is the representative. Approximative signature-based refinement
29 // relies on this: that state is the anchor that all other states of the block were compared with, cf. Signatures::extendQuotientData.
30 uint64_t representativeState = block.front();
31 if (preferredRepresentatives) {
32 if (auto const it =
33 std::find_if(block.begin(), block.end(), [&preferredRepresentatives](auto const s) { return preferredRepresentatives->get(s); });
34 it != block.end()) {
35 representativeState = *it;
36 }
37 }
38 toRepresentativeState.push_back(representativeState);
39 }
40}
41
42template struct QuotientData<double>;
45template struct QuotientData<storm::Interval>;
47
48} // namespace storm::bisimulation
Helper class that optionally holds a reference to an object of type T.
Definition OptionalRef.h:48
Represents a partition of a set of consecutive indices.
Definition Partition.h:20
std::size_t getNumberOfBlocks() const
Retrieves the number of blocks.
Definition Partition.cpp:61
std::size_t getNumberOfElements() const
Retrieves the number of elements.
Definition Partition.cpp:66
Block getBlockOfElement(ElementIndex element) const
Definition Partition.cpp:74
The index mappings between an input model and its bisimulation quotient, derived from a partition of ...
std::vector< uint64_t > toRepresentativeState
std::vector< uint64_t > toQuotientState
QuotientData(storm::bisimulation::Partition const &partition, storm::OptionalRef< storm::storage::BitVector const > preferredRepresentatives=storm::NullRef)
Computes the state index mappings between the states (i.e., the elements of the given partition) and ...