From 94311e7d305f5f15f6df6212ed5793b5042a1ea7 Mon Sep 17 00:00:00 2001 From: Tim Quatmann Date: Fri, 11 Sep 2020 17:05:04 +0200 Subject: [PATCH] Topological solvers: Added a warning for numerical issues triggered in cases where in non-exact mode a selfloop probability is very close to 1 but not equal to 1 --- src/storm/solver/TopologicalLinearEquationSolver.cpp | 11 ++++++----- .../solver/TopologicalMinMaxLinearEquationSolver.cpp | 1 + 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/storm/solver/TopologicalLinearEquationSolver.cpp b/src/storm/solver/TopologicalLinearEquationSolver.cpp index 76e4ce3ea..5ae744203 100644 --- a/src/storm/solver/TopologicalLinearEquationSolver.cpp +++ b/src/storm/solver/TopologicalLinearEquationSolver.cpp @@ -144,11 +144,12 @@ namespace storm { } if (hasDiagonalEntry) { - if (storm::utility::isZero(denominator)) { - STORM_LOG_THROW(storm::utility::isZero(xi), storm::exceptions::InvalidOperationException, "The equation system has no solution."); - } else { - xi /= denominator; - } + STORM_LOG_WARN_COND_DEBUG(storm::NumberTraits::IsExact || !storm::utility::isAlmostZero(denominator) || storm::utility::isZero(denominator), "State " << sccState << " has a selfloop with probability '1-(" << denominator << ")'. This could be an indication for numerical issues."); + if (storm::utility::isZero(denominator)) { + STORM_LOG_THROW(storm::utility::isZero(xi), storm::exceptions::InvalidOperationException, "The equation system has no solution."); + } else { + xi /= denominator; + } } return true; } diff --git a/src/storm/solver/TopologicalMinMaxLinearEquationSolver.cpp b/src/storm/solver/TopologicalMinMaxLinearEquationSolver.cpp index 7c366e436..6cf09bd45 100644 --- a/src/storm/solver/TopologicalMinMaxLinearEquationSolver.cpp +++ b/src/storm/solver/TopologicalMinMaxLinearEquationSolver.cpp @@ -155,6 +155,7 @@ namespace storm { } } if (hasDiagonalEntry) { + STORM_LOG_WARN_COND_DEBUG(storm::NumberTraits::IsExact || !storm::utility::isAlmostZero(denominator) || storm::utility::isZero(denominator), "State " << sccState << " has a selfloop with probability '1-(" << denominator << ")'. This could be an indication for numerical issues."); if (storm::utility::isZero(denominator)) { // In this case we have a selfloop on this state. This can never an optimal choice: // When minimizing, we are looking for the largest fixpoint (which will never be attained by this action)