20template<
typename ValueType>
25template<
typename ValueType>
26template<
typename RewardModelType>
32template<
typename ValueType>
35 std::vector<ValueType>
const& vector) {
36 performRobustMaximalEndComponentDecomposition(transitionMatrix, backwardTransitions, vector);
39template<
typename ValueType>
42 std::vector<ValueType>
const& vector,
44 performRobustMaximalEndComponentDecomposition(transitionMatrix, backwardTransitions, vector, states);
47template<
typename ValueType>
53template<
typename ValueType>
60template<
typename ValueType>
66template<
typename ValueType>
73template<
typename ValueType>
96 for (
auto state : remainingEcCandidates) {
98 nonTrivSccIndices.set(sccIndex,
true);
102 double probabilityToStayInScc = 0;
104 if (vector && vector->at(state).lower() == 0) {
106 for (
auto const& entry : transitionMatrix.getRow(state)) {
107 const bool targetInSCC = sccIndex == sccDecRes.
stateToSccMapping[entry.getColumn()];
108 auto const& interval = entry.getValue();
111 probabilityToStayInScc = 0;
113 }
else if (targetInSCC) {
114 probabilityToStayInScc += interval.upper();
120 if (probabilityToStayInScc < 1) {
122 remainingEcCandidates.
set(state,
false);
124 ecSccIndices.set(sccIndex,
false);
129 ecSccIndices &= nonTrivSccIndices;
131 for (
auto sccIndex : ecSccIndices) {
132 StronglyConnectedComponent newMec;
133 for (
auto state : remainingEcCandidates) {
139 remainingEcCandidates.
set(state,
false);
141 newMec.insert(state);
143 this->blocks.emplace_back(std::move(newMec));
147 for (
auto sccIndex : nonTrivSccIndices) {
148 for (uint64_t state = 0; state < transitionMatrix.
getRowCount(); state++) {
151 double stayInsideECProb = 0;
152 for (
auto& entry : updatingMatrix.getRow(state)) {
153 const bool targetInEC = sccIndex == sccDecRes.
stateToSccMapping[entry.getColumn()];
158 auto const& interval = entry.getValue();
161 if (interval.upper() > 0 && stayInsideECProb < 1) {
162 stayInsideECProb += interval.upper();
170 if (nonTrivSccIndices == ecSccIndices) {
175 sccDecOptions.
subsystem(remainingEcCandidates);
178 STORM_LOG_DEBUG(
"MEC decomposition found " << this->size() <<
" MEC(s).");
181template<
typename ValueType>
183 std::vector<uint64_t> result(numberOfStates, std::numeric_limits<uint64_t>::max());
184 uint64_t sccIndex = 0;
185 for (
auto const& scc : *
this) {
186 for (
auto const& state : scc) {
187 result[state] = sccIndex;
Helper class that optionally holds a reference to an object of type T.
The base class of all sparse deterministic models.
storm::storage::SparseMatrix< ValueType > const & getTransitionMatrix() const
Retrieves the matrix representing the transitions of the model.
storm::storage::SparseMatrix< ValueType > getBackwardTransitions() const
Retrieves the backward transition relation of the model, i.e.
A bit vector that is internally represented as a vector of 64-bit values.
void set(uint64_t index, bool value=true)
Sets the given truth value at the given index.
This class represents the decomposition of a model into blocks which are of the template type.
Decomposition & operator=(Decomposition const &other)
Assigns the contents of the given decomposition to the current one by copying the contents.
This class represents the decomposition of a nondeterministic model into its maximal end components.
RobustMaximalEndComponentDecomposition()
RobustMaximalEndComponentDecomposition & operator=(RobustMaximalEndComponentDecomposition const &other)
Assigns the contents of the given MEC decomposition to the current one by copying its contents.
std::vector< uint64_t > computeStateToSccIndexMap(uint64_t numberOfStates) const
Computes a vector that for each state has the index of the scc of that state in it.
A class that holds a possibly non-square matrix in the compressed row storage format.
index_type getRowCount() const
Returns the number of rows of the matrix.
#define STORM_LOG_DEBUG(message)
void performSccDecomposition(storm::storage::SparseMatrix< ValueType > const &transitionMatrix, StronglyConnectedComponentDecompositionOptions const &options, SccDecompositionResult &result)
Computes an SCC decomposition for the given matrix and options.
bool isZero(ValueType const &a)
Holds temporary computation data used during the SCC decomposition algorithm.
Holds the result data of the implemented SCC decomposition algorithm.
std::vector< uint64_t > stateToSccMapping
Number of found SCCs.
storm::storage::BitVector nonTrivialStates
Mapping from states to the SCC it belongs to.
uint64_t sccCount
True if an SCC is associated to the given state.
StronglyConnectedComponentDecompositionOptions & dropNaiveSccs(bool value=true)
Sets if trivial SCCs (i.e. SCCs consisting of just one state without a self-loop) are to be kept in t...
StronglyConnectedComponentDecompositionOptions & subsystem(storm::storage::BitVector const &subsystem)
Sets a bit vector indicating which subsystem to consider for the decomposition into SCCs.