diff --git a/src/storage/labeling.cpp b/src/storage/labeling.cpp index 65ebe18..2ee7fc1 100644 --- a/src/storage/labeling.cpp +++ b/src/storage/labeling.cpp @@ -21,6 +21,7 @@ void define_labeling(py::module& m) { // StateLabeling py::class_>(m, "StateLabeling", "Labeling for states", labeling) + .def(py::init(), "state_count"_a) // todo tests .def("get_labels_of_state", &storm::models::sparse::StateLabeling::getLabelsOfState, "Get labels of given state", py::arg("state")) .def("add_label_to_state", &storm::models::sparse::StateLabeling::addLabelToState, "Add label to state", py::arg("label"), py::arg("state")) .def("has_state_label", &storm::models::sparse::StateLabeling::getStateHasLabel, "Check if the given state has the given label", py::arg("label"), py::arg("state")) @@ -32,6 +33,8 @@ void define_labeling(py::module& m) { ; - py::class_(m, "ChoiceLabeling", "Labeling for choices", labeling). - def("get_labels_of_choice", &storm::models::sparse::ChoiceLabeling::getLabelsOfChoice, py::arg("choice"), "get labels of a choice"); + py::class_(m, "ChoiceLabeling", "Labeling for choices", labeling) + .def(py::init(), "choice_count"_a) // todo tests + .def("get_labels_of_choice", &storm::models::sparse::ChoiceLabeling::getLabelsOfChoice, py::arg("choice"), "get labels of a choice") + ; } diff --git a/src/storage/model.cpp b/src/storage/model.cpp index 5739579..faae858 100644 --- a/src/storage/model.cpp +++ b/src/storage/model.cpp @@ -237,6 +237,9 @@ void define_sparse_model(py::module& m) { ; py::class_>(m, "SparseRewardModel", "Reward structure for sparse models") + .def(py::init> const&, boost::optional> const&, + boost::optional> const&>(), py::arg("optional_state_reward_vector") = boost::none, + py::arg("optional_state_action_reward_vector") = boost::none, py::arg("optional_transition_reward_matrix") = boost::none) // todo tests .def_property_readonly("has_state_rewards", &SparseRewardModel::hasStateRewards) .def_property_readonly("has_state_action_rewards", &SparseRewardModel::hasStateActionRewards) .def_property_readonly("has_transition_rewards", &SparseRewardModel::hasTransitionRewards) @@ -299,7 +302,6 @@ void define_sparse_model(py::module& m) { ; py::class_>(m, "SparseParametricRewardModel", "Reward structure for parametric sparse models") - //todo init? .def_property_readonly("has_state_rewards", &SparseRewardModel::hasStateRewards) .def_property_readonly("has_state_action_rewards", &SparseRewardModel::hasStateActionRewards) .def_property_readonly("has_transition_rewards", &SparseRewardModel::hasTransitionRewards) diff --git a/src/storage/valuation.cpp b/src/storage/valuation.cpp index b80980c..52f70d2 100644 --- a/src/storage/valuation.cpp +++ b/src/storage/valuation.cpp @@ -4,6 +4,7 @@ #include "storm/storage/sparse/StateValuations.h" #include "storm/storage/expressions/SimpleValuation.h" #include "storm/storage/expressions/Variable.h" +#include "storm/storage/expressions/ExpressionManager.h" // Thin wrappers std::string toJson(storm::storage::sparse::StateValuations const& valuations, storm::storage::sparse::state_type const& stateIndex, boost::optional> const& selectedVariables) { @@ -20,6 +21,7 @@ void define_statevaluation(py::module& m) { .def("get_rational_value", &storm::storage::sparse::StateValuations::getRationalValue, py::arg("state"), py::arg("variable")) .def("get_string", &storm::storage::sparse::StateValuations::toString, py::arg("state"), py::arg("pretty")=true, py::arg("selected_variables")=boost::none) .def("get_json", &toJson, py::arg("state"), py::arg("selected_variables")=boost::none) + .def("get_nr_of_states", &storm::storage::sparse::StateValuations::getNumberOfStates); ; }