diff --git a/lib/stormpy/pomdp/__init__.py b/lib/stormpy/pomdp/__init__.py index a3d0e4a..c27a6d0 100644 --- a/lib/stormpy/pomdp/__init__.py +++ b/lib/stormpy/pomdp/__init__.py @@ -1,3 +1,5 @@ from . import pomdp from .pomdp import * +def make_canonic(model): + return pomdp._make_canonic_Double(model) \ No newline at end of file diff --git a/src/mod_pomdp.cpp b/src/mod_pomdp.cpp index 8b13789..fb48fa7 100644 --- a/src/mod_pomdp.cpp +++ b/src/mod_pomdp.cpp @@ -1 +1,13 @@ +#include "common.h" +#include "pomdp/transformations.h" + +PYBIND11_MODULE(pomdp, m) { + m.doc() = "Functionality for POMDP analysis"; + +#ifdef STORMPY_DISABLE_SIGNATURE_DOC + py::options options; + options.disable_function_signatures(); +#endif + define_transformations(m, "Double"); +} diff --git a/src/pomdp/common.h b/src/pomdp/common.h new file mode 100644 index 0000000..c9b9b0c --- /dev/null +++ b/src/pomdp/common.h @@ -0,0 +1 @@ +#include "src/common.h" diff --git a/src/pomdp/transformations.cpp b/src/pomdp/transformations.cpp new file mode 100644 index 0000000..db0e77a --- /dev/null +++ b/src/pomdp/transformations.cpp @@ -0,0 +1,15 @@ +#include "transformations.h" +#include + +template +std::shared_ptr> make_canonic(storm::models::sparse::Pomdp const& pomdp) { + storm::transformer::MakePOMDPCanonic makeCanonic(pomdp); + return makeCanonic.transform(); +} + +template +void define_transformations(py::module& m, std::string const& vtSuffix) { + m.def(("_make_canonic_" + vtSuffix).c_str(), &make_canonic, "Return a canonicly-ordered POMDP", py::arg("pomdp")); +} + +template void define_transformations(py::module& m, std::string const& vtSuffix); diff --git a/src/pomdp/transformations.h b/src/pomdp/transformations.h new file mode 100644 index 0000000..b261e6d --- /dev/null +++ b/src/pomdp/transformations.h @@ -0,0 +1,6 @@ +#pragma once + +#include "common.h" + +template +void define_transformations(py::module& m, std::string const& vtSuffix);