diff --git a/src/storage/model.cpp b/src/storage/model.cpp index be250a7..a0ceafe 100644 --- a/src/storage/model.cpp +++ b/src/storage/model.cpp @@ -191,16 +191,17 @@ void define_sparse_model(py::module& m) { .def(py::init>(), py::arg("other_model")) .def("__str__", &getModelInfoPrinter) ; - py::class_, std::shared_ptr>>(m, "SparseMdp", "MDP in sparse representation", model) - .def(py::init>(), py::arg("other_model")) + py::class_, std::shared_ptr>> mdp(m, "SparseMdp", "MDP in sparse representation", model); + mdp.def(py::init>(), py::arg("other_model")) .def_property_readonly("nondeterministic_choice_indices", [](SparseMdp const& mdp) { return mdp.getNondeterministicChoiceIndices(); }) .def("get_nr_available_actions", [](SparseMdp const& mdp, uint64_t stateIndex) { return mdp.getNondeterministicChoiceIndices()[stateIndex+1] - mdp.getNondeterministicChoiceIndices()[stateIndex] ; }, py::arg("state")) .def("apply_scheduler", [](SparseMdp const& mdp, storm::storage::Scheduler const& scheduler, bool dropUnreachableStates) { return mdp.applyScheduler(scheduler, dropUnreachableStates); } , "apply scheduler", "scheduler"_a, "drop_unreachable_states"_a = true) .def("__str__", &getModelInfoPrinter) ; - py::class_, std::shared_ptr>>(m, "SparsePomdp", "POMDP in sparse representation", model) + py::class_, std::shared_ptr>>(m, "SparsePomdp", "POMDP in sparse representation", mdp) .def(py::init>(), py::arg("other_model")) .def("__str__", &getModelInfoPrinter) + .def("get_observation", &SparsePomdp::getObservation, py::arg("state")) .def_property_readonly("observations", &SparsePomdp::getObservations) .def_property_readonly("nr_observations", &SparsePomdp::getNrObservations) ;