diff --git a/src/mod_storage.cpp b/src/mod_storage.cpp index cd9710d..8a465e3 100644 --- a/src/mod_storage.cpp +++ b/src/mod_storage.cpp @@ -4,6 +4,7 @@ #include "storage/dd.h" #include "storage/model.h" #include "storage/matrix.h" +#include "storage/modelcomponents.h" #include "storage/distribution.h" #include "storage/scheduler.h" #include "storage/prism.h" @@ -41,4 +42,5 @@ PYBIND11_MODULE(storage, m) { define_expressions(m); define_scheduler(m, "Double"); define_distribution(m, "Double"); + define_sparse_modelcomponents(m); } diff --git a/src/storage/modelcomponents.cpp b/src/storage/modelcomponents.cpp index 53ecb76..95a738c 100644 --- a/src/storage/modelcomponents.cpp +++ b/src/storage/modelcomponents.cpp @@ -1,4 +1,5 @@ #include "modelcomponents.h" + #include "storm/models/sparse/StandardRewardModel.h" #include "storm/models/symbolic/StandardRewardModel.h" #include "storm/storage/sparse/ModelComponents.h" @@ -7,14 +8,12 @@ #include "storm/storage/BitVector.h" - - -using stateLabeling = storm::models::sparse::StateLabeling; +using StateLabeling = storm::models::sparse::StateLabeling; using BitVector = storm::storage::BitVector; template using SparseMatrix = storm::storage::SparseMatrix; template using SparseRewardModel = storm::models::sparse::StandardRewardModel; -template using ModelComponents = storm::storage::sparse::ModelComponents; +template using SparseModelComponents = storm::storage::sparse::ModelComponents; // others: todo // ; @@ -22,39 +21,38 @@ template using ModelComponents = storm::storage::sparse::Mod // // > -// todo write tests // Parametric models, Valuetype: todo -void define_model_components(py::module& m) { +void define_sparse_modelcomponents(py::module& m) { - 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) + py::class_>(m, "SparseModelComponents", "ModelComponents description..") //todo - .def(py::init<>()) // for rvalue ? todo + .def(py::init const&, StateLabeling const&, std::unordered_map> const&, + bool, boost::optional const&, boost::optional> const&>(), + py::arg("transition_matrix"), py::arg("state_labeling") = storm::models::sparse::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) - // 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(py::init<>()) // for rvalue ? todo - // POMDP specific components - .def_readwrite("observability_classes", &ModelComponents::observabilityClasses, "The POMDP observations") + // General components (for all model types) + .def_readwrite("transition_matrix", &SparseModelComponents::transitionMatrix) + .def_readwrite("state_labeling", &SparseModelComponents::stateLabeling) + .def_readwrite("reward_models", &SparseModelComponents::rewardModels, "Reward models associated with the model") + .def_readwrite("choice_labeling", &SparseModelComponents::choiceLabeling, "A vector that stores a labeling for each choice") + .def_readwrite("state_valuations", &SparseModelComponents::stateValuations, "A vector that stores for each state to which variable valuation it belongs") + .def_readwrite("choice_origins", &SparseModelComponents::choiceOrigins, "Stores for each choice from which parts of the input model description it originates") - // 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)") + // POMDP specific components + .def_readwrite("observability_classes", &SparseModelComponents::observabilityClasses, "The POMDP observations") - // Stochastic two player game specific components: - .def_readwrite("player1_matrix", &ModelComponents::observabilityClasses, "Matrix of player 1 choices (needed for stochastic two player games") + // Continuous time specific components (CTMCs, Markov Automata): + .def_readwrite("rate_transitions", &SparseModelComponents::rateTransitions, "True iff the transition values (for Markovian choices) are interpreted as rates") + .def_readwrite("exit_Rates", &SparseModelComponents::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", &SparseModelComponents::markovianStates, "A vector that stores which states are markovian (only for Markov Automata)") - ; + // Stochastic two player game specific components: + .def_readwrite("player1_matrix", &SparseModelComponents::observabilityClasses, "Matrix of player 1 choices (needed for stochastic two player games") + ; } \ No newline at end of file diff --git a/src/storage/modelcomponents.h b/src/storage/modelcomponents.h index fdccc99..50b053f 100644 --- a/src/storage/modelcomponents.h +++ b/src/storage/modelcomponents.h @@ -1,8 +1,8 @@ -#ifndef PYSTORM_MODELCOMPONENTS_H -#define PYSTORM_MODELCOMPONENTS_H +#ifndef PYTHON_STORAGE_SPARSEMODELCOMPONENTS_H +#define PYTHON_STORAGE_SPARSEMODELCOMPONENTS_H #include "common.h" -void define_model_components(py::module& m); +void define_sparse_modelcomponents(py::module& m); -#endif /* PYSTORM_MODELCOMPONENTS_H */ +#endif /* PYTHON_STORAGE_SPARSEMODELCOMPONENTS_H */ \ No newline at end of file