Skip to content

Commit

Permalink
progress on new fast explore
Browse files Browse the repository at this point in the history
  • Loading branch information
YouGuessedMyName committed Feb 3, 2025
1 parent 09ca5a8 commit e2ade55
Show file tree
Hide file tree
Showing 12 changed files with 1,188 additions and 2,779 deletions.
301 changes: 266 additions & 35 deletions docs/getting_started/01_study.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -155,49 +155,272 @@
},
{
"cell_type": "code",
"execution_count": 14,
"execution_count": 8,
"id": "0df1511e-565d-45d0-93a8-adafbfaaaefa",
"metadata": {
"scrolled": true
},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "bd157ce6c3034fd5a0533f8220e44c9e",
"version_major": 2,
"version_minor": 0
},
"text/html": [
"\n",
" <iframe\n",
" id=\"studyWiVmwOCnEO\"\n",
" width=\"820\"\n",
" height=\"620\"\n",
" frameborder=\"0\"\n",
" srcdoc=\"\n",
"&lt;!DOCTYPE html&gt;\n",
"&lt;html lang=&quot;en&quot;&gt;\n",
" &lt;head&gt;\n",
" &lt;title&gt;Network&lt;/title&gt;\n",
" &lt;script\n",
" type=&quot;text/javascript&quot;\n",
" src=&quot;https://unpkg.com/vis-network/standalone/umd/vis-network.min.js&quot;\n",
" &gt;&lt;/script&gt;\n",
" &lt;style type=&quot;text/css&quot;&gt;\n",
" #mynetwork {\n",
" \n",
" width: 800px;\n",
" height: 600px;\n",
" border: 1px solid lightgray;\n",
" \n",
" }\n",
" &lt;/style&gt;\n",
" &lt;/head&gt;\n",
" &lt;body&gt;\n",
" &lt;div id=&quot;mynetwork&quot;&gt;&lt;/div&gt;\n",
" &lt;script type=&quot;text/javascript&quot;&gt;\n",
" \n",
" var nodes = new vis.DataSet([{ id: 0, label: `init`, group: &quot;states&quot;, x: -27, y: -203 },\n",
"{ id: 1, label: `studied\n",
"\u20ac\tR: 0`, group: &quot;states&quot;, x: -84, y: -6 },\n",
"{ id: 2, label: `didn&#x27;t study\n",
"\u20ac\tR: 15`, group: &quot;states&quot;, x: 57, y: -10 },\n",
"{ id: 3, label: `pass test\n",
"\u20ac\tR: 100`, group: &quot;states&quot;, x: -56, y: 102 },\n",
"{ id: 4, label: `fail test\n",
"\u20ac\tR: 0`, group: &quot;states&quot;, x: 58, y: 61 },\n",
"{ id: 5, label: `end\n",
"\u20ac\tR: 0`, group: &quot;states&quot;, x: 24, y: 187 },\n",
"{ id: 10000000000, label: `study\n",
"\u20ac\tR: 0`, group: &quot;actions&quot;, x: -136, y: -127 },\n",
"{ id: 10000000001, label: `don&#x27;t study\n",
"\u20ac\tR: 0`, group: &quot;actions&quot;, x: 77, y: -144 },\n",
"]);\n",
" var edges = new vis.DataSet([{ from: 0, to: 10000000000 },\n",
"{ from: 10000000000, to: 1, label: &quot;1&quot; },\n",
"{ from: 0, to: 10000000001 },\n",
"{ from: 10000000001, to: 2, label: &quot;1&quot; },\n",
"{ from: 1, to: 3, label: &quot;9/10&quot; },\n",
"{ from: 1, to: 4, label: &quot;1/10&quot; },\n",
"{ from: 2, to: 3, label: &quot;2/5&quot; },\n",
"{ from: 2, to: 4, label: &quot;3/5&quot; },\n",
"{ from: 3, to: 5, label: &quot;1&quot; },\n",
"{ from: 4, to: 5, label: &quot;1&quot; },\n",
"]);\n",
" var options = {\n",
" &quot;__fake_macros&quot;: {\n",
" &quot;__group_macro&quot;: {\n",
" &quot;borderWidth&quot;: 1,\n",
" &quot;color&quot;: {\n",
" &quot;background&quot;: &quot;white&quot;,\n",
" &quot;border&quot;: &quot;black&quot;,\n",
" &quot;highlight&quot;: {\n",
" &quot;background&quot;: &quot;white&quot;,\n",
" &quot;border&quot;: &quot;red&quot;\n",
" }\n",
" },\n",
" &quot;shape&quot;: &quot;ellipse&quot;,\n",
" &quot;mass&quot;: 1,\n",
" &quot;font&quot;: {\n",
" &quot;color&quot;: &quot;black&quot;,\n",
" &quot;size&quot;: 14\n",
" }\n",
" }\n",
" },\n",
" &quot;groups&quot;: {\n",
" &quot;states&quot;: {\n",
" &quot;borderWidth&quot;: 1,\n",
" &quot;color&quot;: {\n",
" &quot;background&quot;: &quot;#8ff0a4&quot;,\n",
" &quot;border&quot;: &quot;black&quot;,\n",
" &quot;highlight&quot;: {\n",
" &quot;background&quot;: &quot;white&quot;,\n",
" &quot;border&quot;: &quot;red&quot;\n",
" }\n",
" },\n",
" &quot;shape&quot;: &quot;ellipse&quot;,\n",
" &quot;mass&quot;: 1,\n",
" &quot;font&quot;: {\n",
" &quot;color&quot;: &quot;black&quot;,\n",
" &quot;size&quot;: 14\n",
" }\n",
" },\n",
" &quot;actions&quot;: {\n",
" &quot;borderWidth&quot;: 1,\n",
" &quot;color&quot;: {\n",
" &quot;background&quot;: &quot;#ffc0cb&quot;,\n",
" &quot;border&quot;: &quot;black&quot;,\n",
" &quot;highlight&quot;: {\n",
" &quot;background&quot;: &quot;white&quot;,\n",
" &quot;border&quot;: &quot;red&quot;\n",
" }\n",
" },\n",
" &quot;shape&quot;: &quot;box&quot;,\n",
" &quot;mass&quot;: 1,\n",
" &quot;font&quot;: {\n",
" &quot;color&quot;: &quot;black&quot;,\n",
" &quot;size&quot;: 14\n",
" }\n",
" },\n",
" &quot;scheduled_actions&quot;: {\n",
" &quot;borderWidth&quot;: 1,\n",
" &quot;color&quot;: {\n",
" &quot;background&quot;: &quot;pink&quot;,\n",
" &quot;border&quot;: &quot;black&quot;,\n",
" &quot;highlight&quot;: {\n",
" &quot;background&quot;: &quot;white&quot;,\n",
" &quot;border&quot;: &quot;red&quot;\n",
" }\n",
" },\n",
" &quot;shape&quot;: &quot;box&quot;,\n",
" &quot;mass&quot;: 1,\n",
" &quot;font&quot;: {\n",
" &quot;color&quot;: &quot;black&quot;,\n",
" &quot;size&quot;: 14\n",
" },\n",
" &quot;schedColor&quot;: false\n",
" }\n",
" },\n",
" &quot;reload_button&quot;: false,\n",
" &quot;edges&quot;: {\n",
" &quot;arrows&quot;: &quot;to&quot;,\n",
" &quot;font&quot;: {\n",
" &quot;color&quot;: &quot;black&quot;,\n",
" &quot;size&quot;: 14\n",
" },\n",
" &quot;color&quot;: {\n",
" &quot;color&quot;: &quot;black&quot;\n",
" }\n",
" },\n",
" &quot;numbers&quot;: {\n",
" &quot;fractions&quot;: true,\n",
" &quot;digits&quot;: 5\n",
" },\n",
" &quot;state_properties&quot;: {\n",
" &quot;show_results&quot;: true,\n",
" &quot;result_symbol&quot;: &quot;\\u2606&quot;,\n",
" &quot;show_rewards&quot;: true,\n",
" &quot;reward_symbol&quot;: &quot;\\u20ac&quot;,\n",
" &quot;show_zero_rewards&quot;: true,\n",
" &quot;show_observations&quot;: true,\n",
" &quot;observation_symbol&quot;: &quot;\\u0298&quot;\n",
" },\n",
" &quot;layout&quot;: {\n",
" &quot;randomSeed&quot;: 5\n",
" },\n",
" &quot;misc&quot;: {\n",
" &quot;enable_physics&quot;: true,\n",
" &quot;width&quot;: 800,\n",
" &quot;height&quot;: 600,\n",
" &quot;explore&quot;: false\n",
" },\n",
" &quot;saving&quot;: {\n",
" &quot;relative_path&quot;: true,\n",
" &quot;filename&quot;: &quot;layouts/pinkgreen.json&quot;,\n",
" &quot;save_button&quot;: false,\n",
" &quot;load_button&quot;: false\n",
" },\n",
" &quot;positions&quot;: {\n",
" &quot;0&quot;: {\n",
" &quot;x&quot;: -27,\n",
" &quot;y&quot;: -203\n",
" },\n",
" &quot;1&quot;: {\n",
" &quot;x&quot;: -84,\n",
" &quot;y&quot;: -6\n",
" },\n",
" &quot;2&quot;: {\n",
" &quot;x&quot;: 57,\n",
" &quot;y&quot;: -10\n",
" },\n",
" &quot;3&quot;: {\n",
" &quot;x&quot;: -56,\n",
" &quot;y&quot;: 102\n",
" },\n",
" &quot;4&quot;: {\n",
" &quot;x&quot;: 58,\n",
" &quot;y&quot;: 61\n",
" },\n",
" &quot;5&quot;: {\n",
" &quot;x&quot;: 24,\n",
" &quot;y&quot;: 187\n",
" },\n",
" &quot;10000000000&quot;: {\n",
" &quot;x&quot;: -136,\n",
" &quot;y&quot;: -127\n",
" },\n",
" &quot;10000000001&quot;: {\n",
" &quot;x&quot;: 77,\n",
" &quot;y&quot;: -144\n",
" }\n",
" },\n",
" &quot;width&quot;: 800,\n",
" &quot;height&quot;: 600,\n",
" &quot;physics&quot;: true,\n",
" &quot;results_and_rewards&quot;: {\n",
" &quot;show_results&quot;: true,\n",
" &quot;resultSymbol&quot;: &quot;\\u2606&quot;,\n",
" &quot;show_rewards&quot;: true\n",
" }\n",
"};\n",
" //js\n",
"var container = document.getElementById(&quot;mynetwork&quot;);\n",
"var data = {\n",
" nodes: nodes,\n",
" edges: edges,\n",
"};\n",
"var network = new vis.Network(container, data, options);\n",
"function makeAllNodesInvisible() {\n",
" ids = nodes.getIds();\n",
" for (let i = 0; i &lt; ids.length; i++) {\n",
" var nodeId = ids[i];\n",
" var node = nodes.get(nodeId);\n",
" node[&quot;hidden&quot;] = true;\n",
" nodes.update(node);\n",
" }\n",
"};\n",
"function makeNeighborsVisible(myNode) {\n",
" var ids = network.getConnectedNodes(myNode, &#x27;to&#x27;);\n",
" for (let i = 0; i &lt; ids.length; i++) {\n",
" var nodeId = ids[i];\n",
" var node = nodes.get(nodeId);\n",
" node[&quot;hidden&quot;] = false;\n",
" nodes.update(node);\n",
" }\n",
"};\n",
"function makeNodeVisible(nodeId) {\n",
" var node = nodes.get(nodeId);\n",
" node[&quot;hidden&quot;] = false;\n",
" nodes.update(node);\n",
"};\n",
"network.on( &#x27;click&#x27;, function(properties) {\n",
" var nodeId = network.getNodeAt({x:properties.event.srcEvent.offsetX, y:properties.event.srcEvent.offsetY});\n",
" makeNeighborsVisible(nodeId);\n",
"});\n",
"\n",
" &lt;/script&gt;\n",
" &lt;/body&gt;\n",
"&lt;/html&gt;\n",
"\"\n",
" border:none !important;\n",
" allowfullscreen webkitallowfullscreen mozallowfullscreen\n",
" ></iframe>"
],
"text/plain": [
"Output()"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "f7080afa9cce47deb47ef9c1b145ce71",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"Output()"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "69b3da5b0e884431b9cb84d758067af4",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"HBox(children=(Output(), Output()))"
"<IPython.core.display.HTML object>"
]
},
"metadata": {},
Expand All @@ -215,6 +438,14 @@
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"id": "66194433-81f1-4a95-898f-7c7ba920bb25",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
Expand Down
Loading

0 comments on commit e2ade55

Please sign in to comment.