From 1a08e1177d4974d3b8fca13d92569dc624df5f33 Mon Sep 17 00:00:00 2001 From: sjunges Date: Wed, 27 Jan 2016 23:45:47 +0100 Subject: [PATCH] some issues with const for formulae Former-commit-id: 69469a1933606d44c9d5a45200d0e68381a66cb0 --- src/python/helpers.h | 3 ++- src/python/storm-core.cpp | 7 ++----- src/python/storm-logic.cpp | 17 +++++++++++++++-- 3 files changed, 19 insertions(+), 8 deletions(-) diff --git a/src/python/helpers.h b/src/python/helpers.h index 9e96700e0..f37d350d9 100644 --- a/src/python/helpers.h +++ b/src/python/helpers.h @@ -7,10 +7,11 @@ void shared_ptr_implicitly_convertible() { boost::python::implicitly_convertible, std::shared_ptr>(); } - template void register_shared_ptr() { boost::python::register_ptr_to_python>(); + boost::python::register_ptr_to_python>(); + } diff --git a/src/python/storm-core.cpp b/src/python/storm-core.cpp index 7b740bf1a..4bde9ca91 100644 --- a/src/python/storm-core.cpp +++ b/src/python/storm-core.cpp @@ -17,12 +17,12 @@ public: }; // Thin wrapper for model building -std::shared_ptr buildModel(storm::prism::Program const& program, std::shared_ptr const& formula) { +std::shared_ptr buildModel(storm::prism::Program const& program, std::shared_ptr const& formula) { return storm::buildSymbolicModel(program, std::vector>(1,formula)).model; } // Thin wrapper for parametric state elimination -std::shared_ptr performStateElimination(std::shared_ptr> model, std::shared_ptr const& formula) { +std::shared_ptr performStateElimination(std::shared_ptr> model, std::shared_ptr const& formula) { std::unique_ptr checkResult = storm::verifySparseModel(model, formula); std::shared_ptr result = std::make_shared(); result->resultFunction = (checkResult->asExplicitQuantitativeCheckResult()[*model->getInitialStates().begin()]); @@ -98,9 +98,6 @@ BOOST_PYTHON_MODULE(_core) defineClass, storm::models::sparse::Model>("SparseParametricDtmc", ""); defineClass, storm::models::sparse::Model>("SparseParametricMdp", ""); - defineClass>, void, void>("FormulaVec", "Vector of formulas") - .def(vector_indexing_suite>, true>()) - ; //////////////////////////////////////////// // Bisimulation diff --git a/src/python/storm-logic.cpp b/src/python/storm-logic.cpp index bdf4954df..e2934859c 100644 --- a/src/python/storm-logic.cpp +++ b/src/python/storm-logic.cpp @@ -5,13 +5,24 @@ #include "helpers.h" #include "boostPyExtension.h" - +// Less, LessEqual, Greater, GreaterEqual BOOST_PYTHON_MODULE(_logic) { using namespace boost::python; + enum_("ComparisonType") + .value("LESS", storm::logic::ComparisonType::Less) + .value("LEQ", storm::logic::ComparisonType::LessEqual) + .value("GREATER", storm::logic::ComparisonType::Greater) + .value("GEQ", storm::logic::ComparisonType::GreaterEqual) + ; + + defineClass>, void, void>("FormulaVec", "Vector of formulas") + .def(vector_indexing_suite>, true>()) + ; + //////////////////////////////////////////// // Formula //////////////////////////////////////////// @@ -74,7 +85,9 @@ BOOST_PYTHON_MODULE(_logic) defineClass("OperatorFormula", "") .add_property("has_bound", &storm::logic::OperatorFormula::hasBound) - .add_property("bound", &storm::logic::OperatorFormula::getBound) + .add_property("bound", &storm::logic::OperatorFormula::getBound, &storm::logic::OperatorFormula::setBound) + .add_property("comparison_type", &storm::logic::OperatorFormula::getComparisonType, &storm::logic::OperatorFormula::setComparisonType) + ; defineClass("ExpectedTimeOperator", "The expected time between two events"); defineClass("LongRunAvarageOperator",