From 032e141254cea938664a4847b5bba168628245eb Mon Sep 17 00:00:00 2001 From: dehnert Date: Mon, 31 Aug 2015 10:30:24 +0200 Subject: [PATCH] small fix to the way interval reward models are reduced to a scalar vector Former-commit-id: 218b31ce69d25d5647e357fee10c7dfd86fb4ff1 --- src/modelchecker/prctl/helper/SparseMdpPrctlHelper.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/modelchecker/prctl/helper/SparseMdpPrctlHelper.cpp b/src/modelchecker/prctl/helper/SparseMdpPrctlHelper.cpp index 6b0cfd419..0bebce717 100644 --- a/src/modelchecker/prctl/helper/SparseMdpPrctlHelper.cpp +++ b/src/modelchecker/prctl/helper/SparseMdpPrctlHelper.cpp @@ -179,11 +179,11 @@ namespace storm { STORM_LOG_THROW(!intervalRewardModel.empty(), storm::exceptions::InvalidPropertyException, "Missing reward model for formula. Skipping formula."); return computeReachabilityRewardsHelper(minimize, transitionMatrix, backwardTransitions, [&] (uint_fast64_t rowCount, storm::storage::SparseMatrix const& transitionMatrix, storm::storage::BitVector const& maybeStates) { - std::vector fullIntervalRewardVector = intervalRewardModel.getTotalRewardVector(rowCount, transitionMatrix, maybeStates); - std::vector result(rowCount); - uint_fast64_t currentPosition = 0; - for (auto position : maybeStates) { - result[currentPosition] = minimize ? fullIntervalRewardVector[position].lower() : fullIntervalRewardVector[position].upper(); + std::vector result; + result.reserve(rowCount); + std::vector subIntervalVector = intervalRewardModel.getTotalRewardVector(rowCount, transitionMatrix, maybeStates); + for (auto const& interval : subIntervalVector) { + result.push_back(minimize ? interval.lower() : interval.upper()); } return result; },