12template<storm::dd::DdType Type,
typename ValueType>
16 : optionalStateRewardVector(stateRewardVector),
17 optionalStateActionRewardVector(stateActionRewardVector),
18 optionalTransitionRewardMatrix(transitionRewardMatrix) {
22template<storm::dd::DdType Type,
typename ValueType>
27template<storm::dd::DdType Type,
typename ValueType>
29 return static_cast<bool>(this->optionalStateRewardVector);
32template<storm::dd::DdType Type,
typename ValueType>
37template<storm::dd::DdType Type,
typename ValueType>
39 return this->optionalStateRewardVector.get();
42template<storm::dd::DdType Type,
typename ValueType>
44 return this->optionalStateRewardVector.get();
47template<storm::dd::DdType Type,
typename ValueType>
49 return this->optionalStateRewardVector;
52template<storm::dd::DdType Type,
typename ValueType>
54 return static_cast<bool>(this->optionalStateActionRewardVector);
57template<storm::dd::DdType Type,
typename ValueType>
59 return this->optionalStateActionRewardVector.get();
62template<storm::dd::DdType Type,
typename ValueType>
64 return this->optionalStateActionRewardVector.get();
67template<storm::dd::DdType Type,
typename ValueType>
69 return this->optionalStateActionRewardVector;
72template<storm::dd::DdType Type,
typename ValueType>
74 return static_cast<bool>(this->optionalTransitionRewardMatrix);
77template<storm::dd::DdType Type,
typename ValueType>
79 return this->optionalTransitionRewardMatrix.get();
82template<storm::dd::DdType Type,
typename ValueType>
84 return this->optionalTransitionRewardMatrix.get();
87template<storm::dd::DdType Type,
typename ValueType>
89 return this->optionalTransitionRewardMatrix;
92template<storm::dd::DdType Type,
typename ValueType>
95 std::set<storm::expressions::Variable>
const& columnVariables)
const {
98 result += filterAdd * optionalStateRewardVector.get();
101 result += filterAdd * optionalStateActionRewardVector.get();
109template<storm::dd::DdType Type,
typename ValueType>
115 result += stateFilterAdd * choiceFilterAdd * optionalStateRewardVector.get();
118 result += choiceFilterAdd * optionalStateActionRewardVector.get();
126template<storm::dd::DdType Type,
typename ValueType>
131 result += optionalStateRewardVector.get();
134 result += optionalStateActionRewardVector.get();
142template<storm::dd::DdType Type,
typename ValueType>
144 std::set<storm::expressions::Variable>
const& columnVariables,
146 bool scaleTransAndActions)
const {
149 result += optionalStateRewardVector.get();
152 result += optionalStateActionRewardVector.get() * weights;
155 if (scaleTransAndActions) {
164template<storm::dd::DdType Type,
typename ValueType>
167 this->optionalStateRewardVector.get() *= filter;
170 this->optionalStateActionRewardVector.get() *= filter;
173 this->optionalTransitionRewardMatrix.get() *= filter;
179template<storm::dd::DdType Type,
typename ValueType>
181 boost::optional<storm::dd::Add<Type, ValueType>> modifiedStateRewardVector;
183 modifiedStateRewardVector = this->optionalStateRewardVector.get() / divisor;
188template<storm::dd::DdType Type,
typename ValueType>
190 std::set<storm::expressions::Variable>
const& rowVariables,
191 std::set<storm::expressions::Variable>
const& columnVariables,
bool reduceToStateRewards) {
195 this->optionalTransitionRewardMatrix = boost::none;
203 "The reduction to state rewards is only possible if the state-action rewards do not depend on nondeterminism variables.");
209 this->optionalStateActionRewardVector = boost::none;
213template<storm::dd::DdType Type,
typename ValueType>
214template<
typename NewValueType>
Add< LibraryType, ValueType > multiplyMatrix(Add< LibraryType, ValueType > const &otherMatrix, std::set< storm::expressions::Variable > const &summationMetaVariables) const
Multiplies the current ADD (representing a matrix) with the given matrix by summing over the given me...
DdManager< LibraryType > & getDdManager() const
Retrieves the manager that is responsible for this DD.
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
StandardRewardModel(boost::optional< storm::dd::Add< Type, ValueType > > const &stateRewardVector, boost::optional< storm::dd::Add< Type, ValueType > > const &stateActionRewardVector, boost::optional< storm::dd::Add< Type, ValueType > > const &transitionRewardMatrix)
Builds a reward model by copying with the given reward structures.
#define STORM_LOG_THROW(cond, exception, message)