Skip to content

Commit 4f7418a

Browse files
fix crashing introduction notebook
1 parent 0ef709d commit 4f7418a

File tree

3 files changed

+718
-95
lines changed

3 files changed

+718
-95
lines changed

docs/introduction/2-2-Building-mdps.ipynb

+51-38
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
},
2727
{
2828
"cell_type": "code",
29-
"execution_count": 44,
29+
"execution_count": 1,
3030
"id": "c17bcd9a-7f79-4a36-90be-baf204c5876c",
3131
"metadata": {},
3232
"outputs": [
@@ -35,7 +35,7 @@
3535
"text/html": [
3636
"\n",
3737
" <iframe\n",
38-
" id=\"studygyxCRwuviL\"\n",
38+
" id=\"studyKcPvKaujLJ\"\n",
3939
" width=\"820\"\n",
4040
" height=\"620\"\n",
4141
" frameborder=\"0\"\n",
@@ -134,40 +134,40 @@
134134
" &quot;size&quot;: 14\n",
135135
" }\n",
136136
" },\n",
137-
" &quot;states&quot;: {\n",
138-
" &quot;borderWidth&quot;: 1,\n",
137+
" &quot;scheduled_actions&quot;: {\n",
138+
" &quot;shape&quot;: &quot;box&quot;,\n",
139139
" &quot;color&quot;: {\n",
140-
" &quot;background&quot;: &quot;#8ff0a4&quot;,\n",
140+
" &quot;background&quot;: &quot;pink&quot;,\n",
141141
" &quot;border&quot;: &quot;black&quot;,\n",
142142
" &quot;highlight&quot;: {\n",
143143
" &quot;background&quot;: &quot;white&quot;,\n",
144144
" &quot;border&quot;: &quot;red&quot;\n",
145145
" }\n",
146146
" },\n",
147-
" &quot;shape&quot;: &quot;ellipse&quot;,\n",
147+
" &quot;borderWidth&quot;: 1,\n",
148148
" &quot;mass&quot;: 1,\n",
149149
" &quot;font&quot;: {\n",
150150
" &quot;color&quot;: &quot;black&quot;,\n",
151151
" &quot;size&quot;: 14\n",
152-
" }\n",
152+
" },\n",
153+
" &quot;schedColor&quot;: false\n",
153154
" },\n",
154-
" &quot;scheduled_actions&quot;: {\n",
155+
" &quot;states&quot;: {\n",
155156
" &quot;borderWidth&quot;: 1,\n",
156157
" &quot;color&quot;: {\n",
157-
" &quot;background&quot;: &quot;pink&quot;,\n",
158+
" &quot;background&quot;: &quot;#8ff0a4&quot;,\n",
158159
" &quot;border&quot;: &quot;black&quot;,\n",
159160
" &quot;highlight&quot;: {\n",
160161
" &quot;background&quot;: &quot;white&quot;,\n",
161162
" &quot;border&quot;: &quot;red&quot;\n",
162163
" }\n",
163164
" },\n",
164-
" &quot;shape&quot;: &quot;box&quot;,\n",
165+
" &quot;shape&quot;: &quot;ellipse&quot;,\n",
165166
" &quot;mass&quot;: 1,\n",
166167
" &quot;font&quot;: {\n",
167168
" &quot;color&quot;: &quot;black&quot;,\n",
168169
" &quot;size&quot;: 14\n",
169-
" },\n",
170-
" &quot;schedColor&quot;: false\n",
170+
" }\n",
171171
" }\n",
172172
" },\n",
173173
" &quot;reload_button&quot;: false,\n",
@@ -307,6 +307,11 @@
307307
"network.on( &#x27;doubleClick&#x27;, function(properties) {\n",
308308
" network.setData(data);\n",
309309
"});\n",
310+
"function setNodeColor(id, color) {\n",
311+
" var node = nodes.get(id);\n",
312+
" node[&quot;color&quot;] = color\n",
313+
" nodes.update(node);\n",
314+
"}\n",
310315
"\n",
311316
" &lt;/script&gt;\n",
312317
" &lt;/body&gt;\n",
@@ -367,14 +372,14 @@
367372
" available_actions=available_actions,\n",
368373
" labels=labels,\n",
369374
" modeltype=ModelType.MDP,\n",
370-
" rewards=reward\n",
375+
" rewards=rewards\n",
371376
")\n",
372377
"vis = show(pgc_study, layout=Layout(\"layouts/pinkgreen.json\"), name=\"study\")"
373378
]
374379
},
375380
{
376381
"cell_type": "code",
377-
"execution_count": 28,
382+
"execution_count": 2,
378383
"id": "4001c6f3-8c6c-4533-8dc5-6215e13fed37",
379384
"metadata": {},
380385
"outputs": [
@@ -383,7 +388,7 @@
383388
"text/html": [
384389
"\n",
385390
" <iframe\n",
386-
" id=\"studyaBRfBOLfLN\"\n",
391+
" id=\"studyseEKlSJXhW\"\n",
387392
" width=\"820\"\n",
388393
" height=\"620\"\n",
389394
" frameborder=\"0\"\n",
@@ -481,40 +486,40 @@
481486
" &quot;size&quot;: 14\n",
482487
" }\n",
483488
" },\n",
484-
" &quot;states&quot;: {\n",
485-
" &quot;borderWidth&quot;: 1,\n",
489+
" &quot;scheduled_actions&quot;: {\n",
490+
" &quot;shape&quot;: &quot;box&quot;,\n",
486491
" &quot;color&quot;: {\n",
487-
" &quot;background&quot;: &quot;#8ff0a4&quot;,\n",
492+
" &quot;background&quot;: &quot;pink&quot;,\n",
488493
" &quot;border&quot;: &quot;black&quot;,\n",
489494
" &quot;highlight&quot;: {\n",
490495
" &quot;background&quot;: &quot;white&quot;,\n",
491496
" &quot;border&quot;: &quot;red&quot;\n",
492497
" }\n",
493498
" },\n",
494-
" &quot;shape&quot;: &quot;ellipse&quot;,\n",
499+
" &quot;borderWidth&quot;: 1,\n",
495500
" &quot;mass&quot;: 1,\n",
496501
" &quot;font&quot;: {\n",
497502
" &quot;color&quot;: &quot;black&quot;,\n",
498503
" &quot;size&quot;: 14\n",
499-
" }\n",
504+
" },\n",
505+
" &quot;schedColor&quot;: false\n",
500506
" },\n",
501-
" &quot;scheduled_actions&quot;: {\n",
507+
" &quot;states&quot;: {\n",
502508
" &quot;borderWidth&quot;: 1,\n",
503509
" &quot;color&quot;: {\n",
504-
" &quot;background&quot;: &quot;pink&quot;,\n",
510+
" &quot;background&quot;: &quot;#8ff0a4&quot;,\n",
505511
" &quot;border&quot;: &quot;black&quot;,\n",
506512
" &quot;highlight&quot;: {\n",
507513
" &quot;background&quot;: &quot;white&quot;,\n",
508514
" &quot;border&quot;: &quot;red&quot;\n",
509515
" }\n",
510516
" },\n",
511-
" &quot;shape&quot;: &quot;box&quot;,\n",
517+
" &quot;shape&quot;: &quot;ellipse&quot;,\n",
512518
" &quot;mass&quot;: 1,\n",
513519
" &quot;font&quot;: {\n",
514520
" &quot;color&quot;: &quot;black&quot;,\n",
515521
" &quot;size&quot;: 14\n",
516-
" },\n",
517-
" &quot;schedColor&quot;: false\n",
522+
" }\n",
518523
" }\n",
519524
" },\n",
520525
" &quot;reload_button&quot;: false,\n",
@@ -654,6 +659,11 @@
654659
"network.on( &#x27;doubleClick&#x27;, function(properties) {\n",
655660
" network.setData(data);\n",
656661
"});\n",
662+
"function setNodeColor(id, color) {\n",
663+
" var node = nodes.get(id);\n",
664+
" node[&quot;color&quot;] = color\n",
665+
" nodes.update(node);\n",
666+
"}\n",
657667
"\n",
658668
" &lt;/script&gt;\n",
659669
" &lt;/body&gt;\n",
@@ -726,7 +736,7 @@
726736
},
727737
{
728738
"cell_type": "code",
729-
"execution_count": 1,
739+
"execution_count": 3,
730740
"id": "d479bc6e-df7e-4b08-a511-4a3de7d81f79",
731741
"metadata": {},
732742
"outputs": [
@@ -735,7 +745,7 @@
735745
"text/html": [
736746
"\n",
737747
" <iframe\n",
738-
" id=\"modelAFAqNkTQzL\"\n",
748+
" id=\"modelRiavLSlkJj\"\n",
739749
" width=\"1030\"\n",
740750
" height=\"797\"\n",
741751
" frameborder=\"0\"\n",
@@ -1593,7 +1603,6 @@
15931603
" edges: edges,\n",
15941604
"};\n",
15951605
"var network = new vis.Network(container, data, options);\n",
1596-
"setTimeout(network.setData, 1000, data);\n",
15971606
"function makeAllNodesInvisible() {\n",
15981607
" ids = nodes.getIds();\n",
15991608
" for (let i = 0; i &lt; ids.length; i++) {\n",
@@ -1722,7 +1731,7 @@
17221731
},
17231732
{
17241733
"cell_type": "code",
1725-
"execution_count": 50,
1734+
"execution_count": 4,
17261735
"id": "8b36adc5-3203-47f4-8610-4e135ac26f7c",
17271736
"metadata": {},
17281737
"outputs": [
@@ -1731,7 +1740,7 @@
17311740
"text/html": [
17321741
"\n",
17331742
" <iframe\n",
1734-
" id=\"modelITcXpaZHaw\"\n",
1743+
" id=\"modelkZhkYnVlJL\"\n",
17351744
" width=\"1030\"\n",
17361745
" height=\"797\"\n",
17371746
" frameborder=\"0\"\n",
@@ -1991,6 +2000,13 @@
19912000
" &quot;size&quot;: 34\n",
19922001
" }\n",
19932002
" },\n",
2003+
" &quot;scheduled_actions&quot;: {\n",
2004+
" &quot;shape&quot;: &quot;box&quot;,\n",
2005+
" &quot;color&quot;: {\n",
2006+
" &quot;background&quot;: &quot;pink&quot;,\n",
2007+
" &quot;border&quot;: &quot;red&quot;\n",
2008+
" }\n",
2009+
" },\n",
19942010
" &quot;states&quot;: {\n",
19952011
" &quot;borderWidth&quot;: 1,\n",
19962012
" &quot;color&quot;: {\n",
@@ -2557,6 +2573,11 @@
25572573
"network.on( &#x27;doubleClick&#x27;, function(properties) {\n",
25582574
" network.setData(data);\n",
25592575
"});\n",
2576+
"function setNodeColor(id, color) {\n",
2577+
" var node = nodes.get(id);\n",
2578+
" node[&quot;color&quot;] = color\n",
2579+
" nodes.update(node);\n",
2580+
"}\n",
25602581
"\n",
25612582
" &lt;/script&gt;\n",
25622583
" &lt;/body&gt;\n",
@@ -2641,14 +2662,6 @@
26412662
"mdp.add_self_loops()\n",
26422663
"vis = show(mdp, layout=Layout(\"layouts/monty.json\"))"
26432664
]
2644-
},
2645-
{
2646-
"cell_type": "code",
2647-
"execution_count": null,
2648-
"id": "5594603e-7b9d-4df8-a90a-521e2d0fb010",
2649-
"metadata": {},
2650-
"outputs": [],
2651-
"source": []
26522665
}
26532666
],
26542667
"metadata": {

0 commit comments

Comments
 (0)