From a28ebac0228c9467846ba196e1aefc6b2557b608 Mon Sep 17 00:00:00 2001 From: sjunges Date: Tue, 29 Sep 2015 17:40:54 +0200 Subject: [PATCH] outcommented code for maximals Former-commit-id: 096fa39fea9079907af8c3c4c810eb6c1588c79b --- src/models/sparse/StandardRewardModel.cpp | 27 +++++++++++++++++++++++ src/models/sparse/StandardRewardModel.h | 6 +++++ 2 files changed, 33 insertions(+) diff --git a/src/models/sparse/StandardRewardModel.cpp b/src/models/sparse/StandardRewardModel.cpp index 8342a3aaf..a3c9eb491 100644 --- a/src/models/sparse/StandardRewardModel.cpp +++ b/src/models/sparse/StandardRewardModel.cpp @@ -67,6 +67,20 @@ namespace storm { this->optionalStateRewardVector.get()[state] = newReward; } +// template +// ValueType StandardRewardModel::maximalStateReward(uint_fast64_t state) const { +// assert(this->hasStateRewards()); +// assert(!this->optionalStateRewardVector.get().empty()); +// ValueType max = *(this->optionalStateRewardVector.get().begin()); +// for(auto const& entry : this->optionalStateRewardVector.get()) { +// if(entry > max) { +// max = entry; +// } +// } +// return max; +// } + + template bool StandardRewardModel::hasStateActionRewards() const { return static_cast(this->optionalStateActionRewardVector); @@ -99,6 +113,19 @@ namespace storm { this->optionalStateActionRewardVector.get()[choiceIndex] = newValue; } +// template +// ValueType StandardRewardModel::maximalStateActionReward() const { +// assert(this->hasStateActionRewards()); +// assert(!this->optionalStateActionRewardVector.get().empty()); +// ValueType max = *(this->optionalStateActionRewardVector.get().begin()); +// for(auto const& entry : this->optionalStateActionRewardVector.get()) { +// if(entry > max) { +// max = entry; +// } +// } +// return max; +// } + template boost::optional> const& StandardRewardModel::getOptionalStateActionRewardVector() const { return this->optionalStateActionRewardVector; diff --git a/src/models/sparse/StandardRewardModel.h b/src/models/sparse/StandardRewardModel.h index ae6e06bfe..fb8ba4658 100644 --- a/src/models/sparse/StandardRewardModel.h +++ b/src/models/sparse/StandardRewardModel.h @@ -79,6 +79,10 @@ namespace storm { template void setStateReward(uint_fast64_t state, T const& newReward); + + //template>> + //ValueType maximalStateReward(uint_fast64_t state) const; + /*! * Retrieves an optional value that contains the state reward vector if there is one. * @@ -120,6 +124,8 @@ namespace storm { template void setStateActionReward(uint_fast64_t choiceIndex, T const& newValue); + //ValueType maximalStateActionReward() const; + /*! * Retrieves an optional value that contains the state-action reward vector if there is one. *