13template<
typename ValueType>
16 bool assumeOptimalTransitionProbabilities) {
18 auto res = storm::utility::one<ValueType>();
19 if (mec.
size() == 1) {
25 for (
auto const& stateChoices : mec) {
27 auto const& s = stateChoices.first;
28 for (
auto const& c : stateChoices.second) {
29 auto row = transitions.
getRow(c);
30 if (assumeOptimalTransitionProbabilities) {
33 for (
auto const& entry : row) {
34 if (entry.getColumn() > s) {
35 if (entry.getColumn() == s) {
42 v &= storm::utility::one<ValueType>() / storm::utility::convertNumber<ValueType>(numEntries);
46 for (
auto const& entry : row) {
48 v &= entry.getValue();
59template<
typename ValueType>
62 bool assumeOptimalTransitionProbabilities) {
63 auto const one = storm::utility::one<ValueType>();
64 auto const traversalLowerBound = computeMecTraversalLowerBound(mec, transitions, assumeOptimalTransitionProbabilities);
65 if (assumeOptimalTransitionProbabilities) {
67 return one / traversalLowerBound;
71 for (
auto const& stateChoices : mec) {
73 if (stateChoices.second.contains(c)) {
76 auto choiceValue = storm::utility::zero<ValueType>();
77 for (
auto const& entry : transitions.
getRow(c)) {
79 choiceValue += entry.getValue();
85 return one / (traversalLowerBound * (one - *q));
89template<
typename ValueType>
96 auto notSubsystem = ~subsystem;
99 std::map<uint64_t, ValueType> collapsedStateToValueMap;
100 for (
auto const& mec : mecs) {
101 collapsedStateToValueMap.emplace(quotientData.oldToNewStateMapping.at(mec.begin()->first), computeMecTraversalLowerBound(mec, transitions));
106 true, quotientData.matrix.getRowGroupCount());
107 std::vector<ValueType> toSinkProbabilities;
108 toSinkProbabilities.reserve(quotientData.matrix.getRowGroupCount());
109 for (uint64_t state = 0; state < quotientData.matrix.getRowGroupCount(); ++state) {
110 modifiedQuotientBuilder.
newRowGroup(quotientData.matrix.getRowGroupIndices()[state]);
111 ValueType scalingFactor = storm::utility::one<ValueType>();
112 if (
auto findRes = collapsedStateToValueMap.find(state); findRes != collapsedStateToValueMap.end()) {
113 scalingFactor = findRes->second;
115 for (
auto const choice : quotientData.matrix.getRowGroupIndices(state)) {
117 modifiedQuotientBuilder.
addDiagonalEntry(choice, storm::utility::one<ValueType>() - scalingFactor);
119 for (
auto const& entry : quotientData.matrix.getRow(choice)) {
120 modifiedQuotientBuilder.
addNextValue(choice, entry.getColumn(), scalingFactor * entry.getValue());
122 if (quotientData.sinkRows.get(choice)) {
123 toSinkProbabilities.push_back(scalingFactor);
125 toSinkProbabilities.push_back(scalingFactor * transitions.
getConstrainedRowSum(quotientData.newToOldRowMapping.at(choice), notSubsystem));
129 auto modifiedQuotient = modifiedQuotientBuilder.
build();
130 STORM_LOG_ASSERT(modifiedQuotient.getRowCount() == toSinkProbabilities.size(),
"Unexpected row count");
133 auto quotientUpperBounds =
136 std::vector<ValueType> result;
137 result.reserve(subsystem.
size());
138 for (uint64_t state = 0; state < subsystem.
size(); ++state) {
139 auto const& quotientState = quotientData.oldToNewStateMapping[state];
140 if (quotientState < quotientData.matrix.getRowGroupCount()) {
141 result.push_back(quotientUpperBounds.at(quotientState));
143 result.push_back(-storm::utility::one<ValueType>());
static std::vector< ValueType > computeUpperBoundOnExpectedVisitingTimes(storm::storage::SparseMatrix< ValueType > const &transitionMatrix, storm::storage::SparseMatrix< ValueType > const &backwardTransitions, std::vector< ValueType > const &oneStepTargetProbabilities)
Computes for each state an upper bound for the maximal expected times each state is visited.
Provides helper functions for computing bounds on the expected visiting times.
static ValueType computeMecVisitsUpperBound(storm::storage::MaximalEndComponent const &mec, storm::storage::SparseMatrix< ValueType > const &transitions, bool assumeOptimalTransitionProbabilities=false)
Computes an upper bound for the largest finite expected number of times a state s in the given MEC is...
static std::vector< ValueType > computeUpperBoundsOnExpectedVisitingTimes(storm::storage::BitVector const &subsystem, storm::storage::SparseMatrix< ValueType > const &transitions, storm::storage::SparseMatrix< ValueType > const &backwardTransitions)
Computes for each state in the given subsystem an upper bound for the maximal finite expected number ...
static ValueType computeMecTraversalLowerBound(storm::storage::MaximalEndComponent const &mec, storm::storage::SparseMatrix< ValueType > const &transitions, bool assumeOptimalTransitionProbabilities=false)
Computes value l in (0,1] such that for any pair of distinct states s,s' and deterministic,...
A bit vector that is internally represented as a vector of 64-bit values.
size_t size() const
Retrieves the number of bits this bit vector can store.
This class represents the decomposition of a nondeterministic model into its maximal end components.
This class represents a maximal end-component of a nondeterministic model.
bool containsState(uint_fast64_t state) const
Retrieves whether the given state is contained in this MEC.
index_type getNumberOfEntries() const
Retrieves the number of entries in the rows.
A class that can be used to build a sparse matrix by adding value by value.
void addNextValue(index_type row, index_type column, value_type const &value)
Sets the matrix entry at the given row and column to the given value.
void newRowGroup(index_type startingRow)
Starts a new row group in the matrix.
void addDiagonalEntry(index_type row, ValueType const &value)
Makes sure that a diagonal entry will be inserted at the given row.
SparseMatrix< value_type > build(index_type overriddenRowCount=0, index_type overriddenColumnCount=0, index_type overriddenRowGroupCount=0)
A class that holds a possibly non-square matrix in the compressed row storage format.
const_rows getRow(index_type row) const
Returns an object representing the given row.
value_type getConstrainedRowSum(index_type row, storm::storage::BitVector const &columns) const
Sums the entries in the given row and columns.
std::vector< index_type > const & getRowGroupIndices() const
Returns the grouping of rows of this matrix.
Stores and manages an extremal (maximal or minimal) value.
#define STORM_LOG_ASSERT(cond, message)
bool isOne(ValueType const &a)
bool isZero(ValueType const &a)