From 93641ba97d86dd5f0be5df9f0ecfc2f0f11ff265 Mon Sep 17 00:00:00 2001 From: Matthias Volk Date: Wed, 4 Jan 2017 10:23:32 +0100 Subject: [PATCH] Marked some bindings private --- lib/stormpy/__init__.py | 8 ++++---- src/storage/model.cpp | 19 +++++++++---------- 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/lib/stormpy/__init__.py b/lib/stormpy/__init__.py index c45ae63..9098233 100644 --- a/lib/stormpy/__init__.py +++ b/lib/stormpy/__init__.py @@ -10,9 +10,9 @@ def build_model(program, formulae): intermediate = core._build_model(program, formulae) assert not intermediate.supports_parameters if intermediate.model_type == ModelType.DTMC: - return intermediate.as_dtmc() + return intermediate._as_dtmc() elif intermediate.model_type == ModelType.MDP: - return intermediate.as_mdp() + return intermediate._as_mdp() else: raise RuntimeError("Not supported non-parametric model constructed") @@ -20,9 +20,9 @@ def build_parametric_model(program, formulae): intermediate = core._build_parametric_model(program, formulae) assert intermediate.supports_parameters if intermediate.model_type == ModelType.DTMC: - return intermediate.as_pdtmc() + return intermediate._as_pdtmc() elif intermediate.model_type == ModelType.MDP: - return intermediate.as_pmdp() + return intermediate._as_pmdp() else: raise RuntimeError("Not supported parametric model constructed") diff --git a/src/storage/model.cpp b/src/storage/model.cpp index f411bd2..ae067eb 100644 --- a/src/storage/model.cpp +++ b/src/storage/model.cpp @@ -42,23 +42,23 @@ void define_model(py::module& m) { ; // ModelBase - py::class_> modelBase(m, "ModelBase", "Base class for all models"); + py::class_> modelBase(m, "_ModelBase", "Base class for all models"); modelBase.def_property_readonly("nr_states", &storm::models::ModelBase::getNumberOfStates, "Number of states") .def_property_readonly("nr_transitions", &storm::models::ModelBase::getNumberOfTransitions, "Number of transitions") .def_property_readonly("model_type", &storm::models::ModelBase::getType, "Model type") .def_property_readonly("supports_parameters", &storm::models::ModelBase::supportsParameters, "Flag whether model supports parameters") .def_property_readonly("has_parameters", &storm::models::ModelBase::hasParameters, "Flag whether model has parameters") .def_property_readonly("is_exact", &storm::models::ModelBase::isExact, "Flag whether model is exact") - .def("as_dtmc", &storm::models::ModelBase::as>, "Get model as DTMC") - .def("as_pdtmc", &storm::models::ModelBase::as>, "Get model as pDTMC") - .def("as_mdp", &storm::models::ModelBase::as>, "Get model as MDP") - .def("as_pmdp", &storm::models::ModelBase::as>, "Get model as pMDP") + .def("_as_dtmc", &storm::models::ModelBase::as>, "Get model as DTMC") + .def("_as_pdtmc", &storm::models::ModelBase::as>, "Get model as pDTMC") + .def("_as_mdp", &storm::models::ModelBase::as>, "Get model as MDP") + .def("_as_pmdp", &storm::models::ModelBase::as>, "Get model as pMDP") ; // Models //storm::models::sparse::Model > - py::class_, std::shared_ptr>> model(m, "SparseModel", "A probabilistic model where transitions are represented by doubles and saved in a sparse matrix", modelBase); + py::class_, std::shared_ptr>> model(m, "_SparseModel", "A probabilistic model where transitions are represented by doubles and saved in a sparse matrix", modelBase); model.def_property_readonly("labels", [](storm::models::sparse::Model& model) { return model.getStateLabeling().getLabels(); }, "Labels") @@ -71,7 +71,7 @@ void define_model(py::module& m) { py::class_, std::shared_ptr>>(m, "SparseMdp", "MDP in sparse representation", model) ; - py::class_, std::shared_ptr>> modelRatFunc(m, "SparseParametricModel", "A probabilistic model where transitions are represented by rational functions and saved in a sparse matrix", modelBase); + py::class_, std::shared_ptr>> 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", &probabilityVariables, "Collect parameters") .def("collect_reward_parameters", &rewardVariables, "Collect reward parameters") .def_property_readonly("labels", [](storm::models::sparse::Model& model) { @@ -88,11 +88,10 @@ void define_model(py::module& m) { } - - +// Model instantiator void define_model_instantiator(py::module& m) { py::class_,storm::models::sparse::Dtmc>>(m, "PdtmcInstantiator", "Instantiate PDTMCs to DTMCs") .def(py::init>(), "parametric model"_a) .def("instantiate", &storm::utility::ModelInstantiator, storm::models::sparse::Dtmc>::instantiate, "Instantiate model with given parameter values"); -} \ No newline at end of file +}