You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

46 lines
2.4 KiB

  1. #include "input.h"
  2. #include "src/helpers.h"
  3. void define_property(py::module& m) {
  4. py::class_<storm::jani::Property>(m, "Property", "Property")
  5. .def(py::init<std::string const&, std::shared_ptr<storm::logic::Formula const> const&, std::string const&>(), "Construct property from formula", py::arg("name"), py::arg("formula"), py::arg("comment") = "")
  6. .def_property_readonly("name", &storm::jani::Property::getName, "Obtain the name of the property")
  7. .def_property_readonly("raw_formula", &storm::jani::Property::getRawFormula, "Obtain the formula directly")
  8. .def("__str__", &streamToString<storm::jani::Property>)
  9. ;
  10. }
  11. // Define python bindings
  12. void define_input(py::module& m) {
  13. // Parse prism program
  14. m.def("parse_prism_program", &storm::parseProgram, "Parse prism program", py::arg("path"));
  15. // PrismType
  16. py::enum_<storm::prism::Program::ModelType>(m, "PrismModelType", "Type of the prism model")
  17. .value("DTMC", storm::prism::Program::ModelType::DTMC)
  18. .value("CTMC", storm::prism::Program::ModelType::CTMC)
  19. .value("MDP", storm::prism::Program::ModelType::MDP)
  20. .value("CTMDP", storm::prism::Program::ModelType::CTMDP)
  21. .value("MA", storm::prism::Program::ModelType::MA)
  22. .value("UNDEFINED", storm::prism::Program::ModelType::UNDEFINED)
  23. ;
  24. // PrismProgram
  25. py::class_<storm::prism::Program>(m, "PrismProgram", "Prism program")
  26. .def_property_readonly("nr_modules", &storm::prism::Program::getNumberOfModules, "Number of modules")
  27. .def_property_readonly("model_type", &storm::prism::Program::getModelType, "Model type")
  28. .def_property_readonly("has_undefined_constants", &storm::prism::Program::hasUndefinedConstants, "Flag if program has undefined constants")
  29. .def("__str__", &streamToString<storm::prism::Program>)
  30. ;
  31. // SymbolicModelDescription
  32. py::class_<storm::storage::SymbolicModelDescription>(m, "SymbolicModelDescription", "Symbolic description of model")
  33. .def(py::init<storm::prism::Program const&>(), "Construct from Prism program", py::arg("prism_program"))
  34. .def_property_readonly("is_prism_program", &storm::storage::SymbolicModelDescription::isPrismProgram, "Flag if program is in Prism format")
  35. ;
  36. // PrismProgram can be converted into SymbolicModelDescription
  37. py::implicitly_convertible<storm::prism::Program, storm::storage::SymbolicModelDescription>();
  38. }