#pragma once #include #include namespace storm { namespace storage { class BitVector; template class SparseMatrix; template class MaximalEndComponentDecomposition; template class Scheduler; } namespace modelchecker { namespace helper { template class SparseMdpEndComponentInformation { public: SparseMdpEndComponentInformation(storm::storage::MaximalEndComponentDecomposition const& endComponentDecomposition, storm::storage::BitVector const& maybeStates); bool isMaybeStateInEc(uint64_t maybeState) const; bool isStateInEc(uint64_t state) const; /*! * Retrieves for each maybe state the number of maybe states not contained in ECs with an index smaller * than the requested one. */ std::vector const& getNumberOfMaybeStatesNotInEcBeforeIndices() const; /*! * Retrieves the total number of maybe states on in ECs. */ uint64_t getNumberOfMaybeStatesNotInEc() const; /*! * Retrieves the EC of the state (result may be NOT_IN_EC). */ uint64_t getEc(uint64_t state) const; /*! * Retrieves the row group of the state after end component elimination. */ uint64_t getRowGroupAfterElimination(uint64_t state) const; bool getEliminatedEndComponents() const; uint64_t getNotInEcMarker() const; static SparseMdpEndComponentInformation eliminateEndComponents(storm::storage::MaximalEndComponentDecomposition const& endComponentDecomposition, storm::storage::SparseMatrix const& transitionMatrix, storm::storage::BitVector const& maybeStates, storm::storage::BitVector const* sumColumns, storm::storage::BitVector const* selectedChoices, std::vector const* summand, storm::storage::SparseMatrix& submatrix, std::vector* columnSumVector, std::vector* summandResultVector, bool gatherExitChoices = false); static SparseMdpEndComponentInformation eliminateEndComponents(storm::storage::MaximalEndComponentDecomposition const& endComponentDecomposition, storm::storage::SparseMatrix const& transitionMatrix, std::vector& rhsVector, storm::storage::BitVector const& maybeStates, storm::storage::SparseMatrix& submatrix, std::vector& subvector, bool gatherExitChoices = false); void setValues(std::vector& result, storm::storage::BitVector const& maybeStates, std::vector const& fromResult); void setScheduler(storm::storage::Scheduler& scheduler, storm::storage::BitVector const& maybeStates, storm::storage::SparseMatrix const& transitionMatrix, storm::storage::SparseMatrix const& backwardTransitions, std::vector const& fromResult); private: // A constant that marks that a state is not contained in any EC. uint64_t NOT_IN_EC; // A flag storing whether end components have been eliminated. bool eliminatedEndComponents; // Data about end components. std::vector maybeStatesBefore; std::vector maybeStatesNotInEcBefore; uint64_t numberOfMaybeStatesInEc; uint64_t numberOfMaybeStatesNotInEc; uint64_t numberOfEc; std::vector maybeStateToEc; std::vector> ecToExitChoicesBefore; // Only available, if gatherExitChoices was enabled. Empty otherwise. }; } } }