From 75ac1a3e258e6501d12c1f1c31d740a631cfe6f6 Mon Sep 17 00:00:00 2001 From: Sebastian Junges Date: Fri, 19 Jan 2018 14:23:38 +0100 Subject: [PATCH] get state reward directly --- src/storage/model.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/storage/model.cpp b/src/storage/model.cpp index 167e003..e2c82fd 100644 --- a/src/storage/model.cpp +++ b/src/storage/model.cpp @@ -156,6 +156,7 @@ void define_model(py::module& m) { .def_property_readonly("has_transition_rewards", &RewardModel::hasTransitionRewards) .def_property_readonly("transition_rewards", [](RewardModel& rewardModel) {return rewardModel.getTransitionRewardMatrix();}) .def_property_readonly("state_rewards", [](RewardModel& rewardModel) {return rewardModel.getStateRewardVector();}) + .def("get_state_reward", [](RewardModel& rewardModel, uint64_t state) {return rewardModel.getStateReward(state);}) .def_property_readonly("state_action_rewards", [](RewardModel& rewardModel) {return rewardModel.getStateActionRewardVector();}) .def("reduce_to_state_based_rewards", [](RewardModel& rewardModel, SparseMatrix const& transitions, bool onlyStateRewards){return rewardModel.reduceToStateBasedRewards(transitions, onlyStateRewards);}, py::arg("transition_matrix"), py::arg("only_state_rewards"), "Reduce to state-based rewards") ; @@ -201,6 +202,7 @@ void define_model(py::module& m) { .def_property_readonly("has_transition_rewards", &RewardModel::hasTransitionRewards) .def_property_readonly("transition_rewards", [](RewardModel& rewardModel) {return rewardModel.getTransitionRewardMatrix();}) .def_property_readonly("state_rewards", [](RewardModel& rewardModel) {return rewardModel.getStateRewardVector();}) + .def("get_state_reward", [](RewardModel& rewardModel, uint64_t state) {return rewardModel.getStateReward(state);}) .def_property_readonly("state_action_rewards", [](RewardModel& rewardModel) {return rewardModel.getStateActionRewardVector();}) .def("reduce_to_state_based_rewards", [](RewardModel& rewardModel, SparseMatrix const& transitions, bool onlyStateRewards){return rewardModel.reduceToStateBasedRewards(transitions, onlyStateRewards);}, py::arg("transition_matrix"), py::arg("only_state_rewards"), "Reduce to state-based rewards") ;