Browse Source

make canonic for pomdps

refactoring
Sebastian Junges 5 years ago
parent
commit
b844d02cd9
  1. 2
      lib/stormpy/pomdp/__init__.py
  2. 12
      src/mod_pomdp.cpp
  3. 1
      src/pomdp/common.h
  4. 15
      src/pomdp/transformations.cpp
  5. 6
      src/pomdp/transformations.h

2
lib/stormpy/pomdp/__init__.py

@ -1,3 +1,5 @@
from . import pomdp from . import pomdp
from .pomdp import * from .pomdp import *
def make_canonic(model):
return pomdp._make_canonic_Double(model)

12
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<double>(m, "Double");
}

1
src/pomdp/common.h

@ -0,0 +1 @@
#include "src/common.h"

15
src/pomdp/transformations.cpp

@ -0,0 +1,15 @@
#include "transformations.h"
#include <storm-pomdp/transformer/MakePOMDPCanonic.h>
template<typename ValueType>
std::shared_ptr<storm::models::sparse::Pomdp<ValueType>> make_canonic(storm::models::sparse::Pomdp<ValueType> const& pomdp) {
storm::transformer::MakePOMDPCanonic<ValueType> makeCanonic(pomdp);
return makeCanonic.transform();
}
template<typename ValueType>
void define_transformations(py::module& m, std::string const& vtSuffix) {
m.def(("_make_canonic_" + vtSuffix).c_str(), &make_canonic<ValueType>, "Return a canonicly-ordered POMDP", py::arg("pomdp"));
}
template void define_transformations<double>(py::module& m, std::string const& vtSuffix);

6
src/pomdp/transformations.h

@ -0,0 +1,6 @@
#pragma once
#include "common.h"
template<typename VT>
void define_transformations(py::module& m, std::string const& vtSuffix);
Loading…
Cancel
Save