Sebastian Junges
7 years ago
9 changed files with 63 additions and 2 deletions
-
25examples/schedulers/01-schedulers.py
-
5lib/stormpy/__init__.py
-
4lib/stormpy/examples/files.py
-
2src/core/modelchecking.cpp
-
2src/core/result.cpp
-
2src/mod_storage.cpp
-
18src/storage/scheduler.cpp
-
6src/storage/scheduler.h
-
1tests/core/test_modelchecking.py
@ -0,0 +1,25 @@ |
|||||
|
import stormpy |
||||
|
import stormpy.core |
||||
|
|
||||
|
import stormpy.examples |
||||
|
import stormpy.examples.files |
||||
|
|
||||
|
|
||||
|
def example_schedulers_01(): |
||||
|
path = stormpy.examples.files.prism_mdp_coin_2_2 |
||||
|
|
||||
|
formula_str = "Pmin=? [F \"finished\" & \"all_coins_equal_1\"]" |
||||
|
|
||||
|
program = stormpy.parse_prism_program(path) |
||||
|
formulas = stormpy.parse_properties_for_prism_program(formula_str, program) |
||||
|
model = stormpy.build_model(program, formulas) |
||||
|
initial_state = model.initial_states[0] |
||||
|
assert initial_state == 0 |
||||
|
result = stormpy.model_checking(model, formulas[0], extract_scheduler = True) |
||||
|
assert result.has_scheduler |
||||
|
print(result.scheduler) |
||||
|
|
||||
|
|
||||
|
|
||||
|
if __name__ == '__main__': |
||||
|
example_schedulers_01() |
@ -0,0 +1,18 @@ |
|||||
|
#include "scheduler.h"
|
||||
|
#include "src/helpers.h"
|
||||
|
|
||||
|
#include "storm/storage/Scheduler.h"
|
||||
|
|
||||
|
void define_scheduler(py::module& m) { |
||||
|
using Scheduler = storm::storage::Scheduler<double>; |
||||
|
|
||||
|
py::class_<Scheduler, std::shared_ptr<storm::storage::Scheduler<double>>> scheduler(m, "Scheduler", "A Finite Memory Scheduler"); |
||||
|
scheduler |
||||
|
.def("__str__", [](Scheduler const& s) { |
||||
|
std::stringstream str; |
||||
|
s.printToStream(str); |
||||
|
return str.str(); |
||||
|
}) |
||||
|
; |
||||
|
|
||||
|
} |
@ -0,0 +1,6 @@ |
|||||
|
#pragma once |
||||
|
|
||||
|
#include "common.h" |
||||
|
|
||||
|
|
||||
|
void define_scheduler(py::module& m); |
Write
Preview
Loading…
Cancel
Save
Reference in new issue