|
@ -2,6 +2,7 @@ |
|
|
#include <storm/storage/jani/Model.h>
|
|
|
#include <storm/storage/jani/Model.h>
|
|
|
#include <storm/storage/jani/JSONExporter.h>
|
|
|
#include <storm/storage/jani/JSONExporter.h>
|
|
|
#include <storm/storage/expressions/ExpressionManager.h>
|
|
|
#include <storm/storage/expressions/ExpressionManager.h>
|
|
|
|
|
|
#include <storm/logic/RewardAccumulationEliminationVisitor.h>
|
|
|
#include "src/helpers.h"
|
|
|
#include "src/helpers.h"
|
|
|
|
|
|
|
|
|
using namespace storm::jani; |
|
|
using namespace storm::jani; |
|
@ -29,16 +30,21 @@ void define_jani(py::module& m) { |
|
|
.def_static("encode_edge_and_automaton_index", &Model::encodeAutomatonAndEdgeIndices, "get edge/automaton-index") |
|
|
.def_static("encode_edge_and_automaton_index", &Model::encodeAutomatonAndEdgeIndices, "get edge/automaton-index") |
|
|
.def_static("decode_edge_and_automaton_index", &Model::decodeAutomatonAndEdgeIndices, "get edge and automaton from edge/automaton index") |
|
|
.def_static("decode_edge_and_automaton_index", &Model::decodeAutomatonAndEdgeIndices, "get edge and automaton from edge/automaton index") |
|
|
; |
|
|
; |
|
|
|
|
|
|
|
|
py::class_<Automaton, std::shared_ptr<Automaton>> automaton(m, "JaniAutomaton", "A Jani Automation"); |
|
|
py::class_<Automaton, std::shared_ptr<Automaton>> automaton(m, "JaniAutomaton", "A Jani Automation"); |
|
|
automaton.def_property_readonly("edges",[](const Automaton& a) {return a.getEdges();}, "get edges") |
|
|
automaton.def_property_readonly("edges",[](const Automaton& a) {return a.getEdges();}, "get edges") |
|
|
.def_property_readonly("name", &Automaton::getName); |
|
|
|
|
|
|
|
|
.def_property_readonly("name", &Automaton::getName) |
|
|
|
|
|
; |
|
|
|
|
|
|
|
|
py::class_<Edge, std::shared_ptr<Edge>> edge(m, "JaniEdge", "A Jani Edge"); |
|
|
py::class_<Edge, std::shared_ptr<Edge>> edge(m, "JaniEdge", "A Jani Edge"); |
|
|
edge.def_property_readonly("source_location_index", &Edge::getSourceLocationIndex, "index for source location") |
|
|
edge.def_property_readonly("source_location_index", &Edge::getSourceLocationIndex, "index for source location") |
|
|
.def_property_readonly("destinations", &Edge::getDestinations, "edge destinations") |
|
|
.def_property_readonly("destinations", &Edge::getDestinations, "edge destinations") |
|
|
.def_property_readonly("nr_destinations", &Edge::getNumberOfDestinations, "nr edge destinations") |
|
|
.def_property_readonly("nr_destinations", &Edge::getNumberOfDestinations, "nr edge destinations") |
|
|
.def_property_readonly("guard", &Edge::getGuard, "edge guard") |
|
|
.def_property_readonly("guard", &Edge::getGuard, "edge guard") |
|
|
.def("substitute", &Edge::substitute, py::arg("mapping")) |
|
|
.def("substitute", &Edge::substitute, py::arg("mapping")) |
|
|
.def("has_silent_action", &Edge::hasSilentAction, "Is the edge labelled with the silent action"); |
|
|
|
|
|
|
|
|
.def("has_silent_action", &Edge::hasSilentAction, "Is the edge labelled with the silent action") |
|
|
|
|
|
; |
|
|
|
|
|
|
|
|
py::class_<TemplateEdge, std::shared_ptr<TemplateEdge>> templateEdge(m, "JaniTemplateEdge", "Template edge, internal data structure for edges"); |
|
|
py::class_<TemplateEdge, std::shared_ptr<TemplateEdge>> templateEdge(m, "JaniTemplateEdge", "Template edge, internal data structure for edges"); |
|
|
templateEdge.def(py::init<storm::expressions::Expression>()); |
|
|
templateEdge.def(py::init<storm::expressions::Expression>()); |
|
|
|
|
|
|
|
@ -47,21 +53,33 @@ void define_jani(py::module& m) { |
|
|
.def_property_readonly("probability", &EdgeDestination::getProbability) |
|
|
.def_property_readonly("probability", &EdgeDestination::getProbability) |
|
|
.def_property_readonly("assignments", &EdgeDestination::getOrderedAssignments) |
|
|
.def_property_readonly("assignments", &EdgeDestination::getOrderedAssignments) |
|
|
; |
|
|
; |
|
|
|
|
|
|
|
|
py::class_<OrderedAssignments, std::shared_ptr<OrderedAssignments>> orderedAssignments(m, "JaniOrderedAssignments", "Set of assignments"); |
|
|
py::class_<OrderedAssignments, std::shared_ptr<OrderedAssignments>> orderedAssignments(m, "JaniOrderedAssignments", "Set of assignments"); |
|
|
orderedAssignments.def("__iter__", [](OrderedAssignments &v) { |
|
|
orderedAssignments.def("__iter__", [](OrderedAssignments &v) { |
|
|
return py::make_iterator(v.begin(), v.end()); |
|
|
return py::make_iterator(v.begin(), v.end()); |
|
|
}, py::keep_alive<0, 1>()) /* Keep vector alive while iterator is used */ |
|
|
}, py::keep_alive<0, 1>()) /* Keep vector alive while iterator is used */ |
|
|
.def("__str__", &streamToString<OrderedAssignments>) |
|
|
.def("__str__", &streamToString<OrderedAssignments>) |
|
|
; |
|
|
; |
|
|
|
|
|
|
|
|
py::class_<Assignment, std::shared_ptr<Assignment>> assignment(m, "JaniAssignment", "Jani Assignment"); |
|
|
py::class_<Assignment, std::shared_ptr<Assignment>> assignment(m, "JaniAssignment", "Jani Assignment"); |
|
|
assignment.def("__str__", &streamToString<Assignment>) |
|
|
assignment.def("__str__", &streamToString<Assignment>) |
|
|
.def_property("expression", &Assignment::getAssignedExpression, &Assignment::setAssignedExpression) |
|
|
.def_property("expression", &Assignment::getAssignedExpression, &Assignment::setAssignedExpression) |
|
|
; |
|
|
; |
|
|
|
|
|
|
|
|
py::class_<Constant, std::shared_ptr<Constant>> constant(m, "JaniConstant", "A Constant in JANI"); |
|
|
py::class_<Constant, std::shared_ptr<Constant>> constant(m, "JaniConstant", "A Constant in JANI"); |
|
|
constant.def_property_readonly("defined", &Constant::isDefined, "is constant defined by some expression") |
|
|
constant.def_property_readonly("defined", &Constant::isDefined, "is constant defined by some expression") |
|
|
.def_property_readonly("name", &Constant::getName, "name of constant") |
|
|
.def_property_readonly("name", &Constant::getName, "name of constant") |
|
|
.def_property_readonly("type", &Constant::getType, "type of constant") |
|
|
.def_property_readonly("type", &Constant::getType, "type of constant") |
|
|
.def_property_readonly("expression_variable", &Constant::getExpressionVariable, "expression variable for this constant"); |
|
|
|
|
|
|
|
|
.def_property_readonly("expression_variable", &Constant::getExpressionVariable, "expression variable for this constant") |
|
|
|
|
|
; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
m.def("eliminate_reward_accumulations", [](const Model& model, std::vector<Property>& properties) { |
|
|
|
|
|
storm::logic::RewardAccumulationEliminationVisitor v(model); |
|
|
|
|
|
v.eliminateRewardAccumulations(properties); |
|
|
|
|
|
return properties; |
|
|
|
|
|
}, "Eliminate reward accumulations", py::arg("model"), py::arg("properties")); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |