diff --git a/src/storm/solver/IterativeMinMaxLinearEquationSolver.cpp b/src/storm/solver/IterativeMinMaxLinearEquationSolver.cpp index 6a51811cf..8cdfa8394 100644 --- a/src/storm/solver/IterativeMinMaxLinearEquationSolver.cpp +++ b/src/storm/solver/IterativeMinMaxLinearEquationSolver.cpp @@ -389,6 +389,7 @@ namespace storm { std::vector ubDiffV(newX->size()); std::vector boundsDiffV(currentX->size()); + ValueType one = storm::utility::one(); ValueType two = storm::utility::convertNumber(2.0); ValueType precision = storm::utility::convertNumber(env.solver().minMax().getPrecision()); ValueType doublePrecision = precision * two; @@ -413,7 +414,7 @@ namespace storm { currentVerificationIterations = 0; currentUpperBound = *currentX; - guessUpperBound(*currentX, currentUpperBound, precision, relative); + guessUpperBound(*currentX, currentUpperBound, precision, relative, one); newUpperBound = currentUpperBound; // TODO: More efficient check for verification iterations @@ -465,7 +466,7 @@ namespace storm { // We can safely use twice the requested precision, as we calculate the center of both vectors // We can use max_if instead of computeMaxAbsDiff, as x is definitely a lower bound and ub is larger in all elements if (!storm::utility::vector::hasNegativeEntry(ubDiffV)) { - // Recalculate relativeTerminationDiff if relative error requested + // Recalculate terminationPrecision if relative error requested // TODO: Is here min or max required? if (relative) { terminationPrecision = doublePrecision * storm::utility::vector::min_if(*currentX, this->getRelevantValues()); @@ -507,11 +508,11 @@ namespace storm { } template - void IterativeMinMaxLinearEquationSolver::guessUpperBound(std::vector &x, std::vector &target, ValueType const& precision, bool const& relative) const { + void IterativeMinMaxLinearEquationSolver::guessUpperBound(std::vector &x, std::vector &target, ValueType const& precision, bool const& relative, ValueType const& one) const { if (relative) { - storm::utility::vector::applyPointwise(x, target, [&] (ValueType const& argument) -> ValueType { return argument * precision; }); + storm::utility::vector::scaleVectorInPlace(target, (one + precision)); } else { - storm::utility::vector::applyPointwise(x, target, [&] (ValueType const& argument) -> ValueType { return argument + precision; }); + storm::utility::vector::applyPointwise(x, target, [&precision] (ValueType const& argument) -> ValueType { return argument + precision; }); } } diff --git a/src/storm/solver/IterativeMinMaxLinearEquationSolver.h b/src/storm/solver/IterativeMinMaxLinearEquationSolver.h index 6ee268c5c..65f8c1e3e 100644 --- a/src/storm/solver/IterativeMinMaxLinearEquationSolver.h +++ b/src/storm/solver/IterativeMinMaxLinearEquationSolver.h @@ -45,7 +45,7 @@ namespace storm { bool solveEquationsSoundValueIteration(Environment const& env, OptimizationDirection dir, std::vector& x, std::vector const& b) const; bool solveEquationsViToPi(Environment const& env, OptimizationDirection dir, std::vector& x, std::vector const& b) const; - void guessUpperBound(std::vector &x, std::vector &target, ValueType const& precision, bool const& relative) const; + void guessUpperBound(std::vector &x, std::vector &target, ValueType const& precision, bool const& relative, ValueType const& one) const; bool solveEquationsRationalSearch(Environment const& env, OptimizationDirection dir, std::vector& x, std::vector const& b) const;