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>
97 for (
auto state : remainingEcCandidates) {
99 nonTrivSccIndices.set(sccIndex,
true);
103 double probabilityToStayInScc = 0;
105 if (vector && vector->at(state).lower() == 0) {
107 for (
auto const& entry : transitionMatrix.getRow(state)) {
108 auto const& target = entry.getColumn();
109 const bool targetInSCC = sccIndex == sccDecRes.
stateToSccMapping[entry.getColumn()];
110 auto const& interval = entry.getValue();
113 probabilityToStayInScc = 0;
115 }
else if (targetInSCC) {
116 probabilityToStayInScc += interval.upper();
122 if (probabilityToStayInScc < 1) {
124 remainingEcCandidates.
set(state,
false);
126 ecSccIndices.set(sccIndex,
false);
131 ecSccIndices &= nonTrivSccIndices;
133 for (
auto sccIndex : ecSccIndices) {
134 StronglyConnectedComponent newMec;
135 for (
auto state : remainingEcCandidates) {
141 remainingEcCandidates.
set(state,
false);
143 newMec.insert(state);
145 this->blocks.emplace_back(std::move(newMec));
149 for (
auto sccIndex : nonTrivSccIndices) {
150 for (uint64_t state = 0; state < transitionMatrix.
getRowCount(); state++) {
153 double stayInsideECProb = 0;
154 for (
auto& entry : updatingMatrix.getRow(state)) {
155 auto const& target = entry.getColumn();
156 const bool targetInEC = sccIndex == sccDecRes.
stateToSccMapping[entry.getColumn()];
161 auto const& interval = entry.getValue();
164 if (interval.upper() > 0 && stayInsideECProb < 1) {
165 stayInsideECProb += interval.upper();
173 if (nonTrivSccIndices == ecSccIndices) {
178 sccDecOptions.
subsystem(remainingEcCandidates);
181 STORM_LOG_DEBUG(
"MEC decomposition found " << this->size() <<
" MEC(s).");
184template<
typename ValueType>
186 std::vector<uint64_t> result(numberOfStates, std::numeric_limits<uint64_t>::max());
187 uint64_t sccIndex = 0;
188 for (
auto const& scc : *
this) {
189 for (
auto const& state : scc) {
190 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(uint_fast64_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.