Browse Source

Modified SCC-based model checker such that trivial SCCs are now eliminated before all others.

Former-commit-id: 87ad395c31
tempestpy_adaptions
dehnert 10 years ago
parent
commit
2742b58b60
  1. 19
      src/modelchecker/reachability/SparseSccModelChecker.cpp
  2. 19
      src/storage/StronglyConnectedComponentDecomposition.cpp

19
src/modelchecker/reachability/SparseSccModelChecker.cpp

@ -81,8 +81,23 @@ namespace storm {
// To eliminate the remaining one-state SCCs, we need to keep track of them. // To eliminate the remaining one-state SCCs, we need to keep track of them.
storm::storage::BitVector remainingStates(scc); storm::storage::BitVector remainingStates(scc);
// And then recursively treat all sub-SCCs.
for (auto const& newScc : decomposition) {
// Store a bit vector of remaining SCCs so we can be flexible when it comes to the order in which
// we eliminate the SCCs.
storm::storage::BitVector remainingSccs(decomposition.size(), true);
// First, get rid of the trivial SCCs.
for (uint_fast64_t sccIndex = 0; sccIndex < decomposition.size(); ++sccIndex) {
storm::storage::StronglyConnectedComponent const& scc = decomposition.getBlock(sccIndex);
if (scc.isTrivial()) {
storm::storage::sparse::state_type onlyState = *scc.begin();
eliminateState(matrix, oneStepProbabilities, onlyState, backwardTransitions);
remainingSccs.set(sccIndex, false);
}
}
// And then recursively treat the remaining sub-SCCs.
for (auto sccIndex : remainingSccs) {
storm::storage::StronglyConnectedComponent const& newScc = decomposition.getBlock(sccIndex);
// If the SCC consists of just one state, we do not explore it recursively, but rather eliminate // If the SCC consists of just one state, we do not explore it recursively, but rather eliminate
// it directly. // it directly.
if (newScc.size() == 1) { if (newScc.size() == 1) {

19
src/storage/StronglyConnectedComponentDecomposition.cpp

@ -86,6 +86,17 @@ namespace storm {
this->blocks[stateToSccMapping[state]].insert(state); this->blocks[stateToSccMapping[state]].insert(state);
} }
// Now flag all trivial SCCs as such.
for (uint_fast64_t sccIndex = 0; sccIndex < sccCount; ++sccIndex) {
if (this->blocks[sccIndex].size() == 1) {
uint_fast64_t onlyState = *this->blocks[sccIndex].begin();
if (!statesWithSelfLoop.get(onlyState)) {
this->blocks[sccIndex].setIsTrivial(true);
}
}
}
// If requested, we need to drop some SCCs. // If requested, we need to drop some SCCs.
if (onlyBottomSccs || dropNaiveSccs) { if (onlyBottomSccs || dropNaiveSccs) {
storm::storage::BitVector blocksToDrop(sccCount); storm::storage::BitVector blocksToDrop(sccCount);
@ -93,12 +104,8 @@ namespace storm {
// If requested, we need to delete all naive SCCs. // If requested, we need to delete all naive SCCs.
if (dropNaiveSccs) { if (dropNaiveSccs) {
for (uint_fast64_t sccIndex = 0; sccIndex < sccCount; ++sccIndex) { for (uint_fast64_t sccIndex = 0; sccIndex < sccCount; ++sccIndex) {
if (this->blocks[sccIndex].size() == 1) {
uint_fast64_t onlyState = *this->blocks[sccIndex].begin();
if (!statesWithSelfLoop.get(onlyState)) {
blocksToDrop.set(sccIndex);
}
if (this->blocks[sccIndex].isTrivial()) {
blocksToDrop.set(sccIndex);
} }
} }
} }

Loading…
Cancel
Save