Storm 1.11.1.1
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
StandardRewardModel.h
Go to the documentation of this file.
1#pragma once
2
3#include <boost/optional.hpp>
4#include <set>
5
7
8namespace storm {
9namespace dd {
10template<storm::dd::DdType Type, typename ValueType>
11class Add;
12
13template<storm::dd::DdType Type>
14class Bdd;
15} // namespace dd
16
17namespace expressions {
18class Variable;
19}
20
21namespace models {
22namespace symbolic {
23
24template<storm::dd::DdType Type, typename ValueType>
26 public:
34 explicit StandardRewardModel(boost::optional<storm::dd::Add<Type, ValueType>> const& stateRewardVector,
35 boost::optional<storm::dd::Add<Type, ValueType>> const& stateActionRewardVector,
36 boost::optional<storm::dd::Add<Type, ValueType>> const& transitionRewardMatrix);
37
43 bool empty() const;
44
50 bool hasStateRewards() const;
51
57 bool hasOnlyStateRewards() const;
58
66
74
80 boost::optional<storm::dd::Add<Type, ValueType>> const& getOptionalStateRewardVector() const;
81
87 bool hasStateActionRewards() const;
88
96
104
110 boost::optional<storm::dd::Add<Type, ValueType>> const& getOptionalStateActionRewardVector() const;
111
117 bool hasTransitionRewards() const;
118
126
134
140 boost::optional<storm::dd::Add<Type, ValueType>> const& getOptionalTransitionRewardMatrix() const;
141
151 std::set<storm::expressions::Variable> const& columnVariables) const;
152
164 storm::dd::Add<Type, ValueType> const& transitionMatrix,
165 std::set<storm::expressions::Variable> const& columnVariables) const;
166
179 storm::dd::Add<Type, ValueType> const& choiceFilterAdd,
180 storm::dd::Add<Type, ValueType> const& transitionMatrix,
181 std::set<storm::expressions::Variable> const& columnVariables) const;
182
195 std::set<storm::expressions::Variable> const& columnVariables,
196 storm::dd::Add<Type, ValueType> const& weights, bool scaleTransAndActions) const;
197
204
212
221 void reduceToStateBasedRewards(storm::dd::Add<Type, ValueType> const& transitionMatrix, std::set<storm::expressions::Variable> const& rowVariables,
222 std::set<storm::expressions::Variable> const& columnVariables, bool reduceToStateRewards);
223
224 template<typename NewValueType>
226
227 private:
228 // The state reward vector.
229 boost::optional<storm::dd::Add<Type, ValueType>> optionalStateRewardVector;
230
231 // A vector of state-action-based rewards.
232 boost::optional<storm::dd::Add<Type, ValueType>> optionalStateActionRewardVector;
233
234 // A matrix of transition rewards.
235 boost::optional<storm::dd::Add<Type, ValueType>> optionalTransitionRewardMatrix;
236};
237
238} // namespace symbolic
239} // namespace models
240} // namespace storm
boost::optional< storm::dd::Add< Type, ValueType > > const & getOptionalStateRewardVector() const
Retrieves an optional value that contains the state reward vector if there is one.
storm::dd::Add< Type, ValueType > const & getStateActionRewardVector() const
Retrieves the state-action rewards of the reward model.
boost::optional< storm::dd::Add< Type, ValueType > > const & getOptionalStateActionRewardVector() const
Retrieves an optional value that contains the state-action reward vector if there is one.
bool hasOnlyStateRewards() const
Retrieves whether the reward model only has state rewards (and hence no other rewards).
void reduceToStateBasedRewards(storm::dd::Add< Type, ValueType > const &transitionMatrix, std::set< storm::expressions::Variable > const &rowVariables, std::set< storm::expressions::Variable > const &columnVariables, bool reduceToStateRewards)
Reduces the transition-based rewards to state-action rewards by taking the average of each row.
bool hasStateRewards() const
Retrieves whether the reward model has state rewards.
storm::dd::Add< Type, ValueType > getTotalRewardVector(storm::dd::Add< Type, ValueType > const &transitionMatrix, std::set< storm::expressions::Variable > const &columnVariables) const
Creates a vector representing the complete reward vector based on the state-, state-action- and trans...
storm::dd::Add< Type, ValueType > const & getTransitionRewardMatrix() const
Retrieves the transition rewards of the reward model.
bool empty() const
Retrieves whether the reward model is empty.
storm::dd::Add< Type, ValueType > const & getStateRewardVector() const
Retrieves the state rewards of the reward model.
bool hasStateActionRewards() const
Retrieves whether the reward model has state-action rewards.
boost::optional< storm::dd::Add< Type, ValueType > > const & getOptionalTransitionRewardMatrix() const
Retrieves an optional value that contains the transition reward matrix if there is one.
StandardRewardModel< Type, ValueType > & operator*=(storm::dd::Add< Type, ValueType > const &filter)
Multiplies all components of the reward model with the given DD.
bool hasTransitionRewards() const
Retrieves whether the reward model has transition rewards.
StandardRewardModel< Type, ValueType > divideStateRewardVector(storm::dd::Add< Type, ValueType > const &divisor) const
Divides the state reward vector of the reward model by the given divisor.
StandardRewardModel< Type, NewValueType > toValueType() const