.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/demo_agents/video_plot_mbqvi.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code .. rst-class:: sphx-glr-example-title .. _sphx_glr_auto_examples_demo_agents_video_plot_mbqvi.py: ================================================== A demo of MBQVI algorithm in Gridworld environment ================================================== Illustration of how to set up an MBQVI algorithm in rlberry. The environment chosen here is GridWorld environment. .. video:: ../../video_plot_mbqvi.mp4 :width: 600 .. GENERATED FROM PYTHON SOURCE LINES 12-34 .. code-block:: python3 from rlberry_scool.agents.mbqvi import MBQVIAgent from rlberry_research.envs.finite import GridWorld params = {} params["n_samples"] = 100 # samples per state-action pair params["gamma"] = 0.99 params["horizon"] = None env = GridWorld(7, 10, walls=((2, 2), (3, 3)), success_probability=0.6) agent = MBQVIAgent(env, **params) info = agent.fit() print(info) # evaluate policy in a deterministic version of the environment env_eval = GridWorld(7, 10, walls=((2, 2), (3, 3)), success_probability=1.0) env_eval.enable_rendering() state, info = env_eval.reset() for tt in range(50): action = agent.policy(state) next_s, _, _, _, _ = env_eval.step(action) state = next_s video = env_eval.save_video("_video/video_plot_mbqvi.mp4") .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.000 seconds) .. _sphx_glr_download_auto_examples_demo_agents_video_plot_mbqvi.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: video_plot_mbqvi.py ` .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: video_plot_mbqvi.ipynb ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_