Browse Source

Get Choice Labeling

refactoring
Sebastian Junges 6 years ago
parent
commit
eb3c7e8849
  1. 3
      src/storage/labeling.cpp
  2. 1
      src/storage/model.cpp

3
src/storage/labeling.cpp

@ -3,6 +3,7 @@
#include "storm/models/sparse/ItemLabeling.h" #include "storm/models/sparse/ItemLabeling.h"
#include "storm/models/sparse/StateLabeling.h" #include "storm/models/sparse/StateLabeling.h"
#include "storm/models/sparse/ChoiceLabeling.h"
// Define python bindings // Define python bindings
void define_labeling(py::module& m) { void define_labeling(py::module& m) {
@ -30,4 +31,6 @@ void define_labeling(py::module& m) {
.def("__str__", &streamToString<storm::models::sparse::StateLabeling>) .def("__str__", &streamToString<storm::models::sparse::StateLabeling>)
; ;
py::class_<storm::models::sparse::ChoiceLabeling>(m, "ChoiceLabeling", "Labeling for choices", labeling);
} }

1
src/storage/model.cpp

@ -164,6 +164,7 @@ void define_sparse_model(py::module& m) {
// Models with double numbers // Models with double numbers
py::class_<SparseModel<double>, std::shared_ptr<SparseModel<double>>, ModelBase> model(m, "_SparseModel", "A probabilistic model where transitions are represented by doubles and saved in a sparse matrix"); py::class_<SparseModel<double>, std::shared_ptr<SparseModel<double>>, ModelBase> model(m, "_SparseModel", "A probabilistic model where transitions are represented by doubles and saved in a sparse matrix");
model.def_property_readonly("labeling", &getLabeling<double>, "Labels") model.def_property_readonly("labeling", &getLabeling<double>, "Labels")
.def_property_readonly("choice_labeling", [](SparseModel<double> const& model) {return model.getChoiceLabeling();}, "get choice labelling")
.def("labels_state", &SparseModel<double>::getLabelsOfState, py::arg("state"), "Get labels of state") .def("labels_state", &SparseModel<double>::getLabelsOfState, py::arg("state"), "Get labels of state")
.def_property_readonly("initial_states", &getSparseInitialStates<double>, "Initial states") .def_property_readonly("initial_states", &getSparseInitialStates<double>, "Initial states")
.def_property_readonly("states", [](SparseModel<double>& model) { .def_property_readonly("states", [](SparseModel<double>& model) {

Loading…
Cancel
Save