Browse Source

Let the topological equation solvers handle singleton SCCs with self-loops directly.

tempestpy_adaptions
TimQu 6 years ago
parent
commit
2aeab4b2e7
  1. 8
      src/storm/solver/TopologicalLinearEquationSolver.cpp
  2. 14
      src/storm/solver/TopologicalMinMaxLinearEquationSolver.cpp

8
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;
}

14
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<ValueType>()) {
rowValue = storm::utility::infinity<ValueType>();
} else {
rowValue = -storm::utility::infinity<ValueType>();
}
}
} else {
rowValue /= denominator;
}
}
if (firstRow) {
xi = std::move(rowValue);

Loading…
Cancel
Save