From 4484cea360448baa6b83a7e107a9ae786cf54a2a Mon Sep 17 00:00:00 2001 From: TimQu Date: Fri, 1 Dec 2017 15:21:39 +0100 Subject: [PATCH] fixing quick power iteration --- src/storm/solver/NativeLinearEquationSolver.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/storm/solver/NativeLinearEquationSolver.cpp b/src/storm/solver/NativeLinearEquationSolver.cpp index 3545cb8d3..70d80e55d 100644 --- a/src/storm/solver/NativeLinearEquationSolver.cpp +++ b/src/storm/solver/NativeLinearEquationSolver.cpp @@ -580,8 +580,6 @@ namespace storm { bool converged = false; bool terminate = false; uint64_t iterations = 0; - bool doConvergenceCheck = true; - bool useDiffs = this->hasRelevantValues(); ValueType precision = storm::utility::convertNumber(env.solver().native().getPrecision()); ValueType lowerValueBound, upperValueBound; bool relative = env.solver().native().getRelativeTerminationCriterion(); @@ -590,25 +588,25 @@ namespace storm { } uint64_t maxIter = env.solver().native().getMaximalNumberOfIterations(); this->startMeasureProgress(); - auto firstProb1EntryIt = stepBoundedStayProbabilities->begin(); + uint64_t firstProb1Entry = 0; while (!converged && !terminate && iterations < maxIter) { this->multiplier.multAdd(*this->A, *stepBoundedValues, &b, *tmp); std::swap(tmp, stepBoundedValues); this->multiplier.multAdd(*this->A, *stepBoundedStayProbabilities, nullptr, *tmp); std::swap(tmp, stepBoundedStayProbabilities); - for (; firstProb1EntryIt != stepBoundedStayProbabilities->end(); ++firstProb1EntryIt) { + for (; firstProb1Entry != stepBoundedStayProbabilities->size(); ++firstProb1Entry) { static_assert(NumberTraits::IsExact || std::is_same::value, "Considered ValueType not handled."); if (NumberTraits::IsExact) { - if (storm::utility::isOne(*firstProb1EntryIt)) { + if (storm::utility::isOne(stepBoundedStayProbabilities->at(firstProb1Entry))) { break; } } else { - if (storm::utility::isAlmostOne(storm::utility::convertNumber(*firstProb1EntryIt))) { + if (storm::utility::isAlmostOne(storm::utility::convertNumber(stepBoundedStayProbabilities->at(firstProb1Entry)))) { break; } } } - if (firstProb1EntryIt == stepBoundedStayProbabilities->end()) { + if (firstProb1Entry == stepBoundedStayProbabilities->size()) { auto valIt = stepBoundedValues->begin(); auto valIte = stepBoundedValues->end(); auto probIt = stepBoundedStayProbabilities->begin(); @@ -625,6 +623,7 @@ namespace storm { } STORM_LOG_ASSERT(!relative, "Relative termination criterion not implemented currently."); converged = largestStayProb * (upperValueBound - lowerValueBound) < precision; + STORM_LOG_INFO_COND(!converged, "Lower value bound: " << lowerValueBound << " Upper value bound: " << upperValueBound << " Largest stay prob.: " << largestStayProb); } // Potentially show progress.