master
/ 02.01 基于搜索的问题求解(学生版).ipynb

02.01 基于搜索的问题求解(学生版).ipynb @master

4b0cb67
 
 
 
 
 
32f9dec
4b0cb67
 
cf9f12d
 
 
 
 
 
 
4b0cb67
 
 
 
 
 
 
18d0870
 
 
 
 
 
 
4b0cb67
 
 
 
32f9dec
4b0cb67
 
cf9f12d
 
 
 
 
 
 
4b0cb67
 
 
 
47bf824
4b0cb67
 
 
 
 
 
 
 
 
 
6df5dcb
4b0cb67
 
 
 
3b9d1c6
4b0cb67
 
 
 
 
 
bd58965
4b0cb67
 
 
 
6df5dcb
 
 
4b0cb67
 
 
 
 
 
47bf824
 
4b0cb67
47bf824
4b0cb67
 
 
 
3b9d1c6
 
 
 
 
 
 
 
 
 
 
 
 
 
4b0cb67
 
 
 
 
 
 
cf9f12d
4b0cb67
 
 
 
 
 
cf9f12d
4b0cb67
 
 
 
 
 
cf9f12d
4b0cb67
 
 
 
 
 
cf9f12d
4b0cb67
 
 
18d0870
4b0cb67
 
cf9f12d
 
 
 
 
6df5dcb
 
 
cf9f12d
 
4b0cb67
 
 
 
 
 
cf9f12d
4b0cb67
 
 
cf9f12d
4b0cb67
 
cf9f12d
4b0cb67
 
 
 
 
 
cf9f12d
4b0cb67
 
 
 
 
 
cf9f12d
 
 
 
 
 
 
 
4b0cb67
cf9f12d
18d0870
 
 
 
4b0cb67
 
 
 
6df5dcb
 
 
4b0cb67
18d0870
4b0cb67
 
 
 
 
 
 
18d0870
4b0cb67
 
cf9f12d
 
 
 
 
 
 
4b0cb67
 
 
 
18d0870
4b0cb67
 
 
 
 
 
5ecac81
4b0cb67
 
 
 
6df5dcb
 
 
4b0cb67
3b9d1c6
4b0cb67
 
 
 
 
 
5ecac81
4b0cb67
 
 
 
6df5dcb
 
 
4b0cb67
3b9d1c6
4b0cb67
 
cf9f12d
 
 
 
 
 
 
4b0cb67
 
 
 
18d0870
4b0cb67
 
cf9f12d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4b0cb67
 
 
 
32f9dec
4b0cb67
 
 
 
 
 
cf9f12d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4b0cb67
 
 
 
 
 
 
 
 
 
 
 
18d0870
 
 
4b0cb67
 
 
 
6df5dcb
 
 
4b0cb67
 
3b9d1c6
 
4b0cb67
3b9d1c6
4b0cb67
 
cf9f12d
 
 
 
 
 
 
4b0cb67
 
 
 
18d0870
4b0cb67
 
 
 
 
 
cf9f12d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4b0cb67
 
 
 
6df5dcb
 
 
4b0cb67
 
3b9d1c6
 
4b0cb67
3b9d1c6
4b0cb67
 
 
 
3b9d1c6
f4cbb28
6df5dcb
4b0cb67
 
3b9d1c6
4b0cb67
3b9d1c6
 
4b0cb67
 
cf9f12d
 
 
 
 
 
 
4b0cb67
 
 
 
18d0870
4b0cb67
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3b9d1c6
f4cbb28
3b9d1c6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4b0cb67
3b9d1c6
 
 
 
 
 
47bf824
 
3b9d1c6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4b0cb67
 
 
 
 
 
 
 
 
 
 
 
 
32f9dec
4b0cb67
 
 
 
 
 
32f9dec
4b0cb67
 
 
 
 
 
32f9dec
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4b0cb67
a0fee34
 
 
 
 
 
 
 
 
 
 
4b0cb67
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 2.1 基于搜索的问题求解"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<center><video src=\"http://files.momodel.cn/search_problem.mp4\" controls=\"controls\" width=800px></center>"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "现实世界中许多问题都可以通过搜索的方法来求解,例如设计最佳出行路线或是制订合理的课程表。当给定一个待求解问题后,搜索算法会按照事先设定的逻辑来自动寻找符合求解问题的答案,因此一般可将搜索算法称为问题求解智能体。"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<img src=\"http://imgbed.momodel.cn//20200110155424.png\" width=500>"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 2.1.1 搜索算法基本概念"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<center><video src=\"http://files.momodel.cn/search_basic_concept.mp4\" controls=\"controls\" width=800px></center>"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "我们把书中的公交换乘的问题,转为无向图中的的路径寻找问题。无向图指的是边没有方向的图。\n",
    "\n",
    "首先,我们画出如下的无向图。该无向图中有 A,B,C,D,E,F,G 七个节点,其中 A 是起点, G 是目标点。\n",
    "\n",
    "点与点之间的连线称为边,边可以有权重,可以代表点与点之间的距离或者从一个点转移到另一个点需要花费的代价。\n",
    "\n",
    "下面我们先创建一个图。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 首先导入必要的包\n",
    "from search import Graph\n",
    "import collections\n",
    "import matplotlib.pyplot as plt\n",
    "import collections\n",
    "from IPython import display\n",
    "import networkx as nx\n",
    "import numpy as np\n",
    "import time"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 定义节点列表\n",
    "node_list = ['A', 'B', 'C', 'D', 'E', 'F', 'G']\n",
    "\n",
    "# 定义边及权重列表\n",
    "weighted_edges_list = [('A', 'B', 8), ('A', 'C', 20),\n",
    "                       ('B', 'F', 40), ('B', 'E', 30),\n",
    "                       ('B', 'D', 20), ('C', 'D', 10), \n",
    "                       ('D', 'G', 10), ('D', 'E', 10),\n",
    "                       ('E', 'F', 30), ('F', 'G', 30)]\n",
    "# 定义绘图中各个节点的坐标\n",
    "nodes_pos = {\"A\": (1, 1), \"B\": (3, 3), \"C\": (5, 0), \"D\": (9, 2),\n",
    "             \"E\": (7, 4), \"F\": (6,6),\"G\": (11,5)}\n",
    "\n",
    "# 实例化图\n",
    "g = Graph()\n",
    "g.add_nodes_from(node_list)\n",
    "g.add_weighted_edges_from(weighted_edges_list)\n",
    "g.set_nodes_pos(nodes_pos)\n",
    "\n",
    "# 设置起点\n",
    "g.set_start_node('A')\n",
    "# 设置目标点\n",
    "g.set_target_node(\"G\")\n",
    "# 设置最大搜索深度\n",
    "g.set_max_depth(3)\n",
    "\n",
    "# 显示无向图\n",
    "g.show_graph()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "观察上图,可以看到从起点 A 到目标点 G 距离最短的路径是 A -> B -> D  -> G,其距离是 38,我们可以设计一个计算机程序,按照既定的规则,从起点 A 出发,不断尝试从一个节点移动到下一个节点,直到抵达目标点 G。"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**想一想**"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "搜索算法四个重要的概念分别是什么?"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**动手练**"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "更改下面的代码,设置一条路径并查看,并结合此图说明搜索算法的四个重要概念。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "g.show_graph(this_path=\"ABDG\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 2.1.2 搜索算法"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<center><video src=\"http://files.momodel.cn/search_tree.mp4\" controls=\"controls\" width=800px></center>"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "搜索算法就是不断从某一状态转移到下一状态,直至到达终止状态为止。"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**想一想**"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "搜索树是什么?\n",
    "\n",
    "如何构造搜索树?\n",
    "\n",
    "思考一下,路径搜索能出现回路吗?\n",
    "\n",
    "在搜索树中能够扩展的节点需满足什么条件?"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 查看搜索树\n",
    "g.show_search_tree()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 2.1.3 深度优先搜索和广度优先搜索"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<center><video src=\"http://files.momodel.cn/search_dfs_bfs.mp4\" controls=\"controls\" width=800px></center>"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<img src=\"http://imgbed.momodel.cn//20200110151426.png\" width=600>"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**深度优先搜索**"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "g.animate_search_tree('dfs')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**广度优先搜索**"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "g.animate_search_tree('bfs')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**想一想**"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "对于一个搜索问题,只要存在答案(即从初始节点到终止节点存在满足条件的一条路径),那么深度优先搜索和广度优先搜索都能找到一个答案吗?找到的答案一定是路径最短的吗?"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 扩展内容\n",
    "** 深度优先搜索 dfs ** 基础代码解读\n",
    "\n",
    "```\n",
    "def iter_dfs(G, start, target):\n",
    "    '''\n",
    "    深度优先搜索\n",
    "    :param G: 字典,存储每个点的相邻点\n",
    "    :param start: 初始点\n",
    "    :param target: 目标点\n",
    "    :return:\n",
    "    '''\n",
    "\n",
    "    # 定义已访问的点的集合\n",
    "    S = set()\n",
    "    # 定义一个待访问点的列表\n",
    "    Q = []\n",
    "    # 把初始点放进列表中\n",
    "    Q.append(start)\n",
    "    while Q:\n",
    "        # 只要带访问的列表不为空,那么从列表中拿取最后一个元素,也就是一个点,记作 u\n",
    "        u = Q.pop()\n",
    "        # 如果当前点是目标点,则结束查找\n",
    "        if u == target:\n",
    "            break\n",
    "        # 如果该点已经被访问了,则跳过此点\n",
    "        if u in S:\n",
    "            continue\n",
    "        # 访问此点,将点加入已访问点的结合 S 中\n",
    "        S.add(u)\n",
    "        # 将点 u 相邻的点放入待访问的列表中\n",
    "        Q.extend(G[u])\n",
    "```"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 2.1.4 启发式搜索"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<center><video src=\"http://files.momodel.cn/search_greedy.mp4\" controls=\"controls\" width=800px></center>"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**想一想**"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "能否在搜索过程中利用问题的定义以外的辅助信息?"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**辅助信息:各个节点到目标节点G的直线距离**\n",
    "\n",
    "|站点|A|B|C|D|E|F|G|\n",
    "|--|--|--|--|--|--|--|--|\n",
    "|距离|30|20|19|10|5|25|0|\n",
    "\n",
    "如果每下一站都选最近的,那么称之为“贪婪”。\n",
    "\n",
    "利用下面的代码查看贪婪最佳优先算法搜索过程:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 为搜索算法提供辅助信息\n",
    "help_info = {'A': 30, 'B': 20, 'C': 19, 'D':10, 'E':5, 'F':25, 'G': 0}\n",
    "g.set_help_info(help_info)\n",
    "# 动态演示贪婪搜索\n",
    "g.animate_search_tree('greedy', sleep_time=5)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**想一想**"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "“贪婪”机制下找到的最佳路径是什么呢?它是最短路径吗?为什么会产生这样的搜索结果?\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "另一种启发式搜索算法—— A* 算法克服了贪婪算法的不足。"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<center><video src=\"http://files.momodel.cn/search_a_star.mp4\" controls=\"controls\" width=800px></center>"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "A\\*算法搜索过程:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 为搜索算法提供辅助信息\n",
    "help_info = {'A': 30, 'B': 20, 'C': 19, 'D':10, 'E':5, 'F':25, 'G': 0}\n",
    "g.set_help_info(help_info)\n",
    "# 动态演示 A* 算法\n",
    "g.animate_search_tree('a_star', sleep_time=5)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 可以调整辅助信息的比重\n",
    "# help_info_weight 为辅助信息的比重,origin_info_weight 为原始信息的比重\n",
    "# 当只考虑额外信息时,即 origin_info_weight 设置为 0 的时候,A* 算法退化为贪婪算法。\n",
    "# 可以设置 sleep_time 来调整动态演示的速度\n",
    "g.animate_search_tree('a_star', help_info_weight=1, origin_info_weight=0, sleep_time=5)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**想一想**"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "在实际中,A\\* 算法的性能表现一定很优秀吗?如果启发函数设计的不好怎么办?"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "####  思考与练习"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "下图是一张线路示意图。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 首先导入必要的包\n",
    "from search import Graph\n",
    "import collections\n",
    "import matplotlib.pyplot as plt\n",
    "import collections\n",
    "from IPython import display\n",
    "import networkx as nx\n",
    "import numpy as np\n",
    "import time"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 定义节点列表\n",
    "node_list = [\"0\", \"1\", \"2\", \"3\", \"4\"]\n",
    "\n",
    "# 定义边及权重列表\n",
    "weighted_edges_list = [(\"0\", \"1\", 10), (\"0\", \"2\", 10),\n",
    "                       (\"1\", \"3\", 10), (\"2\", \"3\", 5),\n",
    "                       (\"2\", \"4\", 20), (\"3\", \"4\", 14),\n",
    "                       (\"3\", \"2\", 5)]\n",
    "\n",
    "# 定义绘图中各个节点的坐标\n",
    "nodes_pos = {\"0\": (1, 7), \"1\": (5, 1), \"2\": (5, 13), \"3\": (9, 7),\n",
    "             \"4\": (11, 13)}\n",
    "\n",
    "# 实例化图\n",
    "h_graph = Graph()\n",
    "h_graph.add_nodes_from(node_list)\n",
    "h_graph.add_weighted_edges_from(weighted_edges_list)\n",
    "h_graph.set_nodes_pos(nodes_pos)\n",
    "\n",
    "# 设置起点\n",
    "h_graph.set_start_node('0')\n",
    "# 设置目标点\n",
    "h_graph.set_target_node(\"5\")\n",
    "# 设置最大搜索深度\n",
    "h_graph.set_max_depth(3)\n",
    "\n",
    "# 显示无向图\n",
    "h_graph.show_graph()\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "如果使用深度优先搜索求状态 0 到状态 4 的一条路径,我们可以用下表来模拟搜索过程。注意:在下表中,结点的深度定义为它对应路径中状态转移的次数,如果多个未访问结点的深度相同,那么在这个例子里算法优先选择状态编号大的节点。\n",
    "\n",
    "|步骤|当前状态|当前未访问节点集合(用上划线标出了下一个扩展的节点)|\n",
    "|:--:|:--:|:--|\n",
    "|1|0|深度1:${0 -> 1,\\overline{0 -> 2}}$|\n",
    "|2|2|深度1:${0 -> 1}$ 深度2:$\\underline{(1)}$|\n",
    "|3|$\\underline{(2)}$|找到路径:0 -> 2 -> 4|"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**问题 1**:请仔细观察上表中各项内容的含义,根据深度优先搜素的思路,横线(1)和(2)处应该填写什么。"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**答案 1**:(在此处填写你的答案。)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**问题 2**:找到的路径0->2->4是代价最小的吗?"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**答案 2**:(在此处填写你的答案。)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 扩展阅读\n",
    "1. [Introduction to the A* Algorithm](https://www.redblobgames.com/pathfinding/a-star/introduction.html)\n",
    "2. [游戏开发中的人工智能:A* 路径寻找算法](https://blog.csdn.net/Jurbo/article/details/75532885)\n",
    "3. [A* Search Algorithm](https://www.101computing.net/a-star-search-algorithm/)\n",
    "4. [A star Pathfinding A星寻路算法](https://www.bilibili.com/video/av32847834/)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.5.2"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}