61 std::vector<ValueType>
const& oneStepTargetProbabilities, std::function<uint64_t(uint64_t)>
const& stateToScc) {
73 assert(transitionMatrix.
getRowCount() == oneStepTargetProbabilities.size());
74 assert(backwardTransitions.
getRowCount() == numStates);
82 for (uint64_t state = 0; state < numStates; ++state) {
83 auto const scc = stateToScc(state);
84 for (
auto rowIndex = rowGroupIndices[state], rowEnd = rowGroupIndices[state + 1]; rowIndex < rowEnd; ++rowIndex) {
85 auto const row = transitionMatrix.
getRow(rowIndex);
86 if (std::any_of(row.begin(), row.end(), [&stateToScc, &scc](
auto const& entry) { return scc != stateToScc(entry.getColumn()); })) {
87 validChoices.set(rowIndex,
true);
93 std::vector<ValueType> result(numStates, storm::utility::one<ValueType>());
99 auto isValidChoice = [&transitionMatrix, &validChoices, &processedStates](uint64_t
const& choice) {
100 if (validChoices.get(choice)) {
103 auto row = transitionMatrix.
getRow(choice);
106 if (std::any_of(row.begin(), row.end(), [&processedStates](
auto const& entry) { return processedStates.get(entry.getColumn()); })) {
107 validChoices.set(choice,
true);
115 auto getChoiceValue = [&transitionMatrix, &oneStepTargetProbabilities, &processedStates, &stateToScc, &result](uint64_t
const& rowIndex,
116 uint64_t
const& sccIndex) {
117 ValueType rowValue = oneStepTargetProbabilities[rowIndex];
118 for (
auto const& entry : transitionMatrix.
getRow(rowIndex)) {
119 if (
auto successorState = entry.getColumn(); sccIndex != stateToScc(successorState)) {
120 rowValue += entry.getValue();
121 }
else if (processedStates.
get(successorState)) {
122 rowValue += entry.getValue() * result[successorState];
134 uint64_t unprocessedEnd = numStates;
135 auto candidateStateIt = candidateStates.
rbegin();
136 auto const candidateStateItEnd = candidateStates.
rend();
141 uint64_t
const state = *candidateStateIt;
143 if (std::all_of(group.begin(), group.end(), [&isValidChoice](
auto const& choice) { return isValidChoice(choice); })) {
146 auto const scc = stateToScc(state);
147 for (
auto choice : group) {
148 minimalStateValue &= getChoiceValue(choice, scc);
150 result[state] = *minimalStateValue;
151 processedStates.
set(state);
152 if (state == unprocessedEnd - 1) {
154 if (unprocessedEnd == 0) {
160 for (
auto const& predEntry : backwardTransitions.
getRow(state)) {
161 if (!processedStates.
get(predEntry.getColumn())) {
162 candidateStates.
set(predEntry.getColumn());
167 candidateStates.
set(state,
false);
170 if (candidateStateIt == candidateStateItEnd) {
172 candidateStateIt = candidateStates.
rbegin(unprocessedEnd);
174 STORM_LOG_THROW(candidateStateIt != candidateStateItEnd, storm::exceptions::InvalidOperationException,
175 "Unable to compute finite upper bounds for visiting times: No more candidates.");
186 STORM_LOG_TRACE(
"Computing upper reward bounds using variant-2 of Baier et al.");
189 if (!backwardTransitions) {
190 computedBackwardTransitions = transitionMatrix.
transpose(
true);
192 auto const& backwardTransRef = backwardTransitions ? *backwardTransitions : computedBackwardTransitions;
194 auto expVisits = stateToScc ? computeUpperBoundOnExpectedVisitingTimes(transitionMatrix, backwardTransRef, oneStepTargetProbabilities, stateToScc)
195 : computeUpperBoundOnExpectedVisitingTimes(transitionMatrix, backwardTransRef, oneStepTargetProbabilities);
197 ValueType upperBound = storm::utility::zero<ValueType>();
198 for (uint64_t state = 0; state < expVisits.size(); ++state) {
199 ValueType maxReward = storm::utility::zero<ValueType>();
203 maxReward = std::max(maxReward, rewards[row]);
205 upperBound += expVisits[state] * maxReward;
208 STORM_LOG_TRACE(
"Baier algorithm for reward bound computation (variant 2) computed bound " << upperBound <<
".");
void applyPointwise(std::vector< InValueType1 > const &firstOperand, std::vector< InValueType2 > const &secondOperand, std::vector< OutValueType > &target, Operation f=Operation())
Applies the given operation pointwise on the two given vectors and writes the result to the third vec...