Browse Source

choice origins

refactoring
Sebastian Junges 6 years ago
parent
commit
acb1004c04
  1. 2
      src/mod_storage.cpp
  2. 13
      src/storage/choiceorigins.cpp
  3. 6
      src/storage/choiceorigins.h
  4. 2
      src/storage/model.cpp

2
src/mod_storage.cpp

@ -8,6 +8,7 @@
#include "storage/prism.h"
#include "storage/jani.h"
#include "storage/state.h"
#include "storage/choiceorigins.h"
#include "storage/labeling.h"
#include "storage/expressions.h"
@ -30,6 +31,7 @@ PYBIND11_MODULE(storage, m) {
define_prism(m);
define_jani(m);
define_labeling(m);
define_origins(m);
define_expressions(m);
define_scheduler<double>(m, "Double");
define_distribution<double>(m, "Double");

13
src/storage/choiceorigins.cpp

@ -0,0 +1,13 @@
#include "choiceorigins.h"
#include "storm/storage/sparse/JaniChoiceOrigins.h"
#include "storm/storage/jani/Model.h"
void define_origins(py::module& m) {
using ChoiceOrigins = storm::storage::sparse::ChoiceOrigins;
py::class_<ChoiceOrigins, std::shared_ptr<ChoiceOrigins>> co(m, "ChoiceOrigins", "This class represents the origin of choices of a model in terms of the input model spec.");
using JaniChoiceOrigins = storm::storage::sparse::JaniChoiceOrigins;
py::class_<JaniChoiceOrigins, std::shared_ptr<JaniChoiceOrigins>>(m, "JaniChoiceOrigins", "This class represents for each choice the origin in the jani spec.")
.def_property_readonly("model", &JaniChoiceOrigins::getModel, "retrieves the associated JANI model")
.def("get_edge_index_set", [](JaniChoiceOrigins const& co, uint64_t choice) { return co.getEdgeIndexSet(choice); }, "returns the set of edges that induced the choice", py::arg("choice_index"))
;
}

6
src/storage/choiceorigins.h

@ -0,0 +1,6 @@
#pragma once
#include "common.h"
void define_origins(py::module& m);

2
src/storage/model.cpp

@ -165,6 +165,8 @@ void define_sparse_model(py::module& m) {
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")
.def_property_readonly("choice_labeling", [](SparseModel<double> const& model) {return model.getChoiceLabeling();}, "get choice labelling")
.def("has_choice_origins", [](SparseModel<double> const& model) {return model.hasChoiceOrigins();}, "has choice origins?")
.def_property_readonly("choice_origins", [](SparseModel<double> const& model) {return model.getChoiceOrigins();})
.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("states", [](SparseModel<double>& model) {

Loading…
Cancel
Save