From fd77b71084cb51b5c3910e85e6373947c6f52535 Mon Sep 17 00:00:00 2001 From: Tim Quatmann Date: Wed, 19 Aug 2020 14:04:53 +0200 Subject: [PATCH] OVI helper: fixed spacing in source code, changed two while loops to for loops --- .../helper/OptimisticValueIterationHelper.h | 21 +++++++------------ 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/src/storm/solver/helper/OptimisticValueIterationHelper.h b/src/storm/solver/helper/OptimisticValueIterationHelper.h index 22cad53fc..781ac9347 100644 --- a/src/storm/solver/helper/OptimisticValueIterationHelper.h +++ b/src/storm/solver/helper/OptimisticValueIterationHelper.h @@ -166,40 +166,35 @@ namespace storm { // Upper bound iteration singleIterationCallback(upperX, auxVector, overallIterations); - // At this point,h auxVector contains the old values for the upper bound whereas upperX contains the new ones. + // At this point, auxVector contains the old values for the upper bound whereas upperX contains the new ones. // Compare the new upper bound candidate with the old one bool newUpperBoundAlwaysHigherEqual = true; bool newUpperBoundAlwaysLowerEqual = true; - if(noTerminationGuarantee) { + if (noTerminationGuarantee) { bool cancelOuterScan = false; - for (uint64_t i = 0; i < upperX->size() &! cancelOuterScan; ++i) { + for (uint64_t i = 0; i < upperX->size() & !cancelOuterScan; ++i) { if ((*upperX)[i] < (*auxVector)[i]) { newUpperBoundAlwaysHigherEqual = false; - ++i; - while (i < upperX->size()) { + for (++i; i < upperX->size(); ++i) { if ((*upperX)[i] > (*auxVector)[i]) { newUpperBoundAlwaysLowerEqual = false; cancelOuterScan = true; break; } - ++i; } } else if ((*upperX)[i] != (*auxVector)[i]) { newUpperBoundAlwaysLowerEqual = false; - ++i; - while (i < upperX->size()) { + for (++i; i < upperX->size(); ++i) { if ((*upperX)[i] < (*auxVector)[i]) { newUpperBoundAlwaysHigherEqual = false; cancelOuterScan = true; break; } - ++i; } } } - } - else { + } else { for (uint64_t i = 0; i < upperX->size(); ++i) { if ((*upperX)[i] < (*auxVector)[i]) { newUpperBoundAlwaysHigherEqual = false; @@ -210,7 +205,7 @@ namespace storm { } } - if (newUpperBoundAlwaysHigherEqual &! newUpperBoundAlwaysLowerEqual) { + if (newUpperBoundAlwaysHigherEqual & !newUpperBoundAlwaysLowerEqual) { // All values moved up or stayed the same // That means the guess for an upper bound is actually a lower bound iterationPrecision = oviinternal::updateIterationPrecision(env, *auxVector, *upperX, relative, relevantValues); @@ -218,7 +213,7 @@ namespace storm { // Set lowerX to the upper bound candidate std::swap(lowerX, upperX); break; - } else if (newUpperBoundAlwaysLowerEqual &! newUpperBoundAlwaysHigherEqual) { + } else if (newUpperBoundAlwaysLowerEqual & !newUpperBoundAlwaysHigherEqual) { // All values moved down or stayed the same and we have a maximum difference of twice the requested precision // We can safely use twice the requested precision, as we calculate the center of both vectors bool reachedPrecision;