Storm
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
SparseInfiniteHorizonHelper.h
Go to the documentation of this file.
1#pragma once
3
8
9namespace storm {
10class Environment;
11
12namespace models {
13namespace sparse {
14template<typename VT>
15class StandardRewardModel;
16}
17} // namespace models
18
19namespace modelchecker {
20namespace helper {
21
27template<typename ValueType, bool Nondeterministic>
28class SparseInfiniteHorizonHelper : public SingleValueModelCheckerHelper<ValueType, storm::models::ModelRepresentation::Sparse> {
29 public:
34 typename std::conditional<Nondeterministic, storm::storage::MaximalEndComponent, storm::storage::StronglyConnectedComponent>::type;
35
39 typedef std::function<ValueType(uint64_t)> ValueGetter;
40
45
50 std::vector<ValueType> const& exitRates);
51
55 SparseInfiniteHorizonHelper(storm::storage::SparseMatrix<ValueType> const& transitionMatrix, std::vector<ValueType> const& exitRates);
56
63
70
75 std::vector<ValueType> computeLongRunAverageProbabilities(Environment const& env, storm::storage::BitVector const& psiStates);
76
81 std::vector<ValueType> computeLongRunAverageRewards(Environment const& env, storm::models::sparse::StandardRewardModel<ValueType> const& rewardModel);
82
89 std::vector<ValueType> computeLongRunAverageValues(Environment const& env, std::vector<ValueType> const* stateValues = nullptr,
90 std::vector<ValueType> const* actionValues = nullptr);
91
98 std::vector<ValueType> computeLongRunAverageValues(Environment const& env, ValueGetter const& stateValuesGetter, ValueGetter const& actionValuesGetter);
99
107 virtual ValueType computeLraForComponent(Environment const& env, ValueGetter const& stateValuesGetter, ValueGetter const& actionValuesGetter,
108 LongRunComponentType const& component) = 0;
109
110 protected:
114 bool isContinuousTime() const;
115
120
124 virtual void createDecomposition() = 0;
125
133 virtual std::vector<ValueType> buildAndSolveSsp(Environment const& env, std::vector<ValueType> const& mecLraValues) = 0;
134
137 std::vector<ValueType> const* _exitRates;
138
141 std::unique_ptr<storm::storage::SparseMatrix<ValueType>> _computedBackwardTransitions;
142 std::unique_ptr<storm::storage::Decomposition<LongRunComponentType>> _computedLongRunComponentDecomposition;
143
144 boost::optional<std::vector<uint64_t>> _producedOptimalChoices;
145};
146
147} // namespace helper
148} // namespace modelchecker
149} // namespace storm
Helper for model checking queries where we are interested in (optimizing) a single value per state.
Helper class for model checking queries that depend on the long run behavior of the (nondeterministic...
virtual ValueType computeLraForComponent(Environment const &env, ValueGetter const &stateValuesGetter, ValueGetter const &actionValuesGetter, LongRunComponentType const &component)=0
void provideBackwardTransitions(storm::storage::SparseMatrix< ValueType > const &backwardsTransitions)
Provides backward transitions that can be used during the computation.
std::vector< ValueType > computeLongRunAverageRewards(Environment const &env, storm::models::sparse::StandardRewardModel< ValueType > const &rewardModel)
Computes the long run average rewards, i.e., the average reward collected per time unit.
std::function< ValueType(uint64_t)> ValueGetter
Function mapping from indices to values.
void provideLongRunComponentDecomposition(storm::storage::Decomposition< LongRunComponentType > const &decomposition)
Provides the decomposition into long run components (BSCCs/MECs) that can be used during the computat...
storm::storage::SparseMatrix< ValueType > const * _backwardTransitions
storm::storage::SparseMatrix< ValueType > const & _transitionMatrix
virtual std::vector< ValueType > buildAndSolveSsp(Environment const &env, std::vector< ValueType > const &mecLraValues)=0
storm::storage::Decomposition< LongRunComponentType > const * _longRunComponentDecomposition
typename std::conditional< Nondeterministic, storm::storage::MaximalEndComponent, storm::storage::StronglyConnectedComponent >::type LongRunComponentType
The type of a component in which the system resides in the long run (BSCC for deterministic models,...
std::vector< ValueType > computeLongRunAverageProbabilities(Environment const &env, storm::storage::BitVector const &psiStates)
Computes the long run average probabilities, i.e., the fraction of the time we are in a psiState.
std::vector< ValueType > computeLongRunAverageValues(Environment const &env, std::vector< ValueType > const *stateValues=nullptr, std::vector< ValueType > const *actionValues=nullptr)
Computes the long run average value given the provided state and action-based rewards.
std::unique_ptr< storm::storage::Decomposition< LongRunComponentType > > _computedLongRunComponentDecomposition
boost::optional< std::vector< uint64_t > > _producedOptimalChoices
std::unique_ptr< storm::storage::SparseMatrix< ValueType > > _computedBackwardTransitions
A bit vector that is internally represented as a vector of 64-bit values.
Definition BitVector.h:18
This class represents the decomposition of a model into blocks which are of the template type.
A class that holds a possibly non-square matrix in the compressed row storage format.
LabParser.cpp.
Definition cli.cpp:18