From 321f7bdcc07609a840d0eaa4c90964d04368eb94 Mon Sep 17 00:00:00 2001 From: Sebastian Junges Date: Mon, 24 Aug 2020 21:48:17 -0700 Subject: [PATCH] random step --- lib/stormpy/simulator.py | 5 +++++ src/core/simulator.cpp | 1 + 2 files changed, 6 insertions(+) diff --git a/lib/stormpy/simulator.py b/lib/stormpy/simulator.py index 52dc6be..4ef7433 100644 --- a/lib/stormpy/simulator.py +++ b/lib/stormpy/simulator.py @@ -152,6 +152,11 @@ class SparseSimulator(Simulator): def _report_rewards(self): return self._engine.get_last_reward() + def random_step(self): + check = self._engine.random_step() + assert check + return self._report_result() + def step(self, action=None): if action is None: diff --git a/src/core/simulator.cpp b/src/core/simulator.cpp index d6dce90..098dd1e 100644 --- a/src/core/simulator.cpp +++ b/src/core/simulator.cpp @@ -6,6 +6,7 @@ void define_sparse_model_simulator(py::module& m) { dtsmsd.def(py::init const&>()); dtsmsd.def("set_seed", &storm::simulator::DiscreteTimeSparseModelSimulator::setSeed, py::arg("seed")); dtsmsd.def("step", &storm::simulator::DiscreteTimeSparseModelSimulator::step, py::arg("action")); + dtsmsd.def("random_step", &storm::simulator::DiscreteTimeSparseModelSimulator::randomStep); dtsmsd.def("get_last_reward", &storm::simulator::DiscreteTimeSparseModelSimulator::getLastRewards); dtsmsd.def("get_current_state", &storm::simulator::DiscreteTimeSparseModelSimulator::getCurrentState); dtsmsd.def("reset_to_initial_state", &storm::simulator::DiscreteTimeSparseModelSimulator::resetToInitial);