16template<
typename CValueType>
28 StandardRewardModel(std::optional<std::vector<ValueType>>
const& optionalStateRewardVector = std::nullopt,
29 std::optional<std::vector<ValueType>>
const& optionalStateActionRewardVector = std::nullopt,
40 std::optional<std::vector<ValueType>>&& optionalStateActionRewardVector = std::nullopt,
131 template<
typename MatrixValueType>
177 template<
typename MatrixValueType>
190 template<
typename MatrixValueType>
193 MatrixValueType
const& stateRewardWeight = storm::utility::one<MatrixValueType>(),
194 MatrixValueType
const& actionRewardWeight = storm::utility::one<MatrixValueType>())
const;
234 template<
typename MatrixValueType>
236 std::vector<MatrixValueType>
const* weights =
nullptr);
245 template<
typename MatrixValueType>
256 template<
typename MatrixValueType>
258 std::vector<MatrixValueType>
const& weights)
const;
269 template<
typename MatrixValueType>
282 template<
typename MatrixValueType>
284 std::vector<MatrixValueType>
const& stateRewardWeights)
const;
292 template<
typename MatrixValueType>
299 template<
typename MatrixValueType>
301 std::function<
bool(
ValueType const&)>
const& filter)
const;
309 template<
typename MatrixValueType>
316 template<
typename MatrixValueType>
318 std::function<
bool(
ValueType const&)>
const& filter)
const;
345 bool isCompatible(uint_fast64_t nrStates, uint_fast64_t nrChoices)
const;
347 std::size_t
hash()
const;
349 template<
typename ValueTypePrime>
354 std::optional<std::vector<ValueType>> optionalStateRewardVector;
357 std::optional<std::vector<ValueType>> optionalStateActionRewardVector;
360 std::optional<storm::storage::SparseMatrix<ValueType>> optionalTransitionRewardMatrix;
363template<
typename ValueType>
Helper class that optionally holds a reference to an object of type T.
storm::storage::SparseMatrix< ValueType > const & getTransitionRewardMatrix() const
Retrieves the transition rewards of the reward model.
bool hasTransitionRewards() const
Retrieves whether the reward model has transition rewards.
StandardRewardModel & operator=(StandardRewardModel< ValueType > const &other)=default
friend std::ostream & operator<<(std::ostream &out, StandardRewardModel< ValueTypePrime > const &rewardModel)
StandardRewardModel< ValueType > restrictActions(storm::storage::BitVector const &enabledActions) const
Creates a new reward model by restricting the actions of the action-based rewards.
std::optional< storm::storage::SparseMatrix< ValueType > > const & getOptionalTransitionRewardMatrix() const
Retrieves an optional value that contains the transition reward matrix if there is one.
void setStateReward(uint_fast64_t state, T const &newReward)
bool hasOnlyStateRewards() const
Retrieves whether the reward model only has state rewards (and hence no other rewards).
std::vector< ValueType > getTotalActionRewardVector(storm::storage::SparseMatrix< MatrixValueType > const &transitionMatrix, std::vector< MatrixValueType > const &stateRewardWeights) const
Creates a vector representing the complete action-based rewards, i.e., state-action- and transition-b...
StandardRewardModel(StandardRewardModel< ValueType > const &other)=default
ValueType const & getStateReward(uint_fast64_t state) const
std::optional< std::vector< ValueType > > const & getOptionalStateRewardVector() const
Retrieves an optional value that contains the state reward vector if there is one.
std::vector< ValueType > const & getStateActionRewardVector() const
Retrieves the state-action rewards of the reward model.
std::vector< ValueType > const & getStateRewardVector() const
Retrieves the state rewards of the reward model.
storm::storage::BitVector getStatesWithZeroReward(storm::storage::SparseMatrix< MatrixValueType > const &transitionMatrix) const
Returns the set of states at which a all rewards (state-, action- and transition-rewards) are zero.
void clearRewardAtState(uint_fast64_t state, storm::storage::SparseMatrix< MatrixValueType > const &transitions)
Sets all available rewards at this state to zero.
ValueType const & getStateActionReward(uint_fast64_t choiceIndex) const
Retrieves the state-action reward for the given choice.
bool empty() const
Retrieves whether the reward model is empty, i.e.
ValueType getStateActionAndTransitionReward(uint_fast64_t choiceIndex, storm::storage::SparseMatrix< MatrixValueType > const &transitionMatrix) const
bool isCompatible(uint_fast64_t nrStates, uint_fast64_t nrChoices) const
Checks whether the reward model is compatible with key model characteristics.
std::vector< ValueType > getTotalRewardVector(storm::storage::SparseMatrix< MatrixValueType > const &transitionMatrix) const
Creates a vector representing the complete reward vector based on the state-, state-action- and trans...
void reduceToStateBasedRewards(storm::storage::SparseMatrix< MatrixValueType > const &transitionMatrix, bool reduceToStateRewards=false, std::vector< MatrixValueType > const *weights=nullptr)
Reduces the transition-based rewards to state-action rewards by taking the average of each row.
ValueType getTotalStateActionReward(uint_fast64_t stateIndex, uint_fast64_t choiceIndex, storm::storage::SparseMatrix< MatrixValueType > const &transitionMatrix, MatrixValueType const &stateRewardWeight=storm::utility::one< MatrixValueType >(), MatrixValueType const &actionRewardWeight=storm::utility::one< MatrixValueType >()) const
Retrieves the total reward for the given state action pair (including (scaled) state rewards,...
StandardRewardModel & operator=(StandardRewardModel< ValueType > &&other)=default
bool hasStateRewards() const
Retrieves whether the reward model has state rewards.
bool hasStateActionRewards() const
Retrieves whether the reward model has state-action rewards.
storm::storage::BitVector getChoicesWithZeroReward(storm::storage::SparseMatrix< MatrixValueType > const &transitionMatrix) const
Returns the set of choices at which all rewards (state-, action- and transition-rewards) are zero.
bool isAllZero() const
Retrieves whether every reward defined by this reward model is zero.
storm::storage::BitVector getChoicesWithFilter(storm::storage::SparseMatrix< MatrixValueType > const &transitionMatrix, std::function< bool(ValueType const &)> const &filter) const
Returns the set of choices for which all associated rewards (state, action or transition rewards) sat...
StandardRewardModel(StandardRewardModel< ValueType > &&other)=default
void setStateActionReward(uint_fast64_t choiceIndex, T const &newValue)
Sets the state-action reward for the given choice.
storm::storage::BitVector getStatesWithFilter(storm::storage::SparseMatrix< MatrixValueType > const &transitionMatrix, std::function< bool(ValueType const &)> const &filter) const
Returns the set of states for which all associated rewards (state, action or transition rewards) sati...
StandardRewardModel< ValueType > permuteActions(std::vector< uint64_t > const &inversePermutation) const
Creates a new reward model by permuting the actions.
StandardRewardModel< ValueType > permuteStates(std::vector< uint64_t > const &inversePermutation, storm::OptionalRef< std::vector< uint64_t > const > rowGroupIndices=storm::NullRef, storm::OptionalRef< std::vector< uint64_t > const > permutation=storm::NullRef) const
Creates a new reward model by permuting the states.
std::optional< std::vector< ValueType > > const & getOptionalStateActionRewardVector() const
Retrieves an optional value that contains the state-action reward vector if there is one.
A bit vector that is internally represented as a vector of 64-bit values.
A class that holds a possibly non-square matrix in the compressed row storage format.
std::set< storm::RationalFunctionVariable > getRewardModelParameters(StandardRewardModel< storm::RationalFunction > const &rewModel)
std::ostream & operator<<(std::ostream &out, ChoiceLabeling const &labeling)
constexpr NullRefType NullRef