Storm 2.0.0.3
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
ReachabilityProbabilityToRewardTransformer.cpp
Go to the documentation of this file.
2
6
7namespace storm::modelchecker {
8
9template<typename ValueType>
15
16template<typename ValueType>
22
23template<typename ValueType>
25 storm::OptionalRef<StateSet const> constraintStates) {
26 STORM_LOG_ASSERT(transitionMatrix.hasTrivialRowGrouping(), "Transition matrix has non-trivial row grouping but no optimization direction is given.");
27 StateSet defaultConstraintStates;
28 if (!constraintStates.has_value()) {
29 defaultConstraintStates = StateSet(transitionMatrix.getRowGroupCount(), true);
30 constraintStates.reset(defaultConstraintStates);
31 }
32 auto [prob01States, prob1States] = storm::utility::graph::performProb01(backwardTransitionCache.get(), constraintStates.value(), targetStates);
33 prob01States |= prob1States;
34
35 return TotalRewardSpecification<ValueType>{std::move(prob01States),
37 true,
39}
40
41template<typename ValueType>
43 StateSet const& targetStates,
44 storm::OptionalRef<StateSet const> constraintStates) {
45 if (!dir.has_value()) {
46 return transform(targetStates, constraintStates);
47 }
48 StateSet defaultConstraintStates;
49 if (!constraintStates.has_value()) {
50 defaultConstraintStates = StateSet(transitionMatrix.getRowGroupCount(), true);
51 constraintStates.reset(defaultConstraintStates);
52 }
53
54 auto [prob01States, prob1States] = storm::solver::minimize(*dir)
56 backwardTransitionCache.get(), constraintStates.value(), targetStates)
58 backwardTransitionCache.get(), constraintStates.value(), targetStates);
59 prob01States |= prob1States;
60 return TotalRewardSpecification<ValueType>{std::move(prob01States),
64}
65
68
69} // namespace storm::modelchecker
Helper class that optionally holds a reference to an object of type T.
Definition OptionalRef.h:48
T & value()
Accesses the contained reference (if any).
bool has_value() const
Yields true iff this contains a reference.
void reset()
Unsets the reference.
ReachabilityProbabilityToRewardTransformer(storm::storage::SparseMatrix< ValueType > const &transitionMatrix)
TotalRewardSpecification< ValueType > transform(StateSet const &targetStates, storm::OptionalRef< StateSet const > constraintStates=storm::NullRef)
This class caches the backward transitions of a given forward transition matrix.
A class that holds a possibly non-square matrix in the compressed row storage format.
#define STORM_LOG_ASSERT(cond, message)
Definition macros.h:9
bool constexpr minimize(OptimizationDirection d)
std::pair< storm::storage::BitVector, storm::storage::BitVector > performProb01(storm::models::sparse::DeterministicModel< T > const &model, storm::storage::BitVector const &phiStates, storm::storage::BitVector const &psiStates)
Computes the sets of states that have probability 0 or 1, respectively, of satisfying phi until psi i...
Definition graph.cpp:394
std::pair< storm::storage::BitVector, storm::storage::BitVector > performProb01Max(storm::storage::SparseMatrix< T > const &transitionMatrix, std::vector< uint_fast64_t > const &nondeterministicChoiceIndices, storm::storage::SparseMatrix< T > const &backwardTransitions, storm::storage::BitVector const &phiStates, storm::storage::BitVector const &psiStates)
Definition graph.cpp:855
std::pair< storm::storage::BitVector, storm::storage::BitVector > performProb01Min(storm::storage::SparseMatrix< T > const &transitionMatrix, std::vector< uint_fast64_t > const &nondeterministicChoiceIndices, storm::storage::SparseMatrix< T > const &backwardTransitions, storm::storage::BitVector const &phiStates, storm::storage::BitVector const &psiStates)
Definition graph.cpp:1101
std::conditional_t< storm::NumberTraits< ValueType >::HasInfinity, ValueType, ExtendedNumber< ValueType > > ExtendedValueType
The type to use for values that may be infinite.
ValueType one()
Definition constants.cpp:21
constexpr NullRefType NullRef
Definition OptionalRef.h:31
Specifies a total reward query: The goal is to compute (bounds on) the optimal total reward that is c...