Browse Source

random step

refactoring
Sebastian Junges 4 years ago
parent
commit
321f7bdcc0
  1. 5
      lib/stormpy/simulator.py
  2. 1
      src/core/simulator.cpp

5
lib/stormpy/simulator.py

@ -152,6 +152,11 @@ class SparseSimulator(Simulator):
def _report_rewards(self): def _report_rewards(self):
return self._engine.get_last_reward() 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): def step(self, action=None):
if action is None: if action is None:

1
src/core/simulator.cpp

@ -6,6 +6,7 @@ void define_sparse_model_simulator(py::module& m) {
dtsmsd.def(py::init<storm::models::sparse::Model<double> const&>()); dtsmsd.def(py::init<storm::models::sparse::Model<double> const&>());
dtsmsd.def("set_seed", &storm::simulator::DiscreteTimeSparseModelSimulator<double>::setSeed, py::arg("seed")); dtsmsd.def("set_seed", &storm::simulator::DiscreteTimeSparseModelSimulator<double>::setSeed, py::arg("seed"));
dtsmsd.def("step", &storm::simulator::DiscreteTimeSparseModelSimulator<double>::step, py::arg("action")); dtsmsd.def("step", &storm::simulator::DiscreteTimeSparseModelSimulator<double>::step, py::arg("action"));
dtsmsd.def("random_step", &storm::simulator::DiscreteTimeSparseModelSimulator<double>::randomStep);
dtsmsd.def("get_last_reward", &storm::simulator::DiscreteTimeSparseModelSimulator<double>::getLastRewards); dtsmsd.def("get_last_reward", &storm::simulator::DiscreteTimeSparseModelSimulator<double>::getLastRewards);
dtsmsd.def("get_current_state", &storm::simulator::DiscreteTimeSparseModelSimulator<double>::getCurrentState); dtsmsd.def("get_current_state", &storm::simulator::DiscreteTimeSparseModelSimulator<double>::getCurrentState);
dtsmsd.def("reset_to_initial_state", &storm::simulator::DiscreteTimeSparseModelSimulator<double>::resetToInitial); dtsmsd.def("reset_to_initial_state", &storm::simulator::DiscreteTimeSparseModelSimulator<double>::resetToInitial);

Loading…
Cancel
Save