6 std::vector<storm::prism::StateActionReward>
const& stateActionRewards,
7 std::vector<storm::prism::TransitionReward>
const& transitionRewards, std::string
const& filename, uint_fast64_t lineNumber)
9 rewardModelName(rewardModelName),
10 stateRewards(stateRewards),
11 stateActionRewards(stateActionRewards),
12 transitionRewards(transitionRewards) {
17 return this->rewardModelName;
25 return !this->stateRewards.empty();
29 return this->stateRewards;
33 return !this->stateActionRewards.empty();
37 return this->stateActionRewards;
41 return !this->transitionRewards.empty();
45 return this->transitionRewards;
49 std::vector<StateReward> newStateRewards;
52 newStateRewards.emplace_back(stateReward.substitute(substitution));
55 std::vector<StateActionReward> newStateActionRewards;
58 newStateActionRewards.emplace_back(stateActionReward.substitute(substitution));
61 std::vector<TransitionReward> newTransitionRewards;
64 newTransitionRewards.emplace_back(transitionReward.substitute(substitution));
71 if (stateReward.getStatePredicateExpression().containsVariable(undefinedConstantVariables)) {
76 if (stateActionReward.getStatePredicateExpression().containsVariable(undefinedConstantVariables)) {
81 if (transitionReward.getSourceStatePredicateExpression().containsVariable(undefinedConstantVariables)) {
84 if (transitionReward.getTargetStatePredicateExpression().containsVariable(undefinedConstantVariables)) {
92 std::vector<StateActionReward> newStateActionRewards;
94 if (actionIndicesToKeep.find(stateActionReward.getActionIndex()) != actionIndicesToKeep.end()) {
95 newStateActionRewards.emplace_back(stateActionReward);
99 std::vector<TransitionReward> newTransitionRewards;
101 if (actionIndicesToKeep.find(transitionReward.getActionIndex()) != actionIndicesToKeep.end()) {
102 newTransitionRewards.emplace_back(transitionReward);
110 std::vector<StateActionReward> newStateActionRewards;
111 std::vector<TransitionReward> newTransitionRewards;
114 if (reward.getActionIndex() == 0) {
115 for (
auto const& newAction : newActions) {
116 newStateActionRewards.emplace_back(newAction.first, newAction.second, reward.getStatePredicateExpression(), reward.getRewardValueExpression(),
117 reward.getFilename(), reward.getLineNumber());
120 newStateActionRewards.push_back(reward);
124 assert(transitionRewards.empty());
131 if (rewardModel.
getName() !=
"") {
132 stream <<
" \"" << rewardModel.
getName() <<
"\"";
136 stream << reward <<
'\n';
139 stream << reward <<
'\n';
142 stream << reward <<
'\n';
144 stream <<
"endrewards\n";
std::vector< storm::prism::StateReward > const & getStateRewards() const
Retrieves all state rewards associated with this reward model.
bool hasStateRewards() const
Retrieves whether there are any state rewards.
RewardModel labelUnlabelledCommands(std::vector< std::pair< uint64_t, std::string > > const &newActionNames) const
RewardModel substitute(std::map< storm::expressions::Variable, storm::expressions::Expression > const &substitution) const
Substitutes all variables in the reward model according to the given map.
bool containsVariablesOnlyInRewardValueExpressions(std::set< storm::expressions::Variable > const &undefinedConstantVariables) const
Checks whether any of the given variables only appear in the expressions defining the reward value.
bool hasTransitionRewards() const
Retrieves whether there are any transition rewards.
RewardModel restrictActionRelatedRewards(storm::storage::FlatSet< uint_fast64_t > const &actionIndicesToKeep) const
Restricts all action-related rewards of the reward model to the ones with an action index in the prov...
std::vector< storm::prism::TransitionReward > const & getTransitionRewards() const
Retrieves all transition rewards associated with this reward model.
std::string const & getName() const
Retrieves the name of the reward model.
bool empty() const
Checks whether the reward model is empty, i.e.
bool hasStateActionRewards() const
Retrieves whether there are any state-action rewards.
std::vector< storm::prism::StateActionReward > const & getStateActionRewards() const
Retrieves all state-action rewards associated with this reward model.
std::ostream & operator<<(std::ostream &stream, Assignment const &assignment)
boost::container::flat_set< Key, std::less< Key >, boost::container::new_allocator< Key > > FlatSet
Redefinition of flat_set was needed, because from Boost 1.70 on the default allocator is set to void.