From e35f390414b8d5131a23bdb008a8ae7964c22a9e Mon Sep 17 00:00:00 2001 From: Sebastian Junges Date: Fri, 7 Dec 2018 15:06:40 +0100 Subject: [PATCH] copy sparse models --- src/storage/model.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/storage/model.cpp b/src/storage/model.cpp index 1170dcc..c94d954 100644 --- a/src/storage/model.cpp +++ b/src/storage/model.cpp @@ -189,23 +189,28 @@ void define_sparse_model(py::module& m) { .def("to_dot", [](SparseModel& model) { std::stringstream ss; model.writeDotToStream(ss); return ss.str(); }, "Write dot to a string") ; py::class_, std::shared_ptr>>(m, "SparseDtmc", "DTMC in sparse representation", model) - .def("__str__", getModelInfoPrinter("DTMC")) + .def(py::init>(), py::arg("other_model")) + .def("__str__", getModelInfoPrinter("DTMC")) ; py::class_, std::shared_ptr>>(m, "SparseMdp", "MDP in sparse representation", model) + .def(py::init>(), py::arg("other_model")) .def_property_readonly("nondeterministic_choice_indices", [](SparseMdp const& mdp) { return mdp.getNondeterministicChoiceIndices(); }) .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("MDP")) ; py::class_, std::shared_ptr>>(m, "SparsePomdp", "POMDP in sparse representation", model) + .def(py::init>(), py::arg("other_model")) .def("__str__", getModelInfoPrinter("POMDP")) .def_property_readonly("observations", &SparsePomdp::getObservations) .def_property_readonly("nr_observations", &SparsePomdp::getNrObservations) ; py::class_, std::shared_ptr>>(m, "SparseCtmc", "CTMC in sparse representation", model) - .def("__str__", getModelInfoPrinter("CTMC")) + .def(py::init>(), py::arg("other_model")) + .def("__str__", getModelInfoPrinter("CTMC")) ; py::class_, std::shared_ptr>>(m, "SparseMA", "MA in sparse representation", model) - .def("__str__", getModelInfoPrinter("MA")) + .def(py::init>(), py::arg("other_model")) + .def("__str__", getModelInfoPrinter("MA")) ; py::class_>(m, "SparseRewardModel", "Reward structure for sparse models")