Skip to content

Commit 8f67ebe

Browse files
committed
Finalized LQR example. Fixed colab env verification. Fixed elimination ordering in visualization and markdown text
1 parent fa5c564 commit 8f67ebe

File tree

1 file changed

+55
-34
lines changed

1 file changed

+55
-34
lines changed

python/gtsam/examples/LQRExample.ipynb

Lines changed: 55 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -30,22 +30,43 @@
3030
},
3131
{
3232
"cell_type": "code",
33-
"execution_count": 29,
33+
"execution_count": 14,
3434
"metadata": {
35-
"id": "-wKB9H9ZaASf"
35+
"colab": {
36+
"base_uri": "https://localhost:8080/"
37+
},
38+
"id": "-wKB9H9ZaASf",
39+
"outputId": "a5ffc820-2e40-41e8-b82f-ea0245a02fea"
3640
},
37-
"outputs": [],
41+
"outputs": [
42+
{
43+
"name": "stdout",
44+
"output_type": "stream",
45+
"text": [
46+
"Proceed (Y/n)? y\n",
47+
"Proceed (Y/n)? y\n"
48+
]
49+
}
50+
],
3851
"source": [
3952
"# Try uninstall then reinstall, should Colab crashes\n",
40-
"# %pip uninstall --quiet gtsam-develop\n",
41-
"# %pip uninstall --quiet gtbook\n",
42-
"%pip install --quiet gtsam-develop\n",
43-
"%pip install --quiet gtbook"
53+
"try:\n",
54+
" %pip uninstall --quiet gtsam-develop\n",
55+
" %pip uninstall --quiet gtbook\n",
56+
"except:\n",
57+
" pass\n",
58+
"\n",
59+
"try:\n",
60+
" import google.colab\n",
61+
" %pip install --quiet gtsam-develop\n",
62+
" %pip install --quiet gtbook\n",
63+
"except ImportError:\n",
64+
" pass # Not in Colab\n"
4465
]
4566
},
4667
{
4768
"cell_type": "code",
48-
"execution_count": 30,
69+
"execution_count": 15,
4970
"metadata": {
5071
"id": "hUK913WGZvB1"
5172
},
@@ -128,7 +149,7 @@
128149
},
129150
{
130151
"cell_type": "code",
131-
"execution_count": 31,
152+
"execution_count": 16,
132153
"metadata": {
133154
"id": "iQRHn0qFdYXL"
134155
},
@@ -257,7 +278,7 @@
257278
},
258279
{
259280
"cell_type": "code",
260-
"execution_count": 32,
281+
"execution_count": 17,
261282
"metadata": {
262283
"id": "R6YXu9dcTkWG"
263284
},
@@ -309,14 +330,14 @@
309330
},
310331
{
311332
"cell_type": "code",
312-
"execution_count": 33,
333+
"execution_count": 18,
313334
"metadata": {
314335
"colab": {
315336
"base_uri": "https://localhost:8080/",
316337
"height": 460
317338
},
318339
"id": "Pg5n_cfVd5V7",
319-
"outputId": "fbb9a36b-207c-41f3-fc7b-e8e624316470"
340+
"outputId": "8959467e-c2d3-4762-d278-a1102e4e4076"
320341
},
321342
"outputs": [
322343
{
@@ -328,7 +349,7 @@
328349
" [0.14365837, 0.04085496]])"
329350
]
330351
},
331-
"execution_count": 33,
352+
"execution_count": 18,
332353
"metadata": {},
333354
"output_type": "execute_result"
334355
},
@@ -396,14 +417,14 @@
396417
},
397418
{
398419
"cell_type": "code",
399-
"execution_count": 34,
420+
"execution_count": 19,
400421
"metadata": {
401422
"colab": {
402423
"base_uri": "https://localhost:8080/",
403424
"height": 103
404425
},
405426
"id": "ggr3ukXoMw06",
406-
"outputId": "298167de-0dd5-4326-c42f-dcc2fcfb04e3"
427+
"outputId": "00d4fc60-6e17-48b8-aa62-859886626ae4"
407428
},
408429
"outputs": [
409430
{
@@ -616,10 +637,10 @@
616637
"</svg>\n"
617638
],
618639
"text/plain": [
619-
"<graphviz.sources.Source at 0x79fa3f7459d0>"
640+
"<graphviz.sources.Source at 0x785e48175790>"
620641
]
621642
},
622-
"execution_count": 34,
643+
"execution_count": 19,
623644
"metadata": {},
624645
"output_type": "execute_result"
625646
}
@@ -718,13 +739,13 @@
718739
},
719740
{
720741
"cell_type": "code",
721-
"execution_count": 35,
742+
"execution_count": 20,
722743
"metadata": {
723744
"colab": {
724745
"base_uri": "https://localhost:8080/"
725746
},
726747
"id": "FZ1zz1ozM0RP",
727-
"outputId": "5c8118b7-4e66-4fbc-fc6c-cb8c0d2916c5"
748+
"outputId": "d5bdde07-13e7-48e7-de9c-1f0f05ba21f1"
728749
},
729750
"outputs": [
730751
{
@@ -747,14 +768,14 @@
747768
},
748769
{
749770
"cell_type": "code",
750-
"execution_count": 36,
771+
"execution_count": 21,
751772
"metadata": {
752773
"colab": {
753774
"base_uri": "https://localhost:8080/",
754775
"height": 176
755776
},
756777
"id": "8ZT2qtwyM7o_",
757-
"outputId": "cc21b368-449a-46fd-e47f-b9dc0b4a3e41"
778+
"outputId": "64ed7e96-a7e5-453d-e005-462bfe583ff6"
758779
},
759780
"outputs": [
760781
{
@@ -871,10 +892,10 @@
871892
"</svg>\n"
872893
],
873894
"text/plain": [
874-
"<gtbook.display.show at 0x79fa3f74d610>"
895+
"<gtbook.display.show at 0x785e276f0c50>"
875896
]
876897
},
877-
"execution_count": 36,
898+
"execution_count": 21,
878899
"metadata": {},
879900
"output_type": "execute_result"
880901
}
@@ -886,23 +907,23 @@
886907
},
887908
{
888909
"cell_type": "code",
889-
"execution_count": 37,
910+
"execution_count": 22,
890911
"metadata": {
891912
"colab": {
892913
"base_uri": "https://localhost:8080/",
893914
"height": 447
894915
},
895916
"id": "0MyYkdtkYdus",
896-
"outputId": "7cbf295f-46a1-4976-9180-2c0af8af38b1"
917+
"outputId": "7f5703d8-c619-4116-b300-aae958b5150c"
897918
},
898919
"outputs": [
899920
{
900921
"data": {
901922
"text/plain": [
902-
"<matplotlib.image.AxesImage at 0x79fa656bc850>"
923+
"<matplotlib.image.AxesImage at 0x785e276bec50>"
903924
]
904925
},
905-
"execution_count": 37,
926+
"execution_count": 22,
906927
"metadata": {},
907928
"output_type": "execute_result"
908929
},
@@ -924,14 +945,14 @@
924945
},
925946
{
926947
"cell_type": "code",
927-
"execution_count": 38,
948+
"execution_count": 23,
928949
"metadata": {
929950
"colab": {
930951
"base_uri": "https://localhost:8080/",
931952
"height": 211
932953
},
933954
"id": "qcekbRZweMlN",
934-
"outputId": "b803fe99-5d4c-46aa-a79a-04ede28ef989"
955+
"outputId": "20eb32ea-2a59-455a-ca6c-b2c6c4662951"
935956
},
936957
"outputs": [
937958
{
@@ -1092,17 +1113,17 @@
10921113
"</svg>\n"
10931114
],
10941115
"text/plain": [
1095-
"<gtbook.display.show at 0x79fa3f374fd0>"
1116+
"<gtbook.display.show at 0x785e261e29d0>"
10961117
]
10971118
},
1098-
"execution_count": 38,
1119+
"execution_count": 23,
10991120
"metadata": {},
11001121
"output_type": "execute_result"
11011122
}
11021123
],
11031124
"source": [
11041125
"# The resulting Bayesian graph under a different ordering\n",
1105-
"# The dependency would change, like we have described before\n",
1126+
"# The resulting dependency would change, like we have described before\n",
11061127
"\n",
11071128
"# New ordering\n",
11081129
"N = 4\n",
@@ -1164,14 +1185,14 @@
11641185
},
11651186
{
11661187
"cell_type": "code",
1167-
"execution_count": 39,
1188+
"execution_count": 24,
11681189
"metadata": {
11691190
"colab": {
11701191
"base_uri": "https://localhost:8080/",
11711192
"height": 563
11721193
},
11731194
"id": "bZt3HQ5xCVoN",
1174-
"outputId": "9e870736-4741-4e72-9d74-9e13c3eb797f"
1195+
"outputId": "927f1b13-3a5b-4d19-b517-fdb7c1332237"
11751196
},
11761197
"outputs": [
11771198
{

0 commit comments

Comments
 (0)