diff --git a/src/storage/model.cpp b/src/storage/model.cpp index e5bd5bab1..bfdb8c74e 100644 --- a/src/storage/model.cpp +++ b/src/storage/model.cpp @@ -9,6 +9,7 @@ #include "storm/models/sparse/Pomdp.h" #include "storm/models/sparse/Ctmc.h" #include "storm/models/sparse/MarkovAutomaton.h" +#include "storm/models/sparse/Smg.h" #include "storm/models/sparse/StandardRewardModel.h" #include "storm/models/symbolic/Model.h" #include "storm/models/symbolic/Dtmc.h" @@ -39,6 +40,7 @@ template using SparseMdp = storm::models::sparse::Mdp using SparsePomdp = storm::models::sparse::Pomdp; template using SparseCtmc = storm::models::sparse::Ctmc; template using SparseMarkovAutomaton = storm::models::sparse::MarkovAutomaton; +template using SparseSmg = storm::models::sparse::Smg; template using SparseRewardModel = storm::models::sparse::StandardRewardModel; template using SymbolicModel = storm::models::symbolic::Model; @@ -114,6 +116,7 @@ void define_model(py::module& m) { .value("POMDP", storm::models::ModelType::Pomdp) .value("CTMC", storm::models::ModelType::Ctmc) .value("MA", storm::models::ModelType::MarkovAutomaton) + .value("SMG", storm::models::ModelType::Smg) ; // ModelBase @@ -169,7 +172,10 @@ void define_model(py::module& m) { .def("_as_sparse_pma", [](ModelBase &modelbase) { return modelbase.as>(); }, "Get model as sparse pMA") - .def("_as_symbolic_dtmc", [](ModelBase &modelbase) { + .def("_as_sparse_smg", [](ModelBase &modelbase) { + return modelbase.as>(); + }, "Get model as sparse SMG") + .def("_as_symbolic_dtmc", [](ModelBase &modelbase) { return modelbase.as>(); }, "Get model as symbolic DTMC") .def("_as_symbolic_pdtmc", [](ModelBase &modelbase) { @@ -277,6 +283,13 @@ void define_sparse_model(py::module& m, std::string const& vtSuffix) { .def("convert_to_ctmc", &SparseMarkovAutomaton::convertToCtmc, "Convert the MA into a CTMC.") ; + py::class_, std::shared_ptr>>(m, ("Sparse" + vtSuffix + "SMG").c_str(), "SMG in sparse representation", nondetModel) + .def(py::init>(), py::arg("other_model")) + .def(py::init const&>(), py::arg("components")) + .def("get_state_player_indications", &SparseSmg::getStatePlayerIndications, "Get for each state its corresponding player") + .def("get_player_of_state", &SparseSmg::getPlayerOfState, py::arg("state"), "Get player for the given state") + ; + py::class_>(m, ("Sparse" + vtSuffix + "RewardModel").c_str(), "Reward structure for sparse models") .def(py::init> const&, std::optional> const&, std::optional> const&>(), py::arg("optional_state_reward_vector") = std::nullopt, diff --git a/src/storage/model_components.cpp b/src/storage/model_components.cpp index 5cc55fddf..3ee723abf 100644 --- a/src/storage/model_components.cpp +++ b/src/storage/model_components.cpp @@ -46,7 +46,10 @@ void define_sparse_model_components(py::module& m, std::string const& vtSuffix) .def_readwrite("markovian_states", &SparseModelComponents::markovianStates, "A list 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") + .def_readwrite("player1_matrix", &SparseModelComponents::player1Matrix, "Matrix of player 1 choices (needed for stochastic two player games") + + // Stochastic multiplayer game specific components: + .def_readwrite("state_player_indications", &SparseModelComponents::statePlayerIndications, "The vector mapping states to player indices") ; }