From 9114729959179ea7b1b2217787c500d129a5bec5 Mon Sep 17 00:00:00 2001 From: hannah Date: Wed, 27 May 2020 22:35:36 +0200 Subject: [PATCH] constructor for modelComp --- src/storage/modelcomponents.cpp | 51 ++++++++++++++++++++++----------- 1 file changed, 35 insertions(+), 16 deletions(-) diff --git a/src/storage/modelcomponents.cpp b/src/storage/modelcomponents.cpp index 4521b96..97536ee 100644 --- a/src/storage/modelcomponents.cpp +++ b/src/storage/modelcomponents.cpp @@ -2,36 +2,55 @@ #include "storm/models/sparse/StandardRewardModel.h" #include "storm/models/symbolic/StandardRewardModel.h" #include "storm/storage/sparse/ModelComponents.h" +#include "storm/storage/SparseMatrix.h" +#include "storm/models/sparse/StateLabeling.h" +#include "storm/storage/BitVector.h" -// or just template using ModelComponents = storm::storage::sparse::ModelComponents; todo + +template using SparseMatrix = storm::storage::SparseMatrix; +using stateLabeling = storm::models::sparse::StateLabeling; +using BitVector = storm::storage::BitVector; + template using StandardRewardModel = storm::models::sparse::StandardRewardModel; template> using ModelComponents = storm::storage::sparse::ModelComponents; +// other: todo +// >; +// py::class_>>(m, "ModelComponents", "ModelComponents description..") + + + void define_model_components(py::module& m) { - py::class_>>(m, "ModelComponents", "ModelComponents description..") - //todo .def(py::init<...>) + py::class_>(m, "ModelComponents", "ModelComponents description..") + .def(py::init const &, stateLabeling const &, std::unordered_map> const &, + bool, boost::optional const &, boost::optional> const &>(), + "Construct from Prism program", py::arg("transition_matrix"), py::arg("state_labeling") = stateLabeling(), + py::arg("reward_models") = std::unordered_map>(), py::arg("rate_transitions") = false, + py::arg("markovian_states") = boost::none, py::arg("player1_matrix") = boost::none) + + .def(py::init<>()) // for rvalue ? todo - // todo: readwrite or readonly? // general components (for all model types) - .def_readwrite("transition_matrix", &ModelComponents>::transitionMatrix) - .def_readwrite("state_labeling", &ModelComponents>::stateLabeling) - .def_readwrite("reward_models", &ModelComponents>::rewardModels, "Reward models associated with the model") - .def_readwrite("choice_labeling", &ModelComponents>::choiceLabeling, "A vector that stores a labeling for each choic") - .def_readwrite("state_valuations", &ModelComponents>::stateValuations, "A vector that stores for each state to which variable valuation it belongs") - .def_readwrite("choice_origins", &ModelComponents>::choiceOrigins, "Stores for each choice from which parts of the input model description it originates") + .def_readwrite("transition_matrix", &ModelComponents::transitionMatrix) + .def_readwrite("state_labeling", &ModelComponents::stateLabeling) + .def_readwrite("reward_models", &ModelComponents::rewardModels, "Reward models associated with the model") + .def_readwrite("choice_labeling", &ModelComponents::choiceLabeling, "A vector that stores a labeling for each choic") + .def_readwrite("state_valuations", &ModelComponents::stateValuations, "A vector that stores for each state to which variable valuation it belongs") + .def_readwrite("choice_origins", &ModelComponents::choiceOrigins, "Stores for each choice from which parts of the input model description it originates") // POMDP specific components - .def_readwrite("observability_classes", &ModelComponents>::observabilityClasses, "The POMDP observations") + .def_readwrite("observability_classes", &ModelComponents::observabilityClasses, "The POMDP observations") // Continuous time specific components (CTMCs, Markov Automata): - .def_readwrite("rate_transitions", &ModelComponents>::rateTransitions, "True iff the transition values (for Markovian choices) are interpreted as rates") - .def_readwrite("exit_Rates", &ModelComponents>::exitRates, "The exit rate for each state. Must be given for CTMCs and MAs, if rate_transitions is false. Otherwise, it is optional.") - .def_readwrite("markovian_states", &ModelComponents>::markovianStates, "A vector that stores which states are markovian (only for Markov Automata)") + .def_readwrite("rate_transitions", &ModelComponents::rateTransitions, "True iff the transition values (for Markovian choices) are interpreted as rates") + .def_readwrite("exit_Rates", &ModelComponents::exitRates, "The exit rate for each state. Must be given for CTMCs and MAs, if rate_transitions is false. Otherwise, it is optional.") + .def_readwrite("markovian_states", &ModelComponents::markovianStates, "A vector that stores which states are markovian (only for Markov Automata)") // Stochastic two player game specific components: - .def_readwrite("player1_matrix", &ModelComponents>::observabilityClasses, "Matrix of player 1 choices (needed for stochastic two player games") + .def_readwrite("player1_matrix", &ModelComponents::observabilityClasses, "Matrix of player 1 choices (needed for stochastic two player games") + ; - ; +} \ No newline at end of file