Browse Source

some support for getting parameters

refactoring
Sebastian Junges 8 years ago
parent
commit
7133a4e79e
  1. 1
      src/mod_storage.cpp
  2. 11
      src/storage/model.cpp

1
src/mod_storage.cpp

@ -15,5 +15,6 @@ PYBIND11_PLUGIN(storage) {
define_bitvector(m); define_bitvector(m);
define_model(m); define_model(m);
define_sparse_matrix(m); define_sparse_matrix(m);
define_model_instantiator(m);
return m.ptr(); return m.ptr();
} }

11
src/storage/model.cpp

@ -22,6 +22,14 @@ storm::storage::SparseMatrix<ValueType>& getTransitionMatrix(storm::models::spar
return model.getTransitionMatrix(); return model.getTransitionMatrix();
} }
std::set<storm::RationalFunctionVariable> probabilityVariables(storm::models::sparse::Model<storm::RationalFunction> const& model) {
return storm::models::sparse::getProbabilityParameters(model);
}
std::set<storm::RationalFunctionVariable> rewardVariables(storm::models::sparse::Model<storm::RationalFunction> const& model) {
return storm::models::sparse::getRewardParameters(model);
}
// Define python bindings // Define python bindings
void define_model(py::module& m) { void define_model(py::module& m) {
@ -64,7 +72,8 @@ void define_model(py::module& m) {
; ;
py::class_<storm::models::sparse::Model<storm::RationalFunction>, std::shared_ptr<storm::models::sparse::Model<storm::RationalFunction>>> modelRatFunc(m, "SparseParametricModel", "A probabilistic model where transitions are represented by rational functions and saved in a sparse matrix", modelBase); py::class_<storm::models::sparse::Model<storm::RationalFunction>, std::shared_ptr<storm::models::sparse::Model<storm::RationalFunction>>> modelRatFunc(m, "SparseParametricModel", "A probabilistic model where transitions are represented by rational functions and saved in a sparse matrix", modelBase);
modelRatFunc.def("collect_probability_parameters", &storm::models::sparse::getProbabilityParameters, "Collect parameters")
modelRatFunc.def("collect_probability_parameters", &probabilityVariables, "Collect parameters")
.def("collect_reward_parameters", &rewardVariables, "Collect reward parameters")
.def_property_readonly("labels", [](storm::models::sparse::Model<storm::RationalFunction>& model) { .def_property_readonly("labels", [](storm::models::sparse::Model<storm::RationalFunction>& model) {
return model.getStateLabeling().getLabels(); return model.getStateLabeling().getLabels();
}, "Labels") }, "Labels")

Loading…
Cancel
Save