Browse Source

Fixed problem in MaximalEndComponents

Former-commit-id: 950b9cfdfa
main
Mavo 9 years ago
parent
commit
e4c2702889
  1. 12
      src/modelchecker/csl/helper/SparseMarkovAutomatonCslHelper.cpp
  2. 5
      src/storage/Decomposition.cpp
  3. 7
      src/storage/Decomposition.h
  4. 4
      src/storage/MaximalEndComponentDecomposition.cpp

12
src/modelchecker/csl/helper/SparseMarkovAutomatonCslHelper.cpp

@ -407,11 +407,14 @@ namespace storm {
infinityStates = storm::storage::BitVector(numberOfStates); infinityStates = storm::storage::BitVector(numberOfStates);
} }
} }
// Now we identify the states for which values need to be computed. // Now we identify the states for which values need to be computed.
storm::storage::BitVector maybeStates = ~(goalStates | infinityStates); storm::storage::BitVector maybeStates = ~(goalStates | infinityStates);
// Then, we can eliminate the rows and columns for all states whose values are already known to be 0. // Create resulting vector.
std::vector<ValueType> result(numberOfStates);
if (!maybeStates.empty()) {
// Then, we can eliminate the rows and columns for all states whose values are already known.
std::vector<ValueType> x(maybeStates.getNumberOfSetBits()); std::vector<ValueType> x(maybeStates.getNumberOfSetBits());
storm::storage::SparseMatrix<ValueType> submatrix = transitionMatrix.getSubmatrix(true, maybeStates, maybeStates); storm::storage::SparseMatrix<ValueType> submatrix = transitionMatrix.getSubmatrix(true, maybeStates, maybeStates);
@ -429,11 +432,10 @@ namespace storm {
std::unique_ptr<storm::solver::MinMaxLinearEquationSolver<ValueType>> solver = minMaxLinearEquationSolverFactory.create(submatrix); std::unique_ptr<storm::solver::MinMaxLinearEquationSolver<ValueType>> solver = minMaxLinearEquationSolverFactory.create(submatrix);
solver->solveEquationSystem(dir, x, b); solver->solveEquationSystem(dir, x, b);
// Create resulting vector.
std::vector<ValueType> result(numberOfStates);
// Set values of resulting vector according to previous result and return the result. // Set values of resulting vector according to previous result and return the result.
storm::utility::vector::setVectorValues<ValueType>(result, maybeStates, x); storm::utility::vector::setVectorValues<ValueType>(result, maybeStates, x);
}
storm::utility::vector::setVectorValues(result, goalStates, storm::utility::zero<ValueType>()); storm::utility::vector::setVectorValues(result, goalStates, storm::utility::zero<ValueType>());
storm::utility::vector::setVectorValues(result, infinityStates, storm::utility::infinity<ValueType>()); storm::utility::vector::setVectorValues(result, infinityStates, storm::utility::infinity<ValueType>());

5
src/storage/Decomposition.cpp

@ -41,6 +41,11 @@ namespace storm {
return blocks.size(); return blocks.size();
} }
template <typename BlockType>
bool Decomposition<BlockType>::empty() const {
return blocks.empty();
}
template <typename BlockType> template <typename BlockType>
typename Decomposition<BlockType>::iterator Decomposition<BlockType>::begin() { typename Decomposition<BlockType>::iterator Decomposition<BlockType>::begin() {
return blocks.begin(); return blocks.begin();

7
src/storage/Decomposition.h

@ -63,6 +63,13 @@ namespace storm {
*/ */
std::size_t size() const; std::size_t size() const;
/*!
* Checks if the decomposition is empty.
*
* @return True, if the decomposition is empty.
*/
bool empty() const;
/*! /*!
* Retrieves an iterator that points to the first block of this decomposition. * Retrieves an iterator that points to the first block of this decomposition.
* *

4
src/storage/MaximalEndComponentDecomposition.cpp

@ -86,6 +86,9 @@ namespace storm {
mecChanged |= sccs.size() > 1 || (sccs.size() > 0 && sccs[0].size() < mec.size()); mecChanged |= sccs.size() > 1 || (sccs.size() > 0 && sccs[0].size() < mec.size());
// Check for each of the SCCs whether there is at least one action for each state that does not leave the SCC. // Check for each of the SCCs whether there is at least one action for each state that does not leave the SCC.
if (sccs.empty()) {
mecChanged = true;
} else {
for (auto& scc : sccs) { for (auto& scc : sccs) {
statesToCheck.set(scc.begin(), scc.end()); statesToCheck.set(scc.begin(), scc.end());
@ -133,6 +136,7 @@ namespace storm {
} }
} }
} }
}
// If the MEC changed, we delete it from the list of MECs and append the possible new MEC candidates to // If the MEC changed, we delete it from the list of MECs and append the possible new MEC candidates to
// the list instead. // the list instead.

|||||||
100:0
Loading…
Cancel
Save