From 689083010f5e95c94a21a7c51bf37e1135ab10b6 Mon Sep 17 00:00:00 2001 From: Sebastian Junges Date: Wed, 2 Sep 2020 09:21:53 -0700 Subject: [PATCH] support for unfolding --- src/pomdp/transformations.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/pomdp/transformations.cpp b/src/pomdp/transformations.cpp index 9bbafd1..2fea4f4 100644 --- a/src/pomdp/transformations.cpp +++ b/src/pomdp/transformations.cpp @@ -3,6 +3,7 @@ #include #include #include +#include template std::shared_ptr> make_canonic(storm::models::sparse::Pomdp const& pomdp) { @@ -27,6 +28,13 @@ std::shared_ptr> apply_unk storm::transformer::ApplyFiniteSchedulerToPomdp transformer(pomdp); return transformer.transform(applicationMode); } + +template +std::shared_ptr> unfold_trace(storm::models::sparse::Pomdp const& pomdp, std::vector const& observationTrace, std::vector const& riskDef ) { + storm::pomdp::ObservationTraceUnfolder transformer(pomdp); + return transformer.transform(observationTrace, riskDef); +} + // STANDARD, SIMPLE_LINEAR, SIMPLE_LINEAR_INVERSE, SIMPLE_LOG, FULL void define_transformations_nt(py::module &m) { py::enum_(m, "PomdpFscApplicationMode") @@ -45,6 +53,7 @@ void define_transformations(py::module& m, std::string const& vtSuffix) { m.def(("_unfold_memory_" + vtSuffix).c_str(), &unfold_memory, "Unfold memory into a POMDP", py::arg("pomdp"), py::arg("memorystructure")); m.def(("_make_simple_"+ vtSuffix).c_str(), &make_simple, "Make POMDP simple", py::arg("pomdp")); m.def(("_apply_unknown_fsc_" + vtSuffix).c_str(), &apply_unknown_fsc, "Apply unknown FSC",py::arg("pomdp"), py::arg("application_mode")=storm::transformer::PomdpFscApplicationMode::SIMPLE_LINEAR); + m.def(("_unfold_trace_" + vtSuffix).c_str(), &unfold_trace, "Unfold observed trace", py::arg("pomdp"), py::arg("observation_trace"), py::arg("risk_definition")); } template void define_transformations(py::module& m, std::string const& vtSuffix);