diff --git a/docs/getting_started/simulator.ipynb b/docs/getting_started/simulator.ipynb index 0dbb8d1..17f6e29 100644 --- a/docs/getting_started/simulator.ipynb +++ b/docs/getting_started/simulator.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "code", - "execution_count": null, + "execution_count": 13, "id": "a8ddc37c-66d2-43e4-8162-6be19a1d70a1", "metadata": {}, "outputs": [], @@ -13,7 +13,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 14, "id": "cab40f99-3460-4497-8b9f-3d669eee1e11", "metadata": {}, "outputs": [], @@ -86,10 +86,31 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 15, "id": "eb0fadc0-7bb6-4c1d-ae3e-9e16527726ab", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "ModelType.MDP with name None\n", + "\n", + "States:\n", + "State 0 with labels ['init'] and features {}\n", + "State 1 with labels ['carchosen'] and features {}\n", + "State 2 with labels ['open'] and features {}\n", + "State 3 with labels ['goatrevealed'] and features {}\n", + "State 4 with labels ['target', 'done'] and features {}\n", + "\n", + "Transitions:\n", + "0.3333333333333333 -> State 1 with labels ['carchosen'] and features {}\n", + "1.0 -> State 2 with labels ['open'] and features {}\n", + "0.5 -> State 3 with labels ['goatrevealed'] and features {}\n", + "1.0 -> State 4 with labels ['target', 'done'] and features {}\n" + ] + } + ], "source": [ "#we want to simulate this model. That is, we start at the initial state and then\n", "#we walk through the model according to transition probabilities.\n", @@ -109,12 +130,33 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 16, "id": "59ac1e34-866c-42c4-b19b-c2a15c830e2e", "metadata": { "scrolled": true }, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "ModelType.MDP with name None\n", + "\n", + "States:\n", + "State 0 with labels ['init'] and features {}\n", + "State 1 with labels ['carchosen'] and features {}\n", + "State 2 with labels ['open'] and features {}\n", + "State 3 with labels ['goatrevealed'] and features {}\n", + "State 4 with labels ['done'] and features {}\n", + "\n", + "Transitions:\n", + "0.3333333333333333 -> State 1 with labels ['carchosen'] and features {}\n", + "1.0 -> State 2 with labels ['open'] and features {}\n", + "1.0 -> State 3 with labels ['goatrevealed'] and features {}\n", + "1.0 -> State 4 with labels ['done'] and features {}\n" + ] + } + ], "source": [ "#it still chooses random actions but we can prevent this by providing a scheduler:\n", "taken_actions = {}\n", @@ -128,10 +170,63 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 17, "id": "22871288-755c-463f-9150-f207c2f5c211", "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "dedb21bb36f34f78926a65af349155a0", + "version_major": 2, + "version_minor": 0 + }, + "text/plain": [ + "Output()" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "a99224b532bf40dab9b7e7018bed689f", + "version_major": 2, + "version_minor": 0 + }, + "text/plain": [ + "Output()" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "28879179b6684e7789aefe922d77d759", + "version_major": 2, + "version_minor": 0 + }, + "text/plain": [ + "HBox(children=(Output(), Output()))" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/plain": [ + "" + ] + }, + "execution_count": 17, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "#we can also visualize the partial model that we get from the simulator:\n", "show.show(partial_model)\n" @@ -139,10 +234,18 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 18, "id": "34d0c293-d090-4e3d-9e80-4351f5fcba62", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "initial state --(action: empty)--> state: 2 --(action: open0)--> state: 7 --(action: empty)--> state: 17 --(action: stay)--> state: 33\n" + ] + } + ], "source": [ "#we can also use another simulator function that returns a path instead of a partial model:\n", "path = stormvogel.simulator.simulate_path(mdp, steps=4, scheduler=scheduler, seed=123456)\n", @@ -161,9 +264,9 @@ ], "metadata": { "kernelspec": { - "display_name": "Python (stormvogel)", + "display_name": ".venv", "language": "python", - "name": "stormvogel-env" + "name": "python3" }, "language_info": { "codemirror_mode": { @@ -175,7 +278,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.12.7" + "version": "3.12.6" } }, "nbformat": 4,