Skip to content

Commit

Permalink
skip missing state-action reward values when unfolding POMDPs
Browse files Browse the repository at this point in the history
  • Loading branch information
Roman Andriushchenko committed Jan 2, 2024
1 parent fe6f7a9 commit 5a86ee3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
9 changes: 6 additions & 3 deletions payntbind/src/synthesis/pomdp/PomdpManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -224,12 +224,11 @@ namespace storm {
components.transitionMatrix = this->constructTransitionMatrix();
// TODO remove unreachable states
components.stateLabeling = this->constructStateLabeling();
for (auto const& reward_model : pomdp.getRewardModels()) {
for (auto const& reward_model : this->pomdp.getRewardModels()) {
auto constructed = this->constructRewardModel(reward_model.second);
components.rewardModels.emplace(reward_model.first, constructed);
}
this->mdp = std::make_shared<storm::models::sparse::Mdp<ValueType>>(std::move(components));

this->buildDesignSpaceSpurious();

return this->mdp;
Expand Down Expand Up @@ -287,7 +286,11 @@ namespace storm {
std::optional<std::vector<ValueType>> state_rewards, action_rewards;
STORM_LOG_THROW(!reward_model.hasStateRewards(), storm::exceptions::NotSupportedException, "state rewards are currently not supported.");
STORM_LOG_THROW(!reward_model.hasTransitionRewards(), storm::exceptions::NotSupportedException, "transition rewards are currently not supported.");

if(not reward_model.hasStateActionRewards()) {
STORM_LOG_WARN("Reward model exists but has no state-action value vector associated with it.");
return storm::models::sparse::StandardRewardModel<ValueType>(std::move(state_rewards), std::move(action_rewards));
}

action_rewards = std::vector<ValueType>();
for(uint64_t row = 0; row < this->num_rows; row++) {
auto prototype = this->row_prototype[row];
Expand Down
6 changes: 5 additions & 1 deletion payntbind/src/synthesis/pomdp/PomdpManagerAposteriori.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,11 @@ namespace storm {
std::optional<std::vector<ValueType>> state_rewards, action_rewards;
STORM_LOG_THROW(!reward_model.hasStateRewards(), storm::exceptions::NotSupportedException, "state rewards are currently not supported.");
STORM_LOG_THROW(!reward_model.hasTransitionRewards(), storm::exceptions::NotSupportedException, "transition rewards are currently not supported.");

if(not reward_model.hasStateActionRewards()) {
STORM_LOG_WARN("Reward model exists but has no state-action value vector associated with it.");
return storm::models::sparse::StandardRewardModel<ValueType>(std::move(state_rewards), std::move(action_rewards));
}

action_rewards = std::vector<ValueType>();
for(uint64_t row = 0; row < this->row_prototype.size(); row++) {
auto prototype = this->row_prototype[row];
Expand Down

0 comments on commit 5a86ee3

Please sign in to comment.