Browse Source

added gspn_builder class

refactoring
hannah 5 years ago
committed by Matthias Volk
parent
commit
00569096f9
  1. 27
      src/gspn/gspn.cpp
  2. 2
      src/gspn/gspn.h
  3. 10
      tests/gspn/test_gspn.py

27
src/gspn/gspn.cpp

@ -5,14 +5,35 @@
#include "storm/settings/SettingsManager.h" #include "storm/settings/SettingsManager.h"
typedef storm::gspn::GSPN GSPN;
using GSPN = storm::gspn::GSPN;
using GSPNBuilder = storm::gspn::GspnBuilder;
void define_gspn(py::module& m) { void define_gspn(py::module& m) {
// GSPN class // GSPN class
py::class_<GSPN, std::shared_ptr<GSPN>>(m, "GSPN", "Generalized Stochastic Petri Net") py::class_<GSPN, std::shared_ptr<GSPN>>(m, "GSPN", "Generalized Stochastic Petri Net")
.def("name", &GSPN::getName, "Name of GSPN") .def("name", &GSPN::getName, "Name of GSPN")
// todo getter
; ;
//}
// todo ? void define_gspn_builder(py::module& m) {
// GSPN_Builder class
py::class_<GSPNBuilder, std::shared_ptr<GSPNBuilder>>(m, "GSPNBuilder", "Generalized Stochastic Petri Net Builder")
.def(py::init(), "Constructor")
.def("set_name", &GSPNBuilder::setGspnName, "Name of GSPN", py::arg("name"))
//.def("add_place", &GSPNBuilder::addPlace, "Add a place to the gspn", py::arg("todo"))
//.def("set_place_layout_info", &GSPNBuilder::setPlaceLayoutInfo, "Layout"py::arg("todo"))
//addImmediateTransition
//addTimedTransition
//addTimedTransition
//setTransitionLayoutInfo
//addInputArc todo overloaded fcts
//addInhibitionArc //todo overloaded fcts
//addOutputArc //todo overloaded fcts
//addNormalArc
.def("build_gspn", &GSPNBuilder::buildGspn, "Construct GSPN", py::arg("exprManager") = nullptr, py::arg("constantsSubstitution") = std::map<storm::expressions::Variable, storm::expressions::Expression>())
// todo py::arg(...
// , py::arg("constantsSubstitution") = std::map<storm::expressions::Variable, storm::expressions::Expression>()
// todo: argument ExpressionManager, map <Variable,Expression> constantsSubstitution (aufrufe auch ohne args)
;
} }

2
src/gspn/gspn.h

@ -3,3 +3,5 @@
#include "common.h" #include "common.h"
void define_gspn(py::module& m); void define_gspn(py::module& m);
// todo ? void define_gspn_builder(py::module& m);

10
tests/gspn/test_gspn.py

@ -9,4 +9,12 @@ from configurations import gspn
@gspn @gspn
class TestGSPNBuilder: class TestGSPNBuilder:
def test_build_gspn(self): def test_build_gspn(self):
assert True
# assert True
# builder: ~/storm/src/storm-dft/transformations/DFTToGSPNTransformator.cpp
name = "gspn_test"
builder = stormpy.gspn.GSPNBuilder()
builder.set_name(name)
gspn = builder.build_gspn()
assert gspn.name() == name
Loading…
Cancel
Save