Storm 2.0.0.3
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
ReachabilityRewardTransformer.cpp
Go to the documentation of this file.
2
6
7namespace storm::modelchecker {
8
9template<typename ValueType>
14
15template<typename ValueType>
21
22template<typename ValueType>
24 std::vector<ValueType> const& actionRewards) {
25 STORM_LOG_ASSERT(transitionMatrix.hasTrivialRowGrouping(), "Transition matrix has non-trivial row grouping but no optimization direction is given.");
26
27 // As usual for reachability rewards, the reward is infinite if the target is not reached with probability one (even if all rewards are zero).
28 StateSet allStates(transitionMatrix.getRowGroupCount(), true);
29 auto infStates = storm::utility::graph::performProb1(backwardTransitionCache.get(), allStates, targetStates);
30 infStates.complement();
31 return TotalRewardSpecification<ValueType>{.terminalStates = targetStates | infStates,
32 .terminalStateValues = {{storm::utility::positiveInfinity<ValueType>(), std::move(infStates)}},
33 .terminalStatesUniversallyAlmostSurelyReached = true,
34 .actionRewards = actionRewards};
35}
36
37template<typename ValueType>
39 StateSet const& targetStates,
40 std::vector<ValueType> const& actionRewards) {
41 if (!dir.has_value()) {
42 return transform(targetStates, actionRewards);
43 }
44 // As usual for reachability rewards, the reward is infinite if the target is not reached with probability one (even if all rewards are zero).
45 // For minimizing (maximizing), this considers whether there is a scheduler (whether all schedulers) that reach the target with probability one.
46 StateSet allStates(transitionMatrix.getRowGroupCount(), true);
48 backwardTransitionCache.get(), allStates, targetStates)
50 backwardTransitionCache.get(), allStates, targetStates);
51 infStates.complement();
52 return TotalRewardSpecification<ValueType>{.terminalStates = targetStates | infStates,
53 .terminalStateValues = {{storm::utility::positiveInfinity<ValueType>(), std::move(infStates)}},
54 .terminalStatesUniversallyAlmostSurelyReached = storm::solver::maximize(*dir),
55 .actionRewards = actionRewards};
56}
57
60
61} // namespace storm::modelchecker
storm::storage::SparseMatrix< ValueType > const & transitionMatrix
storm::storage::BackwardTransitionCache< ValueType > backwardTransitionCache
TotalRewardSpecification< ValueType > transform(StateSet const &targetStates, std::vector< ValueType > const &actionRewards)
ReachabilityRewardTransformer(storm::storage::SparseMatrix< ValueType > const &transitionMatrix)
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 maximize(OptimizationDirection d)
bool constexpr minimize(OptimizationDirection d)
storm::storage::BitVector performProb1A(storm::models::sparse::NondeterministicModel< T, RM > const &model, storm::storage::SparseMatrix< T > const &backwardTransitions, storm::storage::BitVector const &phiStates, storm::storage::BitVector const &psiStates)
Computes the sets of states that have probability 1 of satisfying phi until psi under all possible re...
Definition graph.cpp:1019
storm::storage::BitVector performProb1(storm::storage::SparseMatrix< T > const &backwardTransitions, storm::storage::BitVector const &, storm::storage::BitVector const &psiStates, storm::storage::BitVector const &statesWithProbabilityGreater0)
Computes the set of states of the given model for which all paths lead to the given set of target sta...
Definition graph.cpp:377
storm::storage::BitVector performProb1E(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, boost::optional< storm::storage::BitVector > const &choiceConstraint)
Computes the sets of states that have probability 1 of satisfying phi until psi under at least one po...
Definition graph.cpp:740
ExtendedValueType< ValueType > positiveInfinity()
Specifies a total reward query: The goal is to compute (bounds on) the optimal total reward that is c...