#include "smtsolver.h" #include #include "storm/storage/expressions/ExpressionManager.h" #include #include void define_smt(py::module& m) { using SmtSolver = storm::solver::SmtSolver; using Z3SmtSolver = storm::solver::Z3SmtSolver; using ModelReference = storm::solver::SmtSolver::ModelReference; py::enum_(m, "SmtCheckResult", "Result type") .value("Sat", SmtSolver::CheckResult::Sat) .value("Unsat", SmtSolver::CheckResult::Unsat) .value("Unknown", SmtSolver::CheckResult::Unknown) ; py::class_> modelref(m, "ModelReference", "Lightweight Wrapper around results"); modelref.def("get_boolean_value", &ModelReference::getBooleanValue, "get a value for a boolean variable", py::arg("variable")) .def("get_integer_value", &ModelReference::getIntegerValue, "get a value for an integer variable", py::arg("variable")) .def("get_rational_value", &ModelReference::getRationalValue, "get a value (as double) for an rational variable", py::arg("variable")); py::class_ smtsolver(m, "SmtSolver", "Generic Storm SmtSolver Wrapper"); smtsolver.def("push", &SmtSolver::push, "push") .def("pop", [](SmtSolver& solver, uint64_t n) {solver.pop(n);}, "pop", py::arg("levels")) .def("reset", &SmtSolver::reset, "reset") .def("add", [](SmtSolver& solver, storm::expressions::Expression const& expr) {solver.add(expr);}, "addconstraint") .def("check", &SmtSolver::check, "check") .def_property_readonly("model", &SmtSolver::getModel, "get the model"); py::class_ z3solver(m, "Z3SmtSolver", "z3 API for storm smtsolver wrapper", smtsolver); z3solver.def(pybind11::init()); py::class_> (m, "SmtSolverFactory", "Factory for creating SMT Solvers"); }