|
|
@ -8,32 +8,13 @@ typedef storm::storage::ParameterRegion<storm::RationalFunction> Region; |
|
|
|
void specifyFormula(std::shared_ptr<PLAChecker>& checker, std::shared_ptr<const storm::logic::Formula> const& formula) { |
|
|
|
checker->specifyFormula(storm::modelchecker::CheckTask<storm::logic::Formula, storm::RationalFunction>(*formula, true)); |
|
|
|
} |
|
|
|
storm::modelchecker::parametric::RegionCheckResult checkRegion(std::shared_ptr<PLAChecker>& checker, Region& region) { |
|
|
|
return checker->analyzeRegion(region, storm::modelchecker::parametric::RegionCheckResult::Unknown, true); |
|
|
|
storm::modelchecker::parametric::RegionCheckResult checkRegion(std::shared_ptr<PLAChecker>& checker, Region& region, storm::modelchecker::parametric::RegionCheckResult initialResult, bool sampleVertices) { |
|
|
|
return checker->analyzeRegion(region, initialResult, sampleVertices); |
|
|
|
} |
|
|
|
|
|
|
|
// Define python bindings
|
|
|
|
void define_pla(py::module& m) { |
|
|
|
|
|
|
|
// PLAChecker
|
|
|
|
py::class_<PLAChecker, std::shared_ptr<PLAChecker>>(m, "PLAChecker", "Region model checker for sparse DTMCs") |
|
|
|
.def("__init__", [](PLAChecker& instance, std::shared_ptr<storm::models::sparse::Dtmc<storm::RationalFunction>> model) -> void { |
|
|
|
new (&instance) PLAChecker(*model); |
|
|
|
}) |
|
|
|
//.def(py::init<storm::models::sparse::Dtmc<storm::RationalFunction>>)
|
|
|
|
.def("specify_formula", &specifyFormula, "Specify formula", py::arg("formula")) |
|
|
|
.def("check_region", &checkRegion, "Check region", py::arg("region")) |
|
|
|
; |
|
|
|
|
|
|
|
// Region
|
|
|
|
py::class_<Region, std::shared_ptr<Region>>(m, "ParameterRegion", "Parameter region") |
|
|
|
.def("__init__", [](Region &instance, std::string const& regionString, std::set<Region::VariableType> const& variables) -> void { |
|
|
|
new (&instance) Region(Region::parseRegion(regionString, variables)); |
|
|
|
}) |
|
|
|
//.def(py::init<Region::VariableSubstitutionType &, Region::VariableSubstitutionType &>(), py::arg("lowerBounds"), py::arg("upperBounds"))
|
|
|
|
//.def("result", &Region::getCheckResult, "Get check result")
|
|
|
|
; |
|
|
|
|
|
|
|
// RegionCheckResult
|
|
|
|
py::enum_<storm::modelchecker::parametric::RegionCheckResult>(m, "RegionCheckResult", "Types of region check results") |
|
|
|
.value("EXISTSSAT", storm::modelchecker::parametric::RegionCheckResult::ExistsSat) |
|
|
@ -46,4 +27,21 @@ void define_pla(py::module& m) { |
|
|
|
.value("UNKNOWN", storm::modelchecker::parametric::RegionCheckResult::Unknown) |
|
|
|
.def("__str__", &streamToString<storm::modelchecker::parametric::RegionCheckResult>) |
|
|
|
; |
|
|
|
|
|
|
|
// Region
|
|
|
|
py::class_<Region, std::shared_ptr<Region>>(m, "ParameterRegion", "Parameter region") |
|
|
|
.def("__init__", [](Region &instance, std::string const& regionString, std::set<Region::VariableType> const& variables) -> void { |
|
|
|
new (&instance) Region(Region::parseRegion(regionString, variables)); |
|
|
|
}) |
|
|
|
//.def(py::init<Region::VariableSubstitutionType &, Region::VariableSubstitutionType &>(), py::arg("lowerBounds"), py::arg("upperBounds"))
|
|
|
|
; |
|
|
|
|
|
|
|
// PLAChecker
|
|
|
|
py::class_<PLAChecker, std::shared_ptr<PLAChecker>>(m, "PLAChecker", "Region model checker for sparse DTMCs") |
|
|
|
.def("__init__", [](PLAChecker& instance, std::shared_ptr<storm::models::sparse::Dtmc<storm::RationalFunction>> model) -> void { |
|
|
|
new (&instance) PLAChecker(*model); |
|
|
|
}) |
|
|
|
.def("specify_formula", &specifyFormula, "Specify formula", py::arg("formula")) |
|
|
|
.def("check_region", &checkRegion, "Check region", py::arg("region"), py::arg("initialResult") = storm::modelchecker::parametric::RegionCheckResult::Unknown, py::arg("sampleVertices") = false) |
|
|
|
; |
|
|
|
} |