diff --git a/src/storm/solver/TopologicalLinearEquationSolver.cpp b/src/storm/solver/TopologicalLinearEquationSolver.cpp index 877ba76dd..5b31509fa 100644 --- a/src/storm/solver/TopologicalLinearEquationSolver.cpp +++ b/src/storm/solver/TopologicalLinearEquationSolver.cpp @@ -80,7 +80,7 @@ namespace storm { } else { storm::storage::BitVector sccAsBitVector(x.size(), false); for (auto const& scc : *this->sortedSccDecomposition) { - if (scc.isTrivial()) { + if (scc.size() == 1) { returnValue = solveTrivialScc(*scc.begin(), x, b) && returnValue; } else { sccAsBitVector.clear(); @@ -131,7 +131,11 @@ namespace storm { } if (hasDiagonalEntry) { - xi /= denominator; + 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 d6c1b69e1..0132f29c8 100644 --- a/src/storm/solver/TopologicalMinMaxLinearEquationSolver.cpp +++ b/src/storm/solver/TopologicalMinMaxLinearEquationSolver.cpp @@ -78,7 +78,7 @@ namespace storm { storm::storage::BitVector sccRowGroupsAsBitVector(x.size(), false); storm::storage::BitVector sccRowsAsBitVector(b.size(), false); for (auto const& scc : *this->sortedSccDecomposition) { - if (scc.isTrivial()) { + if (scc.size() == 1) { returnValue = solveTrivialScc(*scc.begin(), dir, x, b) && returnValue; } else { sccRowGroupsAsBitVector.clear(); @@ -142,7 +142,17 @@ namespace storm { } } if (hasDiagonalEntry) { - rowValue /= denominator; + if (storm::utility::isZero(denominator)) { + if (!storm::utility::isZero(rowValue)) { + if (rowValue > storm::utility::zero()) { + rowValue = storm::utility::infinity(); + } else { + rowValue = -storm::utility::infinity(); + } + } + } else { + rowValue /= denominator; + } } if (firstRow) { xi = std::move(rowValue);