Browse Source

modifying reward models

Former-commit-id: 401410cee6
tempestpy_adaptions
sjunges 9 years ago
parent
commit
7e7e025900
  1. 20
      src/models/sparse/NondeterministicModel.cpp
  2. 8
      src/models/sparse/NondeterministicModel.h

20
src/models/sparse/NondeterministicModel.cpp

@ -62,6 +62,24 @@ namespace storm {
}
}
}
template<typename ValueType, typename RewardModelType>
template<typename T>
void NondeterministicModel<ValueType, RewardModelType>::modifyStateActionRewards(std::string const& modelName, std::map<uint_fast64_t, T> const& modifications) {
RewardModelType& rewardModel = this->rewardModel(modelName);
for(auto const& mod : modifications) {
rewardModel.setStateActionReward(mod.first, mod.second);
}
};
template<typename ValueType, typename RewardModelType>
template<typename T>
void NondeterministicModel<ValueType, RewardModelType>::modifyStateRewards(std::string const& modelName, std::map<uint_fast64_t, T> const& modifications) {
RewardModelType& rewardModel = this->rewardModel(modelName);
for(auto const& mod : modifications) {
rewardModel.setStateReward(mod.first, mod.second);
}
};
template<typename ValueType, typename RewardModelType>
void NondeterministicModel<ValueType, RewardModelType>::reduceToStateBasedRewards() {
@ -152,6 +170,8 @@ namespace storm {
#ifdef STORM_HAVE_CARL
template class NondeterministicModel<double, storm::models::sparse::StandardRewardModel<storm::Interval>>;
template void NondeterministicModel<double, storm::models::sparse::StandardRewardModel<storm::Interval>>::modifyStateActionRewards(std::string const& modelName, std::map<uint_fast64_t, double> const& modifications);
template void NondeterministicModel<double, storm::models::sparse::StandardRewardModel<storm::Interval>>::modifyStateRewards(std::string const& modelName, std::map<uint_fast64_t, double> const& modifications);
template class NondeterministicModel<storm::RationalFunction>;
#endif

8
src/models/sparse/NondeterministicModel.h

@ -81,7 +81,13 @@ namespace storm {
* @param modifications A mapping from state-action pairs to the their new reward values.
*/
void modifyStateActionRewards(RewardModelType& rewardModel, std::map<std::pair<uint_fast64_t, LabelSet>, typename RewardModelType::ValueType> const& modifications) const;
template<typename T>
void modifyStateActionRewards(std::string const& modelName, std::map<uint_fast64_t, T> const& modifications);
template<typename T>
void modifyStateRewards(std::string const& modelName, std::map<uint_fast64_t, T> const& modifications);
virtual void reduceToStateBasedRewards() override;
virtual void printModelInformationToStream(std::ostream& out) const override;

Loading…
Cancel
Save