From 32e8f09a4333f57278a7c791d9f3f2f0bcbd7626 Mon Sep 17 00:00:00 2001 From: Sebastian Junges Date: Tue, 21 Jul 2020 16:42:33 -0700 Subject: [PATCH] dd meta variable types --- src/mod_storage.cpp | 1 + src/storage/dd.cpp | 10 ++++++++++ src/storage/dd.h | 1 + 3 files changed, 12 insertions(+) diff --git a/src/mod_storage.cpp b/src/mod_storage.cpp index 552168c..cd9710d 100644 --- a/src/mod_storage.cpp +++ b/src/mod_storage.cpp @@ -26,6 +26,7 @@ PYBIND11_MODULE(storage, m) { define_bitvector(m); define_dd(m, "Sylvan"); + define_dd_nt(m); define_model(m); define_statevaluation(m); define_sparse_model(m); diff --git a/src/storage/dd.cpp b/src/storage/dd.cpp index 02e5f40..9540aea 100644 --- a/src/storage/dd.cpp +++ b/src/storage/dd.cpp @@ -11,6 +11,7 @@ void define_dd(py::module& m, std::string const& libstring) { ddMetaVariable.def("compute_indices", &storm::dd::DdMetaVariable::getIndices, py::arg("sorted")=true); ddMetaVariable.def_property_readonly("name", &storm::dd::DdMetaVariable::getName); ddMetaVariable.def_property_readonly("lowest_value", &storm::dd::DdMetaVariable::getLow); + ddMetaVariable.def_property_readonly("type", &storm::dd::DdMetaVariable::getType); ddMetaVariable.def("__str__", &storm::dd::DdMetaVariable::getName); py::class_, std::shared_ptr>> ddManager(m, (std::string("DdManager_") + libstring).c_str()); @@ -22,9 +23,18 @@ void define_dd(py::module& m, std::string const& libstring) { dd.def_property_readonly("meta_variables", [](storm::dd::Dd const& dd) {return dd.getContainedMetaVariables();}, "the contained meta variables"); + py::class_> bdd(m, (std::string("Bdd_") + libstring).c_str(), "Bdd", dd); bdd.def("to_expression", &storm::dd::Bdd::toExpression, py::arg("expression_manager")); } +void define_dd_nt(py::module& m) { + py::enum_(m, "DdMetaVariableType") + .value("Int", storm::dd::MetaVariableType::Int) + .value("Bool", storm::dd::MetaVariableType::Bool) + .value("Bitvector", storm::dd::MetaVariableType::BitVector); + +} + template void define_dd(py::module& m, std::string const& libstring); \ No newline at end of file diff --git a/src/storage/dd.h b/src/storage/dd.h index 9d9df2a..9bc65ea 100644 --- a/src/storage/dd.h +++ b/src/storage/dd.h @@ -5,3 +5,4 @@ template void define_dd(py::module& m, std::string const& libname); +void define_dd_nt(py::module& m); \ No newline at end of file