Browse Source

Abort topological solvers if requested.

tempestpy_adaptions
Tim Quatmann 5 years ago
parent
commit
9fddf3858b
  1. 7
      src/storm/solver/TopologicalLinearEquationSolver.cpp
  2. 7
      src/storm/solver/TopologicalMinMaxLinearEquationSolver.cpp

7
src/storm/solver/TopologicalLinearEquationSolver.cpp

@ -7,6 +7,7 @@
#include "storm/exceptions/InvalidStateException.h"
#include "storm/exceptions/InvalidEnvironmentException.h"
#include "storm/exceptions/UnexpectedException.h"
#include "storm/utility/SignalHandler.h"
namespace storm {
namespace solver {
@ -79,6 +80,7 @@ namespace storm {
returnValue = solveFullyConnectedEquationSystem(sccSolverEnvironment, x, b);
} else {
storm::storage::BitVector sccAsBitVector(x.size(), false);
uint64_t sccIndex = 0;
for (auto const& scc : *this->sortedSccDecomposition) {
if (scc.size() == 1) {
returnValue = solveTrivialScc(*scc.begin(), x, b) && returnValue;
@ -89,6 +91,11 @@ namespace storm {
}
returnValue = solveScc(sccSolverEnvironment, sccAsBitVector, x, b) && returnValue;
}
++sccIndex;
if (storm::utility::resources::isTerminate()) {
STORM_LOG_WARN("Topological solver aborted after analyzing " << sccIndex << "/" << this->sortedSccDecomposition->size() << " SCCs.");
break;
}
}
}

7
src/storm/solver/TopologicalMinMaxLinearEquationSolver.cpp

@ -9,6 +9,7 @@
#include "storm/exceptions/InvalidEnvironmentException.h"
#include "storm/exceptions/UnexpectedException.h"
#include "storm/exceptions/UncheckedRequirementException.h"
#include "storm/utility/SignalHandler.h"
namespace storm {
namespace solver {
@ -77,6 +78,7 @@ namespace storm {
}
storm::storage::BitVector sccRowGroupsAsBitVector(x.size(), false);
storm::storage::BitVector sccRowsAsBitVector(b.size(), false);
uint64_t sccIndex = 0;
for (auto const& scc : *this->sortedSccDecomposition) {
if (scc.size() == 1) {
returnValue = solveTrivialScc(*scc.begin(), dir, x, b) && returnValue;
@ -92,6 +94,11 @@ namespace storm {
}
returnValue = solveScc(sccSolverEnvironment, dir, sccRowGroupsAsBitVector, sccRowsAsBitVector, x, b) && returnValue;
}
++sccIndex;
if (storm::utility::resources::isTerminate()) {
STORM_LOG_WARN("Topological solver aborted after analyzing " << sccIndex << "/" << this->sortedSccDecomposition->size() << " SCCs.");
break;
}
}
// If requested, we store the scheduler for retrieval.

Loading…
Cancel
Save