#ifndef STORM_MODELCHECKER_REACHABILITY_SPARSESCCMODELCHECKER_H_ #define STORM_MODELCHECKER_REACHABILITY_SPARSESCCMODELCHECKER_H_ #include "src/storage/sparse/StateType.h" #include "src/models/Dtmc.h" #include "src/properties/prctl/PrctlFilter.h" namespace storm { namespace modelchecker { namespace reachability { template class FlexibleSparseMatrix { public: typedef uint_fast64_t index_type; typedef ValueType value_type; typedef std::vector> row_type; typedef typename row_type::iterator iterator; typedef typename row_type::const_iterator const_iterator; FlexibleSparseMatrix() = default; FlexibleSparseMatrix(index_type rows); void reserveInRow(index_type row, index_type numberOfElements); row_type& getRow(index_type); row_type const& getRow(index_type) const; index_type getNumberOfRows() const; private: std::vector data; }; template class SparseSccModelChecker { public: static ValueType computeReachabilityProbability(storm::models::Dtmc const& dtmc, std::shared_ptr> const& filterFormula); static ValueType computeReachabilityProbability(storm::storage::SparseMatrix const& transitionMatrix, std::vector& oneStepProbabilities, storm::storage::SparseMatrix const& backwardTransitions, storm::storage::BitVector const& initialStates, storm::storage::BitVector const& phiStates, storm::storage::BitVector const& psiStates, boost::optional> const& distances = {}); private: static uint_fast64_t treatScc(FlexibleSparseMatrix& matrix, std::vector& oneStepProbabilities, storm::storage::BitVector const& entryStates, storm::storage::BitVector const& scc, storm::storage::SparseMatrix const& forwardTransitions, FlexibleSparseMatrix& backwardTransitions, bool eliminateEntryStates, uint_fast64_t level, uint_fast64_t maximalSccSize, std::vector& entryStateQueue, storm::utility::ConstantsComparator const& comparator, boost::optional> const& distances); static FlexibleSparseMatrix getFlexibleSparseMatrix(storm::storage::SparseMatrix const& matrix, bool setAllValuesToOne = false); static void eliminateState(FlexibleSparseMatrix& matrix, std::vector& oneStepProbabilities, uint_fast64_t state, FlexibleSparseMatrix& backwardTransitions); static bool eliminateStateInPlace(storm::storage::SparseMatrix& matrix, std::vector& oneStepProbabilities, uint_fast64_t state, storm::storage::SparseMatrix& backwardTransitions); }; } // namespace reachability } // namespace modelchecker } // namespace storm #endif /* STORM_MODELCHECKER_REACHABILITY_SPARSESCCMODELCHECKER_H_ */