From 62c35f5a7d038e47d75977ccdf4a64e03aeeb154 Mon Sep 17 00:00:00 2001 From: Sebastian Junges Date: Sat, 13 Jun 2020 18:14:55 -0700 Subject: [PATCH] more operators on prism models --- src/storage/prism.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/storage/prism.cpp b/src/storage/prism.cpp index c8b24e1..ba023bb 100644 --- a/src/storage/prism.cpp +++ b/src/storage/prism.cpp @@ -15,6 +15,7 @@ #include "storm/exceptions/InvalidTypeException.h" #include "storm/exceptions/InvalidStateException.h" #include "storm/exceptions/InvalidAccessException.h" +#include using namespace storm::prism; @@ -31,6 +32,7 @@ void define_prism(py::module& m) { .def_property_readonly("has_undefined_constants", &storm::prism::Program::hasUndefinedConstants, "Flag if program has undefined constants") .def_property_readonly("undefined_constants_are_graph_preserving", &storm::prism::Program::undefinedConstantsAreGraphPreserving, "Flag if the undefined constants do not change the graph structure") .def("substitute_constants", &Program::substituteConstants, "Substitute constants within program") + .def("substitute_formulas", &Program::substituteFormulas, "Substitute formulas within program") .def("define_constants", &Program::defineUndefinedConstants, "Define constants") .def("restrict_commands", &Program::restrictCommands, "Restrict commands") .def("simplify", &Program::simplify, "Simplify") @@ -41,6 +43,7 @@ void define_prism(py::module& m) { .def_property_readonly("hasUndefinedConstants", &Program::hasUndefinedConstants, "Does the program have undefined constants?") .def_property_readonly("isDeterministicModel", &Program::isDeterministicModel, "Does the program describe a deterministic model?") .def_property_readonly("expression_manager", &Program::getManager, "Get the expression manager for expressions in this program") + .def("flatten", &Program::flattenModules, "Put program into a single module", py::arg("smt_factory")=std::shared_ptr(new storm::utility::solver::SmtSolverFactory())) .def("to_jani", [](storm::prism::Program const& program, std::vector const& properties, bool allVariablesGlobal, std::string suffix) { return program.toJani(properties, allVariablesGlobal, suffix); }, "Transform to Jani program", py::arg("properties"), py::arg("all_variables_global") = true, py::arg("suffix") = "") @@ -49,6 +52,7 @@ void define_prism(py::module& m) { .def("get_label_expression", [](storm::prism::Program const& program, std::string const& label){ return program.getLabelExpression(label); }, "Get the expression of the given label.", py::arg("label")) + .def_property_readonly("labels", &Program::getLabels, "Get all labels in the program") ; py::class_ module(m, "PrismModule", "A module in a Prism program"); @@ -84,7 +88,9 @@ void define_prism(py::module& m) { .def("__str__", &streamToString) ; - + py::class_