#include "model_instantiator.h" #include "storm/models/sparse/Model.h" #include "storm-pars/modelchecker/instantiation/SparseDtmcInstantiationModelChecker.h" #include "storm/models/sparse/StandardRewardModel.h" #include "storm-pars/transformer/SparseParametricDtmcSimplifier.h" #include "storm/adapters/RationalFunctionAdapter.h" #include "storm/modelchecker/propositional/SparsePropositionalModelChecker.h" #include "storm/modelchecker/results/ExplicitQualitativeCheckResult.h" #include "storm/modelchecker/results/ExplicitQuantitativeCheckResult.h" #include "storm/modelchecker/prctl/helper/DsMpiUpperRewardBoundsComputer.h" #include "storm/modelchecker/prctl/helper/BaierUpperRewardBoundsComputer.h" #include "storm/models/sparse/Dtmc.h" #include "storm/models/sparse/StandardRewardModel.h" #include "storm/solver/MinMaxLinearEquationSolver.h" #include "storm/solver/Multiplier.h" #include "storm/utility/vector.h" #include "storm/utility/graph.h" #include "storm/utility/NumberTraits.h" template using Model = storm::models::sparse::Model; template using Dtmc = storm::models::sparse::Dtmc; template using Mdp = storm::models::sparse::Mdp; template using Ctmc = storm::models::sparse::Ctmc; template using MarkovAutomaton = storm::models::sparse::MarkovAutomaton; using namespace storm::modelchecker; // Model instantiator void define_model_instantiator(py::module& m) { py::class_, Dtmc>>(m, "PDtmcInstantiator", "Instantiate PDTMCs to DTMCs") .def(py::init>(), "parametric model"_a) .def("instantiate", &storm::utility::ModelInstantiator, Dtmc>::instantiate, "Instantiate model with given parameter values") ; py::class_,Mdp>>(m, "PMdpInstantiator", "Instantiate PMDPs to MDPs") .def(py::init>(), "parametric model"_a) .def("instantiate", &storm::utility::ModelInstantiator, Mdp>::instantiate, "Instantiate model with given parameter values") ; py::class_,Ctmc>>(m, "PCtmcInstantiator", "Instantiate PCTMCs to CTMCs") .def(py::init>(), "parametric model"_a) .def("instantiate", &storm::utility::ModelInstantiator, Ctmc>::instantiate, "Instantiate model with given parameter values") ; py::class_,MarkovAutomaton>>(m, "PMaInstantiator", "Instantiate PMAs to MAs") .def(py::init>(), "parametric model"_a) .def("instantiate", &storm::utility::ModelInstantiator, MarkovAutomaton>::instantiate, "Instantiate model with given parameter values") ; py::class_, Dtmc>>(m, "PartialPDtmcInstantiator", "Instantiate PDTMCs to DTMCs") .def(py::init>(), "parametric model"_a) .def("instantiate", &storm::utility::ModelInstantiator, Dtmc>::instantiate, "Instantiate model with given parameter values") ; py::class_,Mdp>>(m, "PartialPMdpInstantiator", "Instantiate PMDPs to MDPs") .def(py::init>(), "parametric model"_a) .def("instantiate", &storm::utility::ModelInstantiator, Mdp>::instantiate, "Instantiate model with given parameter values") ; py::class_,Ctmc>>(m, "PartialPCtmcInstantiator", "Instantiate PCTMCs to CTMCs") .def(py::init>(), "parametric model"_a) .def("instantiate", &storm::utility::ModelInstantiator, Ctmc>::instantiate, "Instantiate model with given parameter values") ; py::class_,MarkovAutomaton>>(m, "PartialPMaInstantiator", "Instantiate PMAs to MAs") .def(py::init>(), "parametric model"_a) .def("instantiate", &storm::utility::ModelInstantiator, MarkovAutomaton>::instantiate, "Instantiate model with given parameter values") ; } void define_model_instantiation_checker(py::module& m) { py::class_, double>, std::shared_ptr, double>>> bpdtmcinstchecker(m, "_PDtmcInstantiationCheckerBase", "Instantiate pDTMCs to DTMCs and immediately check (base)"); bpdtmcinstchecker.def("specify_formula", &SparseInstantiationModelChecker, double>::specifyFormula, "check_task"_a); py::class_, double>, std::shared_ptr, double>>> (m, "PDtmcInstantiationChecker", "Instantiate pDTMCs to DTMCs and immediately check", bpdtmcinstchecker) .def(py::init>(), "parametric model"_a) .def("check", [](SparseDtmcInstantiationModelChecker, double> &sdimc, storm::Environment const& env, storm::utility::parametric::Valuation const& val) -> std::shared_ptr {return sdimc.check(env,val);}, "env"_a, "instantiation"_a) .def("set_graph_preserving", &SparseDtmcInstantiationModelChecker, double>::setInstantiationsAreGraphPreserving, "value"_a) ; py::class_, storm::RationalNumber>, std::shared_ptr, storm::RationalNumber>>> bpdtmcexactinstchecker(m, "_PDtmcExactInstantiationCheckerBase", "Instantiate pDTMCs to exact DTMCs and immediately check (base)"); bpdtmcexactinstchecker.def("specify_formula", &SparseInstantiationModelChecker, storm::RationalNumber>::specifyFormula, "check_task"_a); py::class_, storm::RationalNumber>, std::shared_ptr, storm::RationalNumber>>> (m, "PDtmcExactInstantiationChecker", "Instantiate pDTMCs to exact DTMCs and immediately check", bpdtmcexactinstchecker) .def(py::init>(), "parametric model"_a) .def("check", [](SparseDtmcInstantiationModelChecker, storm::RationalNumber> &sdimc, storm::Environment const& env, storm::utility::parametric::Valuation const& val) -> std::shared_ptr {return sdimc.check(env,val);}, "env"_a, "instantiation"_a) .def("set_graph_preserving", &SparseDtmcInstantiationModelChecker, storm::RationalNumber>::setInstantiationsAreGraphPreserving, "value"_a) ; py::class_, double>, std::shared_ptr, double>>> bpmdpinstchecker(m, "_PMdpInstantiationCheckerBase", "Instantiate pMDPs to MDPs and immediately check (base)"); bpmdpinstchecker.def("specify_formula", &SparseInstantiationModelChecker, double>::specifyFormula, "check_task"_a); py::class_, double>, std::shared_ptr, double>>> (m, "PMdpInstantiationChecker", "Instantiate PMDP to MDPs and immediately check", bpmdpinstchecker) .def(py::init>(), "parametric model"_a) .def("check", [](SparseMdpInstantiationModelChecker, double> &sdimc, storm::Environment const& env, storm::utility::parametric::Valuation const& val) -> std::shared_ptr {return sdimc.check(env,val);}, "env"_a, "instantiation"_a) .def("set_graph_preserving", &SparseMdpInstantiationModelChecker, double>::setInstantiationsAreGraphPreserving, "value"_a) ; py::class_, storm::RationalNumber>, std::shared_ptr, storm::RationalNumber>>> bpmdpexactinstchecker(m, "_PMdpExactInstantiationCheckerBase", "Instantiate pMDPs to exact MDPs and immediately check (base)"); bpmdpexactinstchecker.def("specify_formula", &SparseInstantiationModelChecker, storm::RationalNumber>::specifyFormula, "check_task"_a); py::class_, storm::RationalNumber>, std::shared_ptr, storm::RationalNumber>>> (m, "PMdpExactInstantiationChecker", "Instantiate PMDP to exact MDPs and immediately check", bpmdpexactinstchecker) .def(py::init>(), "parametric model"_a) .def("check", [](SparseMdpInstantiationModelChecker, storm::RationalNumber> &sdimc, storm::Environment const& env, storm::utility::parametric::Valuation const& val) -> std::shared_ptr {return sdimc.check(env,val);}, "env"_a, "instantiation"_a) .def("set_graph_preserving", &SparseMdpInstantiationModelChecker, storm::RationalNumber>::setInstantiationsAreGraphPreserving, "value"_a) ; }