Browse Source

some issues with const for formulae

Former-commit-id: 69469a1933
tempestpy_adaptions
sjunges 9 years ago
parent
commit
1a08e1177d
  1. 3
      src/python/helpers.h
  2. 7
      src/python/storm-core.cpp
  3. 17
      src/python/storm-logic.cpp

3
src/python/helpers.h

@ -7,10 +7,11 @@ void shared_ptr_implicitly_convertible() {
boost::python::implicitly_convertible<std::shared_ptr<Source>, std::shared_ptr<Target>>(); boost::python::implicitly_convertible<std::shared_ptr<Source>, std::shared_ptr<Target>>();
} }
template<typename T> template<typename T>
void register_shared_ptr() { void register_shared_ptr() {
boost::python::register_ptr_to_python<std::shared_ptr<T>>(); boost::python::register_ptr_to_python<std::shared_ptr<T>>();
boost::python::register_ptr_to_python<std::shared_ptr<const T>>();
} }

7
src/python/storm-core.cpp

@ -17,12 +17,12 @@ public:
}; };
// Thin wrapper for model building // Thin wrapper for model building
std::shared_ptr<storm::models::ModelBase> buildModel(storm::prism::Program const& program, std::shared_ptr<const storm::logic::Formula> const& formula) {
std::shared_ptr<storm::models::ModelBase> buildModel(storm::prism::Program const& program, std::shared_ptr<storm::logic::Formula> const& formula) {
return storm::buildSymbolicModel<storm::RationalFunction>(program, std::vector<std::shared_ptr<const storm::logic::Formula>>(1,formula)).model; return storm::buildSymbolicModel<storm::RationalFunction>(program, std::vector<std::shared_ptr<const storm::logic::Formula>>(1,formula)).model;
} }
// Thin wrapper for parametric state elimination // Thin wrapper for parametric state elimination
std::shared_ptr<PmcResult> performStateElimination(std::shared_ptr<storm::models::sparse::Model<storm::RationalFunction>> model, std::shared_ptr<const storm::logic::Formula> const& formula) {
std::shared_ptr<PmcResult> performStateElimination(std::shared_ptr<storm::models::sparse::Model<storm::RationalFunction>> model, std::shared_ptr<storm::logic::Formula> const& formula) {
std::unique_ptr<storm::modelchecker::CheckResult> checkResult = storm::verifySparseModel<storm::RationalFunction>(model, formula); std::unique_ptr<storm::modelchecker::CheckResult> checkResult = storm::verifySparseModel<storm::RationalFunction>(model, formula);
std::shared_ptr<PmcResult> result = std::make_shared<PmcResult>(); std::shared_ptr<PmcResult> result = std::make_shared<PmcResult>();
result->resultFunction = (checkResult->asExplicitQuantitativeCheckResult<storm::RationalFunction>()[*model->getInitialStates().begin()]); result->resultFunction = (checkResult->asExplicitQuantitativeCheckResult<storm::RationalFunction>()[*model->getInitialStates().begin()]);
@ -98,9 +98,6 @@ BOOST_PYTHON_MODULE(_core)
defineClass<storm::models::sparse::Dtmc<storm::RationalFunction>, storm::models::sparse::Model<storm::RationalFunction>>("SparseParametricDtmc", ""); defineClass<storm::models::sparse::Dtmc<storm::RationalFunction>, storm::models::sparse::Model<storm::RationalFunction>>("SparseParametricDtmc", "");
defineClass<storm::models::sparse::Mdp<storm::RationalFunction>, storm::models::sparse::Model<storm::RationalFunction>>("SparseParametricMdp", ""); defineClass<storm::models::sparse::Mdp<storm::RationalFunction>, storm::models::sparse::Model<storm::RationalFunction>>("SparseParametricMdp", "");
defineClass<std::vector<std::shared_ptr<const storm::logic::Formula>>, void, void>("FormulaVec", "Vector of formulas")
.def(vector_indexing_suite<std::vector<std::shared_ptr<const storm::logic::Formula>>, true>())
;
//////////////////////////////////////////// ////////////////////////////////////////////
// Bisimulation // Bisimulation

17
src/python/storm-logic.cpp

@ -5,13 +5,24 @@
#include "helpers.h" #include "helpers.h"
#include "boostPyExtension.h" #include "boostPyExtension.h"
// Less, LessEqual, Greater, GreaterEqual
BOOST_PYTHON_MODULE(_logic) BOOST_PYTHON_MODULE(_logic)
{ {
using namespace boost::python; using namespace boost::python;
enum_<storm::logic::ComparisonType>("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<std::vector<std::shared_ptr<storm::logic::Formula>>, void, void>("FormulaVec", "Vector of formulas")
.def(vector_indexing_suite<std::vector<std::shared_ptr<storm::logic::Formula>>, true>())
;
//////////////////////////////////////////// ////////////////////////////////////////////
// Formula // Formula
//////////////////////////////////////////// ////////////////////////////////////////////
@ -74,7 +85,9 @@ BOOST_PYTHON_MODULE(_logic)
defineClass<storm::logic::OperatorFormula, storm::logic::UnaryStateFormula, boost::noncopyable>("OperatorFormula", defineClass<storm::logic::OperatorFormula, storm::logic::UnaryStateFormula, boost::noncopyable>("OperatorFormula",
"") "")
.add_property("has_bound", &storm::logic::OperatorFormula::hasBound) .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<storm::logic::ExpectedTimeOperatorFormula, storm::logic::OperatorFormula>("ExpectedTimeOperator", defineClass<storm::logic::ExpectedTimeOperatorFormula, storm::logic::OperatorFormula>("ExpectedTimeOperator",
"The expected time between two events"); "The expected time between two events");
defineClass<storm::logic::LongRunAverageOperatorFormula, storm::logic::OperatorFormula>("LongRunAvarageOperator", defineClass<storm::logic::LongRunAverageOperatorFormula, storm::logic::OperatorFormula>("LongRunAvarageOperator",

Loading…
Cancel
Save