From dd7506c2318d3b21906ecaf1078cf4ce34bb2ec5 Mon Sep 17 00:00:00 2001 From: Sebastian Junges Date: Thu, 7 May 2020 18:18:15 -0700 Subject: [PATCH] write / load winning regions --- src/pomdp/qualitative_analysis.cpp | 2 ++ src/storage/bitvector.cpp | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/pomdp/qualitative_analysis.cpp b/src/pomdp/qualitative_analysis.cpp index d646851..5710581 100644 --- a/src/pomdp/qualitative_analysis.cpp +++ b/src/pomdp/qualitative_analysis.cpp @@ -43,4 +43,6 @@ void define_qualitative_policy_search_nt(py::module& m) { mssqopts.def(py::init<>()); py::class_ winningRegion(m, "BeliefSupportWinningRegion"); + winningRegion.def_static("load_from_file", &storm::pomdp::WinningRegion::loadFromFile, py::arg("filepath")); + winningRegion.def("store_to_file", &storm::pomdp::WinningRegion::storeToFile, py::arg("filepath")); } diff --git a/src/storage/bitvector.cpp b/src/storage/bitvector.cpp index ef17e6f..cd99701 100644 --- a/src/storage/bitvector.cpp +++ b/src/storage/bitvector.cpp @@ -33,6 +33,8 @@ void define_bitvector(py::module& m) { .def("__iter__", [](const BitVector &b) { return py::make_iterator(b.begin(), b.end()); }, py::keep_alive<0, 1>() /* Essential: keep object alive while iterator exists */) + .def("store_as_string", [](const BitVector& bv) {std::stringstream strs; bv.store(strs); return strs.str();}) + .def_static("load_from_string", &BitVector::load, py::arg("description")) .def(py::self == py::self) .def(py::self != py::self)