diff --git a/src/models/sparse/StandardRewardModel.cpp b/src/models/sparse/StandardRewardModel.cpp index 762836ebb..8342a3aaf 100644 --- a/src/models/sparse/StandardRewardModel.cpp +++ b/src/models/sparse/StandardRewardModel.cpp @@ -58,7 +58,15 @@ namespace storm { assert(state < this->optionalStateRewardVector.get().size()); return this->optionalStateRewardVector.get()[state]; } - + + template + template + void StandardRewardModel::setStateReward(uint_fast64_t state, T const & newReward) { + assert(this->hasStateRewards()); + assert(state < this->optionalStateRewardVector.get().size()); + this->optionalStateRewardVector.get()[state] = newReward; + } + template bool StandardRewardModel::hasStateActionRewards() const { return static_cast(this->optionalStateActionRewardVector); @@ -267,6 +275,7 @@ namespace storm { template std::vector StandardRewardModel::getTotalRewardVector(storm::storage::SparseMatrix const& transitionMatrix, std::vector const& weights) const; template void StandardRewardModel::reduceToStateBasedRewards(storm::storage::SparseMatrix const& transitionMatrix, bool reduceToStateRewards); template void StandardRewardModel::setStateActionReward(uint_fast64_t choiceIndex, double const & newValue); + template void StandardRewardModel::setStateReward(uint_fast64_t state, double const & newValue); template class StandardRewardModel; template std::ostream& operator<<(std::ostream& out, StandardRewardModel const& rewardModel); @@ -275,6 +284,7 @@ namespace storm { template std::vector StandardRewardModel::getTotalRewardVector(storm::storage::SparseMatrix const& transitionMatrix, std::vector const& weights) const; template void StandardRewardModel::reduceToStateBasedRewards(storm::storage::SparseMatrix const& transitionMatrix, bool reduceToStateRewards); template void StandardRewardModel::setStateActionReward(uint_fast64_t choiceIndex, float const & newValue); + template void StandardRewardModel::setStateReward(uint_fast64_t state, float const & newValue); template class StandardRewardModel; template std::ostream& operator<<(std::ostream& out, StandardRewardModel const& rewardModel); @@ -284,6 +294,7 @@ namespace storm { template std::vector StandardRewardModel::getTotalRewardVector(storm::storage::SparseMatrix const& transitionMatrix, std::vector const& weights) const; template void StandardRewardModel::reduceToStateBasedRewards(storm::storage::SparseMatrix const& transitionMatrix, bool reduceToStateRewards); template void StandardRewardModel::setStateActionReward(uint_fast64_t choiceIndex, storm::RationalFunction const & newValue); + template void StandardRewardModel::setStateReward(uint_fast64_t state, storm::RationalFunction const & newValue); template class StandardRewardModel; template std::ostream& operator<<(std::ostream& out, StandardRewardModel const& rewardModel); @@ -292,6 +303,8 @@ namespace storm { template std::vector StandardRewardModel::getTotalRewardVector(storm::storage::SparseMatrix const& transitionMatrix, std::vector const& weights) const; template void StandardRewardModel::setStateActionReward(uint_fast64_t choiceIndex, double const & newValue); template void StandardRewardModel::setStateActionReward(uint_fast64_t choiceIndex, storm::Interval const & newValue); + template void StandardRewardModel::setStateReward(uint_fast64_t state, double const & newValue); + template void StandardRewardModel::setStateReward(uint_fast64_t state, storm::Interval const & newValue); template void StandardRewardModel::reduceToStateBasedRewards(storm::storage::SparseMatrix const& transitionMatrix, bool reduceToStateRewards); template class StandardRewardModel; template std::ostream& operator<<(std::ostream& out, StandardRewardModel const& rewardModel); diff --git a/src/models/sparse/StandardRewardModel.h b/src/models/sparse/StandardRewardModel.h index 64b63b36e..ae6e06bfe 100644 --- a/src/models/sparse/StandardRewardModel.h +++ b/src/models/sparse/StandardRewardModel.h @@ -76,7 +76,9 @@ namespace storm { std::vector& getStateRewardVector(); ValueType const& getStateReward(uint_fast64_t state) const; - + + template + void setStateReward(uint_fast64_t state, T const& newReward); /*! * Retrieves an optional value that contains the state reward vector if there is one. *