Browse Source

Compatibility with refactor_pla branch

refactoring
Matthias Volk 8 years ago
parent
commit
5fa6cf2fc7
  1. 10
      src/core/result.cpp
  2. 4
      src/utility/shortestPaths.cpp

10
src/core/result.cpp

@ -1,5 +1,11 @@
#include "result.h" #include "result.h"
// Thin wrapper
template<typename ValueType>
std::vector<ValueType> getValues(storm::modelchecker::ExplicitQuantitativeCheckResult<ValueType> const& result) {
return result.getValueVector();
}
// Define python bindings // Define python bindings
void define_result(py::module& m) { void define_result(py::module& m) {
@ -53,14 +59,14 @@ void define_result(py::module& m) {
.def("at", [](storm::modelchecker::ExplicitQuantitativeCheckResult<double> const& result, storm::storage::sparse::state_type state) { .def("at", [](storm::modelchecker::ExplicitQuantitativeCheckResult<double> const& result, storm::storage::sparse::state_type state) {
return result[state]; return result[state];
}, py::arg("state"), "Get result for given state") }, py::arg("state"), "Get result for given state")
.def("get_values", &storm::modelchecker::ExplicitQuantitativeCheckResult<double>::getValueVector, "Get model checking result values for all states")
.def("get_values", &getValues<double>, "Get model checking result values for all states")
; ;
py::class_<storm::modelchecker::QuantitativeCheckResult<storm::RationalFunction>, std::shared_ptr<storm::modelchecker::QuantitativeCheckResult<storm::RationalFunction>>> parametricQuantitativeCheckResult(m, "_ParametricQuantitativeCheckResult", "Abstract class for parametric quantitative model checking results", checkResult); py::class_<storm::modelchecker::QuantitativeCheckResult<storm::RationalFunction>, std::shared_ptr<storm::modelchecker::QuantitativeCheckResult<storm::RationalFunction>>> parametricQuantitativeCheckResult(m, "_ParametricQuantitativeCheckResult", "Abstract class for parametric quantitative model checking results", checkResult);
py::class_<storm::modelchecker::ExplicitQuantitativeCheckResult<storm::RationalFunction>, std::shared_ptr<storm::modelchecker::ExplicitQuantitativeCheckResult<storm::RationalFunction>>>(m, "ExplicitParametricQuantitativeCheckResult", "Explicit parametric quantitative model checking result", parametricQuantitativeCheckResult) py::class_<storm::modelchecker::ExplicitQuantitativeCheckResult<storm::RationalFunction>, std::shared_ptr<storm::modelchecker::ExplicitQuantitativeCheckResult<storm::RationalFunction>>>(m, "ExplicitParametricQuantitativeCheckResult", "Explicit parametric quantitative model checking result", parametricQuantitativeCheckResult)
.def("at", [](storm::modelchecker::ExplicitQuantitativeCheckResult<storm::RationalFunction> const& result, storm::storage::sparse::state_type state) { .def("at", [](storm::modelchecker::ExplicitQuantitativeCheckResult<storm::RationalFunction> const& result, storm::storage::sparse::state_type state) {
return result[state]; return result[state];
}, py::arg("state"), "Get result for given state") }, py::arg("state"), "Get result for given state")
.def("get_values", &storm::modelchecker::ExplicitQuantitativeCheckResult<storm::RationalFunction>::getValueVector, "Get model checking result values for all states")
.def("get_values", &getValues<storm::RationalFunction>, "Get model checking result values for all states")
; ;
} }

4
src/utility/shortestPaths.cpp

@ -36,7 +36,7 @@ void define_ksp(py::module& m) {
.def(py::self == py::self, "Compares predecessor node and index, ignoring distance") .def(py::self == py::self, "Compares predecessor node and index, ignoring distance")
.def("__str__", &streamToString<Path>)
//.def("__str__", &streamToString<Path>)
.def_readwrite("predecessorNode", &Path::predecessorNode) // TODO (un-)wrap boost::optional so it's usable .def_readwrite("predecessorNode", &Path::predecessorNode) // TODO (un-)wrap boost::optional so it's usable
.def_readwrite("predecessorK", &Path::predecessorK) .def_readwrite("predecessorK", &Path::predecessorK)
@ -60,4 +60,4 @@ void define_ksp(py::module& m) {
.def("get_states", &ShortestPathsGenerator::getStates, "k"_a) .def("get_states", &ShortestPathsGenerator::getStates, "k"_a)
.def("get_path_as_list", &ShortestPathsGenerator::getPathAsList, "k"_a) .def("get_path_as_list", &ShortestPathsGenerator::getPathAsList, "k"_a)
; ;
}
}
Loading…
Cancel
Save