diff --git a/src/utility/shortestPaths.cpp b/src/utility/shortestPaths.cpp index 409030c32..3b6772464 100644 --- a/src/utility/shortestPaths.cpp +++ b/src/utility/shortestPaths.cpp @@ -13,7 +13,9 @@ namespace storm { metaTarget(model->getNumberOfStates()), // first unused state number initialStates(model->getInitialStates()), targets(targets) { - targetSet = std::unordered_set(targets.begin(), targets.end()); + for (state_t target : targets) { + targetProbMap.emplace(target, one()); + } computePredecessors(); @@ -134,7 +136,7 @@ namespace storm { state_t currentNode = (*dijkstraQueue.begin()).second; dijkstraQueue.erase(dijkstraQueue.begin()); - if (targetSet.count(currentNode) == 0) { + if (targetProbMap.count(currentNode) == 0) { // non-target node, treated normally for (auto const& transition : transitionMatrix.getRowGroup(currentNode)) { state_t otherNode = transition.getColumn(); @@ -223,7 +225,7 @@ namespace storm { return utility::zero(); } else { // edge must be "virtual edge" from target state to meta-target - assert(targetSet.count(tailNode) == 1); + assert(targetProbMap.count(tailNode) == 1); return utility::one(); } } diff --git a/src/utility/shortestPaths.h b/src/utility/shortestPaths.h index 64fa16ca6..2c8927609 100644 --- a/src/utility/shortestPaths.h +++ b/src/utility/shortestPaths.h @@ -99,10 +99,10 @@ namespace storm { private: storage::SparseMatrix transitionMatrix; state_t numStates; // includes meta-target, i.e. states in model + 1 - std::unordered_set targetSet; state_t metaTarget; storage::BitVector initialStates; state_list_t targets; + std::unordered_map targetProbMap; std::vector graphPredecessors; std::vector> shortestPathPredecessors;