Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:00,910 --> 00:00:03,580
So far we've talked
about two procedures for
2
00:00:03,580 --> 00:00:08,230
planning paths to graphs, the Grassfire
Algorithm and Dijkstra's Algorithm.
3
00:00:10,010 --> 00:00:13,380
Both of them work
perfectly fine in practice.
4
00:00:13,380 --> 00:00:16,890
They both find the shortest
path when one exists and
5
00:00:16,890 --> 00:00:19,040
report failure when one doesn't.
6
00:00:19,040 --> 00:00:23,380
However, both algorithms may end up
visiting all or most of the nodes
7
00:00:23,380 --> 00:00:26,785
in the graph, and this can be a problem
when you have a large member of nodes.
8
00:00:28,090 --> 00:00:31,110
It turns out that from many
motion planning problems,
9
00:00:31,110 --> 00:00:33,850
we can exploit the structure
of the problem to come up with
10
00:00:33,850 --> 00:00:36,839
procedures that arrive at
good solutions more quickly.
11
00:00:38,312 --> 00:00:40,690
The A* Algorithm is a well know, and
12
00:00:40,690 --> 00:00:43,495
well loved,
algorithm that exemplifies this idea.
13
00:00:43,495 --> 00:00:48,060
A* is actually an example of
a broader class of procedures
14
00:00:48,060 --> 00:00:50,970
called best first search algorithms.
15
00:00:50,970 --> 00:00:55,430
Which explore a set of possibilities
by using an approximating
16
00:00:55,430 --> 00:00:59,470
heuristic cost function to sort
the varies alternatives and
17
00:00:59,470 --> 00:01:02,220
then inspecting the options in that order.
18
00:01:02,220 --> 00:01:06,520
The algorithm is very similar to
Dijkstra's procedure, and Grassfire, in
19
00:01:06,520 --> 00:01:10,370
that it actually precedes by maintaining
a list of nodes that it is investigating.
20
00:01:11,800 --> 00:01:17,940
When we are planning on simple grids, both
Grassfire and Dijkstra's Algorithm have
21
00:01:17,940 --> 00:01:21,790
a similar behavior, since all the edges
between the nodes are reviewed at length.
22
00:01:22,980 --> 00:01:25,490
Both algorithms end up visiting nodes
23
00:01:25,490 --> 00:01:28,400
based on their distance
from the start node.
24
00:01:28,400 --> 00:01:31,020
Here's a little movie that
visualizes this behavior.
25
00:01:31,020 --> 00:01:37,070
In this movie, the red cells correspond
to nodes that the algorithm has visited,
26
00:01:37,070 --> 00:01:40,620
while the blue nodes correspond
to nodes that are on the list,
27
00:01:40,620 --> 00:01:42,070
that are about to be explored.
28
00:01:43,440 --> 00:01:47,360
Notice how the activation of
pattern of the algorithm spreads
29
00:01:47,360 --> 00:01:51,240
outward from the start node,
evenly in all directions.
30
00:01:51,240 --> 00:01:56,060
If we look at this video, we notice
that the Dijkstra/Grassfire Algorithm
31
00:01:56,060 --> 00:02:00,270
basically explores evenly in all
directions until it finds the gold node.
32
00:02:05,546 --> 00:02:08,085
It seems that we could do
a little bit better here,
33
00:02:08,085 --> 00:02:10,805
since we actually know where
the destination is, and
34
00:02:10,805 --> 00:02:14,190
we have some idea which directions
may prove to be more fruitful.
35
00:02:14,190 --> 00:02:19,060
The A* Algorithm introduces
the idea of a heuristic distance,
36
00:02:19,060 --> 00:02:23,450
which is an estimate for the distance
between a given node and the goal node.
37
00:02:23,450 --> 00:02:26,640
And we can use this information
to help guide the search
38
00:02:26,640 --> 00:02:30,000
into directions that we think
might get it to the goal quicker.
39
00:02:30,000 --> 00:02:33,088
Note, that as with any heading heuristic,
we may be wrong.
40
00:02:33,088 --> 00:02:37,397
And there can in fact be situations where
the shortest path towards a goal involves
41
00:02:37,397 --> 00:02:40,080
heading in exactly the opposite direction.
42
00:02:40,080 --> 00:02:44,100
However, in many cases,
we can come up with informative heuristics
43
00:02:44,100 --> 00:02:46,720
that cause the algorithm to
explore more efficiently.
44
00:02:48,770 --> 00:02:49,890
More formally, for
45
00:02:49,890 --> 00:02:54,220
the shortest path problem we're
interested in heuristic functions, H.
46
00:02:54,220 --> 00:02:58,130
Which given a node n return
a non-negative value
47
00:02:58,130 --> 00:03:01,750
that is indicative of the distance
from that node to the goal.
48
00:03:03,910 --> 00:03:08,600
For path finding problems, we often use
heuristic functions that are monotonic,
49
00:03:08,600 --> 00:03:11,349
which means that they satisfy
the following two properties.
50
00:03:12,540 --> 00:03:18,740
We say that H applied to the goal
node returns as 0, which makes sense,
51
00:03:18,740 --> 00:03:24,432
and that for any two nodes, x and
y, that are adjacent in the graph,
52
00:03:24,432 --> 00:03:29,574
H(x) <= H(y) + d(x,y).
53
00:03:30,720 --> 00:03:36,839
Where d(x,y) denotes the length of
the edge between those two nodes x and y.
54
00:03:38,546 --> 00:03:43,612
Given these two properties,
it's actually not hard to show that
55
00:03:43,612 --> 00:03:48,404
the heuristic function H(n)
serves as an underestimate for
56
00:03:48,404 --> 00:03:51,921
the distance between the node n and
the goal.
57
00:03:53,879 --> 00:03:57,632
Here are two heuristic functions
that are commonly used for
58
00:03:57,632 --> 00:04:01,740
solving path finding problems
on two dimensional grids.
59
00:04:01,740 --> 00:04:07,376
In these expressions xn and yn denote
the position of the node in the 2D grid,
60
00:04:07,376 --> 00:04:13,850
while xg and yg denote the coordinates
of the goal location in that same grid.
61
00:04:13,850 --> 00:04:16,650
This slide shows a pseudo code for
the A* Algorithm.
62
00:04:17,960 --> 00:04:21,140
Note that it is actually very similar
in structure to Dijkstra's algorithm.
63
00:04:22,880 --> 00:04:26,620
We associate two numerical attributes
with each of the nodes in our graph.
64
00:04:27,790 --> 00:04:33,680
A g value, which indicates the distance
between the current node and
65
00:04:33,680 --> 00:04:39,411
the start location, and an f value,
which is the sum of the node g value and
66
00:04:39,411 --> 00:04:42,680
the heuristic cost
associated with that node.
67
00:04:42,680 --> 00:04:46,330
In other words, it's the sum of
the distance between the node and
68
00:04:46,330 --> 00:04:48,530
the start and the estimate for
69
00:04:48,530 --> 00:04:52,620
how much distance is left to go between
that node and the goal location.
70
00:04:54,350 --> 00:04:55,980
On every iteration of this algorithm,
71
00:04:57,080 --> 00:05:02,190
the system chooses the node with
the smallest associated f value.
72
00:05:02,190 --> 00:05:05,820
That is, it attempts to choose the node
73
00:05:05,820 --> 00:05:11,490
that is most likely to be on the shortest
path between the start and the goal node.
74
00:05:11,490 --> 00:05:15,930
Once again,
once a node is chosen, the f and
75
00:05:15,930 --> 00:05:19,660
g values associated with each
of its neighbors are updated.
76
00:05:19,660 --> 00:05:23,940
In other words, on each iteration,
we're trying to pick the node
77
00:05:23,940 --> 00:05:28,690
that is most likely to be on the shortest
path from the start to the destination.
78
00:05:28,690 --> 00:05:32,260
We then update the neighbors
of those chosen node and
79
00:05:32,260 --> 00:05:37,740
repeat the process until we encounter the
goal node or run out of nodes to consider.
80
00:05:37,740 --> 00:05:41,387
This slide shows the progress
of the A* Algorithm.
81
00:05:41,387 --> 00:05:45,880
Once again red nodes indicate nodes
that the algorithm has visited,
82
00:05:45,880 --> 00:05:49,690
while blue nodes indicate
nodes that are on the list
83
00:05:49,690 --> 00:05:52,180
of nodes to be considered
on the next iteration.
84
00:05:52,180 --> 00:05:55,640
Notice that this algorithm
tends to focus its attention
85
00:05:55,640 --> 00:05:59,680
more directly on nodes that are closer
to the destination node, as intended.
86
00:06:02,060 --> 00:06:05,280
Let's compare its performance
to that of Dijkstra's Algorithm,
87
00:06:05,280 --> 00:06:06,780
which we saw earlier.
88
00:06:06,780 --> 00:06:11,750
Note how much more diffuse the activity
of the Dijkstra's Algorithm is,
89
00:06:11,750 --> 00:06:14,030
when compared to that of the A* Algorithm.
90
00:06:14,030 --> 00:06:19,760
Where Dijkstra's Algorithm effective
explores in all directions uniformly,
91
00:06:19,760 --> 00:06:23,650
the A* Algorithm uses its
heuristic to focus its efforts
92
00:06:23,650 --> 00:06:26,310
on nodes that appear to
be closer to the goal.
93
00:06:26,310 --> 00:06:28,720
Hence it gets there much
quicker in this example.
94
00:06:30,180 --> 00:06:34,670
For relatively uncluttered environments
like this one, A* can be substantially
95
00:06:34,670 --> 00:06:41,490
faster in practice than the uniform search
algorithms like Dijkstra's and Grassfire.
96
00:06:41,490 --> 00:06:44,770
This performance boost can
be particularly useful
97
00:06:44,770 --> 00:06:48,640
in environments where we may have tens
of thousands of nodes, for instance,
98
00:06:48,640 --> 00:06:53,410
if we're planning a path to guide a robot
from one end of a building to another.
99
00:06:53,410 --> 00:06:59,024
In the worst case, the performance of
A* is about the same as Djikstra's.9349
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.