1
00:00:48,000 --> 00:00:55,500
Today, we will start with the next chapter-
on searching with costs. In the last class,
2
00:00:55,859 --> 00:01:02,859
what we had done was- we studied the first
search algorithm, which
3
00:01:03,589 --> 00:01:10,589
was as follows: that we start with initialize,
and we were maintaining a list called open.
4
00:01:12,690 --> 00:01:19,180
We put the start node in s. Then, if we find
at some point of time,
5
00:01:19,180 --> 00:01:24,700
that open is empty and we have still not found
the goal, then we terminate with failure.
6
00:01:24,700 --> 00:01:31,700
Then, select a state n from open, terminate
if n is a goal; then, we
7
00:01:33,180 --> 00:01:39,900
terminate with success. Otherwise, we generate
the successors of n using O and insert them
8
00:01:39,900 --> 00:01:44,770
in open, and finally, go to step 2. So, what
we are essentially
9
00:01:44,770 --> 00:01:51,190
doing is, we are progressively maintaining
a frontier of the nodes. And in each iteration,
10
00:01:51,190 --> 00:01:54,330
we are picking up a node from the frontier,
expanding that. So,
11
00:01:54,330 --> 00:01:57,880
that extends the frontier and we continue
in this way.
12
00:01:57,880 --> 00:02:02,810
Open maintains the current frontier. If, at
any point of time, we find that open is empty,
13
00:02:02,810 --> 00:02:05,360
that means we have reached the end of the
frontier and we have
14
00:02:05,360 --> 00:02:11,770
still not found a goal. So then, we will terminate
with failure. One thing that I had not mentioned
15
00:02:11,770 --> 00:02:17,390
so far is- that how do we maintain the part
of the state
16
00:02:17,390 --> 00:02:22,590
space that we have already visited? That is
important, because there are cases where we
17
00:02:22,590 --> 00:02:27,189
have to know that a node is already visited,
so that we do not
18
00:02:27,189 --> 00:02:34,189
revisit that node. So, this is the extension
of the same algorithm, where we will save
19
00:02:39,459 --> 00:02:43,450
the explicit state space. Let us see how we
do that.
20
00:02:43,450 --> 00:02:49,790
See, this just shows the difference with the
previous algorithm: the only changes that
21
00:02:49,790 --> 00:02:54,650
I have made are highlighted in yellow. So,
we are now maintaining
22
00:02:54,650 --> 00:03:01,650
another list called closed. When we select
a state n from open here, we save it in we
23
00:03:06,859 --> 00:03:13,859
save the state in closed, right, and there
is one difference here; that
24
00:03:16,139 --> 00:03:23,139
when we generate the successors of n using
O, we will check whether those successors
25
00:03:23,370 --> 00:03:27,069
already belong to open or closed. If it already
belongs to open or
26
00:03:27,069 --> 00:03:34,069
closed, then we will not insert it in open
again, otherwise, we will insert it in open,
27
00:03:35,450 --> 00:03:42,450
right? Okay. Now, can you tell me what changes
I need to make in this
28
00:03:44,709 --> 00:03:51,709
algorithm to also ensure, that after I find
the goal, I can trace the path from the start
29
00:03:52,260 --> 00:03:59,260
state to the goal? Any additional things that
I need to maintain?
30
00:04:02,180 --> 00:04:09,180
Now, this algorithm is clear right? Yes or
no? So, in this algorithm, I just want to
31
00:04:10,939 --> 00:04:16,530
add a few more features, so that I am able
to maintain the path from the
32
00:04:16,530 --> 00:04:23,530
start state to the goal.
What we can do is, with every node, with every
33
00:04:32,090 --> 00:04:39,090
state, we will maintain a parent pointer,
and when will we set the parent pointer? Yes,
34
00:04:40,700 --> 00:04:43,810
when- not exactly.
35
00:04:43,810 --> 00:04:48,980
Whenever we are expanding the node Whenever
we are expanding a node n and generating a
36
00:04:48,980 --> 00:04:54,230
successor m, we will make the parent pointer
of m equal to
37
00:04:54,230 --> 00:05:01,230
n, right? So, whenever we are pushing a node
into open, we will maintain- for every node
38
00:05:01,440 --> 00:05:04,510
that is there in open- we will maintain the
parent pointer, right?
39
00:05:04,510 --> 00:05:10,810
Later on, we will see that this is a useful
thing to do, because we will be looking for
40
00:05:10,810 --> 00:05:16,890
optimal paths, at the minimum cost paths to
a node. There you can
41
00:05:16,890 --> 00:05:23,890
arrive at a node from 2 different paths. So,
when you come along one path and then later
42
00:05:24,540 --> 00:05:28,380
on you find a better path, you will shift
the parent pointer to the
43
00:05:28,380 --> 00:05:35,380
new parent. We will go into that as we progress
further. What we have done so far is, we have
44
00:05:36,560 --> 00:05:41,000
studied just the basic search algorithm, where
we have a
45
00:05:41,000 --> 00:05:45,360
list called open, a list called closed and
we are transferring nodes from open to close
46
00:05:45,360 --> 00:05:50,740
as we are expanding there, right? So far,
we have not talked anything
47
00:05:50,740 --> 00:05:57,740
about costs. Now, let us see- how do we introduce
costs into the picture?
48
00:05:58,900 --> 00:06:05,560
So, when we have to search and optimize, or,
in other words, we have to find out the shortest
49
00:06:05,560 --> 00:06:10,730
path or the minimum set of operators to reach
the goal, then,
50
00:06:10,730 --> 00:06:17,730
we will have additional issues here. Besides
these basic 4 tuple, along with each operator,
51
00:06:21,320 --> 00:06:25,330
we will have some cost associated. If you
just want to reduce
52
00:06:25,330 --> 00:06:31,950
the number of steps, then, the cost can be
one for every operator. In other cases, an
53
00:06:31,950 --> 00:06:35,210
operator can have an associated cost. Like-
for example, you know
54
00:06:35,210 --> 00:06:42,210
the traveling salesperson problem. In the
traveling salesperson problem, we have a set
55
00:06:46,610 --> 00:06:53,610
of cities, and the job is to find a tour for
the traveling salesperson, to
56
00:06:53,760 --> 00:07:00,760
cover all the cities and then come back to
the starting city, right? And there can be
57
00:07:02,930 --> 00:07:04,200
various different tours.
58
00:07:04,200 --> 00:07:09,920
For example, this is one tour. Another tour
could be: I go from here to here, then here
59
00:07:09,920 --> 00:07:16,920
to here, and like this, like this and like
this, like this, right? So, if you
60
00:07:19,130 --> 00:07:25,600
look at a formulation- a state space formulation
of TSP, what should we do? We will start with
61
00:07:25,600 --> 00:07:32,300
one- what will be your state? A state could
be the partial
62
00:07:32,300 --> 00:07:39,300
tour that we have already covered. So, I have
already covered city AB and I have not yet
63
00:07:41,030 --> 00:07:48,030
covered anything else. From here, I can pick
up city C or I
64
00:07:48,180 --> 00:07:55,180
could go from A to B, and then, from there
to D, right? Or ABE, right? And then, from
65
00:08:02,220 --> 00:08:09,220
here again, I could go to ABC and then, say,
E, right? So, this is the
66
00:08:11,100 --> 00:08:18,100
formulation. And what are the operator costs
here? The operator cost is the cost of traversing
67
00:08:19,110 --> 00:08:24,610
from the from B to C here. The edge cost BC
is the operator
68
00:08:24,610 --> 00:08:31,610
cost here, for here, the edge cost BD is an
operator cost, right?
69
00:08:32,899 --> 00:08:38,819
When we actually look at an optimization problem,
then, the each step of the optimization is
70
00:08:38,819 --> 00:08:43,009
going to come with some cost, right? And that
is what we will
71
00:08:43,009 --> 00:08:50,009
augment our basic formulation unit. So, what
we have is this 4 tuple, and we have to find-
72
00:08:50,769 --> 00:08:54,350
there can be several things that we may want
to find. One is, we
73
00:08:54,350 --> 00:09:01,240
might ask for the minimum cost sequence of
transitions to a goal state- any goal state-
74
00:09:01,240 --> 00:09:05,769
and we just want a minimum cost sequence of
transitions to that,
75
00:09:05,769 --> 00:09:12,769
right? In this case, for TSP, the goal state
will be defined as a valid tool. And then,
76
00:09:13,209 --> 00:09:17,199
if we define the cost operators like so, then,
the minimum cost
77
00:09:17,199 --> 00:09:22,519
sequence of transitions to the goal state
will also give us the minimum cost goal, right?
78
00:09:22,519 --> 00:09:29,519
We could also ask for a sequence of transitions
to the minimum cost goal. What would that
79
00:09:33,930 --> 00:09:40,930
mean? Okay. Suppose, we define the goal of
the 8 queens
80
00:09:44,459 --> 00:09:51,459
problem, as any arrangement of the 8 queens.
So, every state is a goal, right? And if there
81
00:09:53,470 --> 00:09:58,199
are 2 queens attacking each other, then, we
associate a cost with
82
00:09:58,199 --> 00:10:04,990
it. Essentially, what we are saying is- place
the queens in the board in such a way that
83
00:10:04,990 --> 00:10:07,839
the minimum cost is incurred, and the minimum
cost incurred can
84
00:10:07,839 --> 00:10:13,370
be 0 when all the queens- none of the queens
are attacking each other, right? There, we
85
00:10:13,370 --> 00:10:17,170
will not associate any cost with the operators,
but we will
86
00:10:17,170 --> 00:10:20,709
associate the cost with the goal.
87
00:10:20,709 --> 00:10:26,499
We will see some kinds of search algorithms
where we start- where all states are goals-
88
00:10:26,499 --> 00:10:30,740
and we will iteratively improve the goal,
until we reach the
89
00:10:30,740 --> 00:10:37,740
minimum cost goal. Another option is a minimum
cost sequence of transitions to a minimum
90
00:10:37,889 --> 00:10:41,209
cost goal. So, operators have some cost, goal
has also some
91
00:10:41,209 --> 00:10:48,209
cost and we want to find the minimum cost
sequence of transitions to the best goal.
92
00:10:48,370 --> 00:10:52,160
Now, these problems are somewhat related,
between each other- the
93
00:10:52,160 --> 00:10:59,160
same problem can be formulated in one or more
nodes. Now, let us see how we augment our
94
00:11:00,730 --> 00:11:03,920
existing algorithm- the one that we have studied
so far- to
95
00:11:03,920 --> 00:11:09,939
take into account this cost. You will see
that it is very familiar to an algorithm that
96
00:11:09,939 --> 00:11:13,860
you already know. Let us start.
97
00:11:13,860 --> 00:11:20,639
What we are doing here is: like previously,
we are having open, which contains the start
98
00:11:20,639 --> 00:11:27,639
state s. We have closed, and we set the cost
of every state will be
99
00:11:29,389 --> 00:11:35,120
denoted by C of that state. So, c is the cost
function for the state. Initially, the cost
100
00:11:35,120 --> 00:11:41,259
of the start state is assigned to zero. Then,
again, like previously, if
101
00:11:41,259 --> 00:11:47,490
open is empty, we terminate and fail. Otherwise-
now here is the difference. We will select
102
00:11:47,490 --> 00:11:52,399
the minimum cost state n from open. Out of
all the states in
103
00:11:52,399 --> 00:11:56,660
open, we will pick up the one which is minimum
cost state. Later on, we will talk about what
104
00:11:56,660 --> 00:12:01,509
we do in case of tie breaking. We will come
to that later.
105
00:12:01,509 --> 00:12:07,800
Assume now, that all costs are distinct. So,
we just pick up the minimum cost state. We
106
00:12:07,800 --> 00:12:10,209
pick it up from open and save it in closed.
107
00:12:10,209 --> 00:12:15,129
Now, in order to do this, what will be the
data structure- one possible data structure,
108
00:12:15,129 --> 00:12:22,129
for open? A heap, right? But we will see that
we will need more than
109
00:12:24,019 --> 00:12:31,019
a heap, because the costs of the states may
change. So, in a heap, if the cost of some
110
00:12:31,410 --> 00:12:35,059
states inside the heap changes, then you will
have to rearrange the
111
00:12:35,059 --> 00:12:42,059
heap you have written. There are ways of doing
that. The 4th step is the same as before-
112
00:12:42,660 --> 00:12:49,660
we terminate, if we have found the goal.
Now, see that we will pick up the minimum
113
00:12:51,040 --> 00:12:56,449
cost state n from open, and if that state
is a goal, then only we terminate with success,
114
00:12:56,449 --> 00:12:57,430
right? Because we are
115
00:12:57,430 --> 00:13:04,430
always picking up the minimum cost node from
open. So, this part is simple. Only the selection
116
00:13:08,119 --> 00:13:12,199
from open is based on the minimum cost.
117
00:13:12,199 --> 00:13:19,199
Now, when we expand, this is what we do: we
generate the successors of the state n and
118
00:13:21,910 --> 00:13:27,399
then, for each successor m, if it does not
belong to open or
119
00:13:27,399 --> 00:13:34,399
closed, then we will insert it in open. But
with what cost? We will insert it in open
120
00:13:35,009 --> 00:13:42,009
with the cost cn, that is, the parent's cost,
plus the cost of the operator
121
00:13:42,610 --> 00:13:49,610
to take it from n to m. This gives us the
cost that we incurred to come up to state
122
00:13:51,329 --> 00:13:58,329
n plus the additional incremental cost to
go from n to m. And we will
123
00:13:58,730 --> 00:14:05,730
assign that cost as cm and insert m in open.
Now, suppose n already belongs n already belongs
124
00:14:07,740 --> 00:14:12,610
to open or closed. It is already there in
open or closed.
125
00:14:12,610 --> 00:14:19,610
Then, we will again we will set cm to the
minimum of its original cost and the new cost
126
00:14:22,269 --> 00:14:28,709
that we compute by cn plus cnm. So, if we
have arrived at the
127
00:14:28,709 --> 00:14:35,709
same state m, through another path, which
has cost lesser than the original path, then
128
00:14:36,279 --> 00:14:43,279
we will replace the existing cost by this
cost. Clear?
129
00:14:48,119 --> 00:14:53,790
And then if we find that cm has decreased-
if cm has remained the same, then there is
130
00:14:53,790 --> 00:14:58,420
nothing else to do. It is already there in
open or closed and the new
131
00:14:58,420 --> 00:15:04,519
path that we have discovered, is a larger
path, so we just ignore it. But if the cost
132
00:15:04,519 --> 00:15:10,929
has decreased and m is already in closed,
then we will move it to open. If
133
00:15:10,929 --> 00:15:16,230
m is in open, then we just update the cost
and leave it like that, because then, subsequently,
134
00:15:16,230 --> 00:15:21,559
m will be expanded, but if m is not has already
been expanded
135
00:15:21,559 --> 00:15:26,679
and has been taken to close, then what has
happened is that we have found a better path
136
00:15:26,679 --> 00:15:31,550
now. And so not only do we have to again expand
m, but we may
137
00:15:31,550 --> 00:15:38,550
have to expand several successors of m also,
because their cost may also have decreased,
138
00:15:39,239 --> 00:15:45,319
right? And then finally-actually, here I have
left out the last
139
00:15:45,319 --> 00:15:52,319
step. The last step is then, again, go back
to step 2. That is the loop, right?
140
00:15:55,379 --> 00:16:00,449
Let us take an example to work this out and
see what happens. Then, we will compare this
141
00:16:00,449 --> 00:16:03,920
with some of the algorithms that we already
know and you will
142
00:16:03,920 --> 00:16:10,920
see that there is a lot of familiarity here.
Let us take one state space which has the
143
00:16:18,189 --> 00:16:25,189
following states- let us say one. Can you
see this size from the back?
144
00:16:54,720 --> 00:17:01,720
Let us say that this is the goal state. This
state space will actually be given to the
145
00:17:21,350 --> 00:17:27,850
algorithm in an implicit form. So, I am just
drawing this for our
146
00:17:27,850 --> 00:17:34,220
convenience. Actually, the search algorithm
will not be able to see this whole graph at
147
00:17:34,220 --> 00:17:41,220
one time; it will only be able to see the
nodes that it expands. Let
148
00:17:41,399 --> 00:17:48,399
us say that the costs are as follows: this
is cost 2. We will start by maintaining 2
149
00:18:15,610 --> 00:18:22,610
lists: one will be our open
150
00:18:29,700 --> 00:18:36,700
and the other will be the closed list.
151
00:18:41,159 --> 00:18:48,159
Initially, open contains the state one, and
we will associate the cost of 0 with it. Remember,
152
00:19:00,580 --> 00:19:05,630
in the first step of the algorithm, we had
set cs is equal to 0,
153
00:19:05,630 --> 00:19:12,630
right? So, we will expand open in the first
step and put open in put one in closed. We
154
00:19:15,360 --> 00:19:22,360
will put this in close. And what is open going
to contain now? The 2
155
00:19:23,200 --> 00:19:30,200
successors- 2 with a cost of 2, and 5 with
a cost of one, right? Then, we are going to
156
00:19:37,720 --> 00:19:42,929
pick up the minimum cost state from open.
So, we will pick up 5 and
157
00:19:42,929 --> 00:19:49,929
then, we will put 5 in closed, with cost one.
And in open, we will now have- 2 will remain
158
00:19:54,110 --> 00:19:59,100
with a cost of 2; 5 is going to get expanded.
So, we will have 9
159
00:19:59,100 --> 00:20:04,570
with a cost of 2, right?
160
00:20:04,570 --> 00:20:11,570
Then again, out of these 2, these 2 have the
same cost. So, we will pick any one of them.
161
00:20:12,429 --> 00:20:19,429
Let us say that we pick up 2. Then, we will
have 2 with a cost of
162
00:20:19,630 --> 00:20:26,630
2 in closed, right? And then, here, we will
have 9 with a cost of 2. And for 2, we will
163
00:20:29,139 --> 00:20:36,139
have 6 and 3, right? So, 6 with a cost of
5 and 3 with a cost of 3.
164
00:20:43,649 --> 00:20:50,649
Okay. Then, next step: we will be picking
up 9 with a cost of 2. And what do we have
165
00:20:55,840 --> 00:21:02,840
here for 9? Only 10, right? So, 6 with a cost
of 5 will be there. 3
166
00:21:11,360 --> 00:21:18,360
with a cost of 3 will be there and we will
have 10 with a cost of 10, right? Then, we
167
00:21:20,950 --> 00:21:27,950
will be picking up 3. Next, in closed, we
will put 3 with a cost of 3.
168
00:21:31,240 --> 00:21:38,240
What will we have here? We will have 10 with
a cost of 10, 6 with a cost of 5 and we will
169
00:21:40,539 --> 00:21:47,539
have 4 with a cost of 5. Again, we have a
tie. Let us say that we
170
00:21:52,059 --> 00:21:55,830
pick up 6. So, we take 6 with a cost of 5.
171
00:21:55,830 --> 00:22:02,830
Now, something interesting will happen. When
we have 6 with a cost of 5, then okay. We
172
00:22:02,860 --> 00:22:09,860
will have 4 still, with a cost of 5, right?
We had 10 with a cost
173
00:22:10,450 --> 00:22:17,450
of 10. Now when we expand 6, we are going
to have 2 new entries. One is 7 with a cost
174
00:22:19,880 --> 00:22:26,880
of 6, and now 10 comes with a cost of 9. It
is already there in
175
00:22:28,899 --> 00:22:35,899
open. So, we just update the cost and we now
have 10 with a cost of 9. If it is already
176
00:22:38,090 --> 00:22:45,090
in open, we just update the cost. See, so
far, nothing has come out
177
00:22:45,200 --> 00:22:52,200
from closed to open. Nothing has come out,
right? Then, what will we pick up next? 4
178
00:22:57,590 --> 00:23:04,370
with a cost of 5 will come out. So, we will
have 7 with a cost of 6,
179
00:23:04,370 --> 00:23:11,370
10 with a cost of 9, 8 with a cost of 6, right?
Then, let us say we pick up 7 with of 6. What
180
00:23:17,880 --> 00:23:24,880
do we have here? We have 10 with a cost of
9, 8 with a cost of
181
00:23:26,139 --> 00:23:33,139
6 and for 7, we will have 11 with a cost of
16. Then, we will pick up 8 with a cost of
182
00:23:40,350 --> 00:23:47,350
6 and we will have 10 with a cost of 9, 11
with a cost of 16, and we
183
00:23:51,220 --> 00:23:58,220
now have 12 with a cost of 21. So, the goal
has come into open.
184
00:24:01,659 --> 00:24:08,659
Goal has come into open, but if we just pick
up the goal with a cost of 21, we will be
185
00:24:10,659 --> 00:24:17,149
incorrect. We still cannot pick up the goal,
though it is there in open.
186
00:24:17,149 --> 00:24:23,399
So, what- because there might still be a better
path to reach this goal, and because we are
187
00:24:23,399 --> 00:24:26,610
optimizing and our objective is not just to
find the goal, but to
188
00:24:26,610 --> 00:24:33,080
find the best path to the goal, we will not
stop here. We will continue doing this, until
189
00:24:33,080 --> 00:24:40,080
we pick up the goal for expansion. Next, what
will we pick up? We
190
00:24:41,220 --> 00:24:48,220
will pick up 10 with a cost of 9. That is
going to give us 10 with a cost of 9. Then,
191
00:24:53,600 --> 00:25:00,600
we will have 12 with a cost of 21. We had
11with a cost of 16, but now
192
00:25:00,779 --> 00:25:07,779
when we expand 10, we get 11 with a cost of
12. We replace this with 11with a cost of
193
00:25:09,720 --> 00:25:16,720
12, right, and then we will pick up 11 with
a cost of 12. And we
194
00:25:25,470 --> 00:25:32,470
have a cost of 21, but this is going to get
updated because of the expansion of 11. And
195
00:25:32,840 --> 00:25:39,009
we are going to get 12 with a cost of 13,
right?
196
00:25:39,009 --> 00:25:46,009
Next, 12 is selected for expansion. That is
where we terminate. So, we find that the path-the
197
00:25:50,259 --> 00:25:57,259
best path to the goal node has a cost of 13.
We will come
198
00:26:01,740 --> 00:26:08,740
exactly to this analysis now. We have to be
now be sure that what we have done is correct,
199
00:26:15,490 --> 00:26:22,490
right? Yes. The algorithm, yes. Slide. Yes.
It is possible. We
200
00:26:24,990 --> 00:26:30,000
will come to all those cases now. We will
systematically explore all this cases. It
201
00:26:30,000 --> 00:26:37,000
will depend on the kind of state space that
we have. Now, do you see
202
00:26:44,399 --> 00:26:50,320
familiarity of this algorithm with something?
Dijkstra's algorithm. This- when we are looking
203
00:26:50,320 --> 00:26:54,830
at positive edge cost. When we are looking
at positive edge
204
00:26:54,830 --> 00:27:01,830
cost, this is nothing but Dijkstra's algorithm,
right? But, when we have costs with negative
205
00:27:04,570 --> 00:27:11,570
cost, then we know that Dijkstra's will not
work. And the
206
00:27:12,429 --> 00:27:19,380
reason is exactly as you were asking- that
node can come back from close to open, because
207
00:27:19,380 --> 00:27:24,129
even after you have expanded that node, you
might find
208
00:27:24,129 --> 00:27:28,990
another path to some other node of higher
cost.
209
00:27:28,990 --> 00:27:33,549
In this case, what is happening is, if all
the edge costs are positive, then, when you
210
00:27:33,549 --> 00:27:37,409
are expanding your nodes, you know that there
cannot be any other
211
00:27:37,409 --> 00:27:44,409
node which has lesser cost, because you have
already explored the frontier up to that cost.
212
00:27:45,429 --> 00:27:48,240
And any nodes beyond that frontier is going
to add up more
213
00:27:48,240 --> 00:27:52,940
cost with it- more positive cost with it-
so those other states are going to have more
214
00:27:52,940 --> 00:27:59,340
cost. So, you cannot have anything with lesser
cost, right? But, if you
215
00:27:59,340 --> 00:28:06,340
allow negative edge costs, then it is possible,
that a successor of a node of cost 20 has
216
00:28:07,500 --> 00:28:14,330
a cost 5. If you have expanded the cost up
to frontier of 20, they
217
00:28:14,330 --> 00:28:19,080
could still be some successor down below,
which has a cost less than 20, because of
218
00:28:19,080 --> 00:28:22,250
the negative cost, right?
219
00:28:22,250 --> 00:28:28,549
In those cases, we may have to bring back
the node from close to open and it will still
220
00:28:28,549 --> 00:28:34,299
work. It will not work, however, if you have
a negative cost cycle.
221
00:28:34,299 --> 00:28:41,299
Yes. Where will we stop in that case? We will
stop when we have exhausted open. Now, can
222
00:28:45,919 --> 00:28:51,169
it be possible that open is never exhausted?
If you have a
223
00:28:51,169 --> 00:28:56,889
negative cost cycle, then, open will never
be exhausted. You will keep on picking up
224
00:28:56,889 --> 00:29:01,279
nodes from open and putting it back into open
after finding a better
225
00:29:01,279 --> 00:29:07,340
one, because in that loop, the cost of the
nodes will keep on decreasing in the negative
226
00:29:07,340 --> 00:29:12,090
cost cycle. So, you will keep on moving nodes
back from close to
227
00:29:12,090 --> 00:29:18,909
open and we expand in them, right, but as
long as you do not have a negative cost cycle,
228
00:29:18,909 --> 00:29:25,909
then, your algorithm will terminate, right?
229
00:29:27,500 --> 00:29:34,330
So, result number one is, if all operator
costs are positive, then the algorithm finds
230
00:29:34,330 --> 00:29:40,029
the minimum cost sequence of transition to
a goal. And this is exactly as
231
00:29:40,029 --> 00:29:47,029
in Dijkstra's: if operator costs are positive,
then, what we have is exactly Dijkstra's and
232
00:29:49,600 --> 00:29:56,600
no state will come back from closed to open.
If operators have
233
00:29:57,750 --> 00:30:04,750
unit cost, then, this is the same as breadth
first search. Yes or no? If all operators
234
00:30:07,519 --> 00:30:14,519
have unit costs, then, the cost of a node
is the minimum depth at which it
235
00:30:15,990 --> 00:30:21,690
can be reached, right? So, you will expand
it in that sequence. You will be expanding
236
00:30:21,690 --> 00:30:27,159
the nodes at a depth of 1, first, the depth
of 2. We are going breadth
237
00:30:27,159 --> 00:30:34,159
first, right? And then, we have already discussed
this. What happens if negative operator costs
238
00:30:41,460 --> 00:30:41,980
are allowed?
239
00:30:41,980 --> 00:30:48,980
Can you create an example, where a node is
going to come back from closed to open? Try
240
00:30:51,470 --> 00:30:56,850
to create an example where a node comes back
from close to
241
00:30:56,850 --> 00:31:03,850
open. . I am creating a much simpler example,
just to demonstrate the point. See, just check
242
00:32:13,710 --> 00:32:20,519
out this one. Do you think that this is going
to work? Let us
243
00:32:20,519 --> 00:32:27,519
see. We will start with 1, right? When we
expand this, we will have 2 with a cost of
244
00:32:29,230 --> 00:32:36,230
10 and 3 with a cost of 20, right? And then
when we expand 2, we will
245
00:32:48,070 --> 00:32:55,070
get- okay, let me increase this cost; increase
it to something like 15, right? So, when we
246
00:32:57,720 --> 00:33:03,159
expand 2, next thing that we are going to
have is, we will have 3
247
00:33:03,159 --> 00:33:10,159
with a cost of 20 here, and we will have 4
with a cost of 12, right?
248
00:33:12,399 --> 00:33:19,399
So, what do we have in open? What do we have
in closed? In closed- this is open. In closed,
249
00:33:24,590 --> 00:33:29,429
we have 1 with cost of 0 and now we have put
2 with a cost
250
00:33:29,429 --> 00:33:36,429
of 10. Next, we are going to pick up 4 with
a cost of 12 and that is going to give us
251
00:33:37,639 --> 00:33:44,639
3 with a cost of 20 and 5 with a cost of-
how much?- 27, right? Even if
252
00:33:53,940 --> 00:34:00,499
this is a goal, we cannot pick it up right
now. So, we will pick up 3 with a cost of
253
00:34:00,499 --> 00:34:07,499
20. We will have 3 with a cost of 20, and
that is going to give us 4. We
254
00:34:09,980 --> 00:34:16,980
will have 5 with a cost of 27 and now we have
created 4 with a cost of 20 minus 15. So,
255
00:34:19,980 --> 00:34:26,270
5. Now, it is in closed, but we have reached
it with a lesser cost.
256
00:34:26,270 --> 00:34:33,270
We will bring it back into open with a cost
of 5, right, and then, we will expand we expand
257
00:34:38,879 --> 00:34:44,879
this node, okay? This is now 4 with a cost
of 5, will come back
258
00:34:44,879 --> 00:34:51,879
here after the expansion. And what are we
going to have here? We are going to have 5
259
00:34:52,319 --> 00:34:56,980
with a cost of 20 and then when we pick this
up, we have
260
00:34:56,980 --> 00:35:03,980
discovered the least cost path to the goal,
which is of cost 20, along this path, right?
261
00:35:07,359 --> 00:35:14,359
Now, let us- okay. Now, we are going to study
another algorithm, which also is very useful.
262
00:35:21,410 --> 00:35:25,170
This is called branch and bound- least- or,
in other words,
263
00:35:25,170 --> 00:35:32,170
what we will study here is again another family
of algorithms, called branch and bound. In
264
00:35:32,410 --> 00:35:37,290
branch and bound, what we are going to have
is, we will start
265
00:35:37,290 --> 00:35:44,290
by knowing an upper bound on the solution
cost, right, and we are going to proceed something
266
00:35:48,670 --> 00:35:51,430
like: we can proceed depth first. We will
proceed depth
267
00:35:51,430 --> 00:35:57,980
first, find out one goal and whenever we find
out one goal, we still do not know that this
268
00:35:57,980 --> 00:36:02,829
is the least cost goal. But we can use this
as an upper bound, to
269
00:36:02,829 --> 00:36:07,670
prune out other parts of the search space,
right?
270
00:36:07,670 --> 00:36:14,670
In other words, what we are going to do is,
start with some bound. Let us call it, say
271
00:36:18,930 --> 00:36:25,930
c hat. Say this is the bound that we start
with, and then, I start doing a
272
00:36:26,300 --> 00:36:33,300
depth first traversal from along the state
space. I continue, until I reach a state where
273
00:36:35,240 --> 00:36:42,240
the cost exceeds c hat. Whenever that happens,
I backtrack and then
274
00:36:48,200 --> 00:36:55,200
try some other operators, right? In this way,
I am going to follow the cut off point of
275
00:36:57,849 --> 00:37:04,849
c hat, right, until I find, along some path-
I reach a goal. Suppose I
276
00:37:06,240 --> 00:37:13,240
find a goal and let us say that this goal
has cost of c1. Then, what I am going to do
277
00:37:19,000 --> 00:37:26,000
is, I am going to replace c hat by c1, and
now continue the search with
278
00:37:26,700 --> 00:37:33,700
c1 as cut off. So, any path which costs more
than c1 will be pruned. I will not visit any
279
00:37:39,210 --> 00:37:44,700
further. I will backtrack until I find another
goal which, say, has
280
00:37:44,700 --> 00:37:51,700
cost c2. Then my bound will become c2 and
I will again do a depth first traversal with
281
00:37:52,430 --> 00:37:55,170
the new frontier as c2, right?
282
00:37:55,170 --> 00:38:02,170
So, c1, c2, c3- like that, I will progressively
refine my upper bound, until I am finished
283
00:38:05,190 --> 00:38:08,869
with the entire search space. As long as I
am not finished with the
284
00:38:08,869 --> 00:38:15,869
entire search space, I cannot say that there
is no better cost. When I have finished searching
285
00:38:16,160 --> 00:38:21,160
the entire search space with these bounds,
then, my current
286
00:38:21,160 --> 00:38:28,160
bound gives me the cost of the minimum cost
solution. Is it clear? Will you be able to
287
00:38:30,809 --> 00:38:36,720
write a program for depth first branch and
bound? Not difficult,
288
00:38:36,720 --> 00:38:41,380
recursively write the thing. Only, at every
step, you check whether the current bound
289
00:38:41,380 --> 00:38:45,720
has been exceeded or not. Suppose you are
asked to write the
290
00:38:45,720 --> 00:38:52,220
traveling salesperson problem using depth
first branch and bound. You should be able
291
00:38:52,220 --> 00:38:56,349
to write it. You start with one city, then,
recursively traverse all the
292
00:38:56,349 --> 00:39:03,349
remaining cities. And when you have first
found the first tour, take any tour and you
293
00:39:03,579 --> 00:39:10,579
just find the first tour. Then, that tour
becomes your upper bound,
294
00:39:12,260 --> 00:39:13,630
right?
295
00:39:13,630 --> 00:39:19,880
There are, However, the performance of branch
and bound will depend, to a large extent,
296
00:39:19,880 --> 00:39:26,690
on the first upper bounds that you derive.
See, this complexity
297
00:39:26,690 --> 00:39:32,960
of whole thing will depend on how quickly
you are able to find out a goal whose cost
298
00:39:32,960 --> 00:39:39,140
is merely as close as the optimal goal. If
you can quickly find that,
299
00:39:39,140 --> 00:39:44,390
then you have a tight upper bound and then
your search complexity will be less, right?
300
00:39:44,390 --> 00:39:51,390
So, to do that, there are different heuristics.
There are heuristics which will- or greedy
301
00:39:51,579 --> 00:39:54,920
algorithms, which will give you a pretty close
approximation of the
302
00:39:54,920 --> 00:40:01,920
cost. What people do is, they first apply
a greedy approximation algorithm, get a reasonably
303
00:40:03,599 --> 00:40:08,740
tight upper bound on the solution cost; then,
they use that
304
00:40:08,740 --> 00:40:15,740
solution cost as the upper bound for doing
depth first branch algorithm. So, if you cast
305
00:40:17,750 --> 00:40:22,109
branch and bound in the same framework as
we have done so far,
306
00:40:22,109 --> 00:40:29,109
then this is what we are doing. We are maintaining
this cost C*, right? This C* is the bound,
307
00:40:39,230 --> 00:40:45,040
so initially, if you do not have any estimate,
then you treat C*
308
00:40:45,040 --> 00:40:52,040
as infinity. Then, when open is empty, then
return C*. As I said, that you have to exhaust
309
00:40:53,030 --> 00:40:57,720
the search space; you have to finish off all
states in the search
310
00:40:57,720 --> 00:40:59,750
space and only then, you can terminate.
311
00:40:59,750 --> 00:41:06,750
So, we will return C*, or the current cost,
when we find that open is empty, right? Otherwise,
312
00:41:09,809 --> 00:41:13,770
we just move as previously: we select a state
n from open
313
00:41:13,770 --> 00:41:20,770
and save it in closed. Then here, the terminate
step is different. What we do here is, if
314
00:41:21,680 --> 00:41:28,650
we find that n belongs to g, which means n
is a goal, and the current
315
00:41:28,650 --> 00:41:35,650
cost that we have found of n is less than
C*, That means we have found a better goal;
316
00:41:36,109 --> 00:41:41,059
we have found a goal having lesser cost. Then
we update C* to this
317
00:41:41,059 --> 00:41:48,059
new goal cost and then go to step 2, which
means that we again keep on exploring, right,
318
00:41:49,819 --> 00:41:54,690
but so far, we have not used the bound C*
to prune anything.
319
00:41:54,690 --> 00:42:01,609
Let us see what we do in expand. This part
is clear, right? Let us see what we do in
320
00:42:01,609 --> 00:42:08,609
expand. In expand, what we do is: we check
whether the cost cn is less
321
00:42:08,790 --> 00:42:15,790
than C*. If c n is not less than C*, then
there is no point in generating the successors
322
00:42:19,829 --> 00:42:26,049
of n, because you are not going to get a better
cost goal than this,
323
00:42:26,049 --> 00:42:33,049
right, assuming that all costs are positive.
Then, for each successor m, we do exactly
324
00:42:33,619 --> 00:42:40,339
as before: that if this happens, this happens.
Finally, we go back to
325
00:42:40,339 --> 00:42:47,200
step 2. So, it is the same as above, except
that we will expand a node, only if we find
326
00:42:47,200 --> 00:42:49,650
that it has a promise of giving us a better
goal.
327
00:42:49,650 --> 00:42:54,910
So, if its cost has already exceeded, or has
equaled the cost of C*, then, there is no
328
00:42:54,910 --> 00:43:00,160
point exploring it further. And we will just-
but if you have negative
329
00:43:00,160 --> 00:43:06,970
edge costs- then, this will not work, because
you will not be able to prune it. You will
330
00:43:06,970 --> 00:43:11,530
not be able to prune it, because you can still
have some node which
331
00:43:11,530 --> 00:43:18,530
has better cost, better goal cost than this.
Yes. Therefore, in those cases, we will not
332
00:43:20,500 --> 00:43:24,420
be able to use this branch and bound. At least
this kind of branch and
333
00:43:24,420 --> 00:43:28,559
bound. There are other algorithms, however,
but this basic branch and bound we cannot
334
00:43:28,559 --> 00:43:31,240
use.
335
00:43:31,240 --> 00:43:38,240
Now, can you tell us that what makes us choose
between the algorithms that we have studied
336
00:43:44,099 --> 00:43:51,099
so far? We have studied basic DFS, BFS, then
uniform cost
337
00:43:55,940 --> 00:44:01,230
search. We just searched like in Dijkstra's
and we have also studied branch and bound,
338
00:44:01,230 --> 00:44:07,089
depth first branch and bound. Which do you
think will work best
339
00:44:07,089 --> 00:44:14,089
in a for a problem which has a large state
space? Okay. So, there are several things
340
00:44:21,540 --> 00:44:26,010
that we need to consider: one is, we need
to consider the amount of
341
00:44:26,010 --> 00:44:33,010
branching that we have. That is one factor.
There are some state spaces which are shallow,
342
00:44:33,760 --> 00:44:40,760
but which have a lot of breadth. If you take
the travelling
343
00:44:41,059 --> 00:44:48,059
salesman problem, say, if you take something
like fifty cities, the depth is only fifty
344
00:44:50,650 --> 00:44:57,619
and that is not much. But, if you look at
the size of the state space-
345
00:44:57,619 --> 00:45:04,619
because, from every city from the start city,
you have 49 different options.
346
00:45:04,950 --> 00:45:11,950
From the second level you have, right. It
grows in a sort of factorial way. That is
347
00:45:15,170 --> 00:45:21,059
why, it is not it is the breadth that you
have to contain. If you try
348
00:45:21,059 --> 00:45:28,059
something like BSBB, then it is more likely
to work nicely, because if you get a reasonably
349
00:45:28,829 --> 00:45:33,280
tight upper bound- and we will see some heuristics
for doing
350
00:45:33,280 --> 00:45:40,280
that- then you can work in a recursive way.
Your space requirement will be less. You do
351
00:45:41,030 --> 00:45:44,790
not have to store the breadth, because you
are going depth first,
352
00:45:44,790 --> 00:45:51,790
right? So, if you use DSBB or if you use iterative
deepening also- will iterative deepening be
353
00:45:53,339 --> 00:46:00,339
good for DSB? Yes or no? You remember iterative
354
00:46:03,109 --> 00:46:10,109
deepening? We studied in the last class. What
we are doing is, we are progressively doing
355
00:46:10,299 --> 00:46:17,299
DFS with increasing bound. See, the problem
here is that all
356
00:46:17,859 --> 00:46:24,859
your solutions are at the same depth, so there
is no point in doing iterative deepening here.
357
00:46:29,210 --> 00:46:34,809
Depth first branch and bound will work, because
in many tours, we will be able to prune off
358
00:46:34,809 --> 00:46:41,640
early, because the cost already exists there,
right? If you do
359
00:46:41,640 --> 00:46:48,640
something like breadth first search, the amount
of branching that we will have will kill you.
360
00:46:49,460 --> 00:46:54,260
On the other hand, there are state spaces
where the depth is
361
00:46:54,260 --> 00:47:01,260
pretty large, but the breadth is not much.
That will happen if there are many- if you
362
00:47:05,890 --> 00:47:10,859
have state spaces, where you keep coming back
to the same set of
363
00:47:10,859 --> 00:47:16,160
states along different paths. It goes like
this: you start with a set of states, then,
364
00:47:16,160 --> 00:47:19,900
it just grows a little bit and then again
converges to some state, and again
365
00:47:19,900 --> 00:47:22,589
grows a little bit and converges to some state.
366
00:47:22,589 --> 00:47:29,589
You have state spaces like that, then the
branching factor is not much, but it can go
367
00:47:32,569 --> 00:47:36,950
up to a long depth, right? There, you may
have a goal which is pretty
368
00:47:36,950 --> 00:47:43,950
close to the start state and if you go depth
first, you will be doing a lot of work, right?
369
00:47:44,809 --> 00:47:48,970
As we do some problems in the lab, which we
will do from in
370
00:47:48,970 --> 00:47:54,150
another couple of classes, I will give some
assignments to work out in the lab. You can
371
00:47:54,150 --> 00:47:57,039
see for yourself by characterizing these things
out that what works
372
00:47:57,039 --> 00:48:04,039
best. So, in this, let us first just move.
I will introduce one or 2 more concepts and
373
00:48:13,390 --> 00:48:20,390
then close this particular lecture. What we
are going to leave off with
374
00:48:20,970 --> 00:48:27,970
this lecture with, is the notion of heuristics.
Now, what is a heuristic function? Heuristics
375
00:48:30,680 --> 00:48:34,359
are domain specific knowledge, to the estimate
the quality or
376
00:48:34,359 --> 00:48:38,520
potential of partial solutions.
377
00:48:38,520 --> 00:48:45,520
What we are expecting here is that, when we
are in a particular state of the state space,
378
00:48:51,390 --> 00:48:56,190
and suppose we know what the goals are, that
we want to reach.
379
00:48:56,190 --> 00:49:03,190
Then the heuristic function at a state s,
will be a function- let us call it hs. It
380
00:49:03,450 --> 00:49:10,450
is going to give us an estimate of the cost
of going from s to a goal. it is We do
381
00:49:16,990 --> 00:49:23,990
not know exactly where the goal is, but it
could be at any depth, anywhere. But this
382
00:49:25,950 --> 00:49:32,950
gives us an estimate of the cost of reaching
the goal, right? So, this
383
00:49:33,740 --> 00:49:40,200
estimate can be an underestimate, it can be
an overestimate, right? We will see that in
384
00:49:40,200 --> 00:49:43,319
the cases where this is an underestimate,
we have a family of
385
00:49:43,319 --> 00:49:49,500
algorithms, which will work pretty nicely.
And then we will see that if the heuristics
386
00:49:49,500 --> 00:49:53,539
overestimate, then the same algorithms can
perform well under
387
00:49:53,539 --> 00:50:00,539
certain circumstances and in other cases,
it may not terminate at all. So, in the next
388
00:50:00,789 --> 00:50:03,410
lecture, I will start introducing the notion
of heuristics.
389
00:50:03,410 --> 00:50:09,700
I will also talk about the heuristics used
in certain known problems and then, we will
390
00:50:09,700 --> 00:50:16,700
see how algorithms can utilize these heuristics
to solve the problem in
391
00:50:17,809 --> 00:50:24,809
a better way.
392
00:50:29,730 --> 00:50:36,730
Okay, so we will start the section on informed
state space search. In informed state space
393
00:50:42,520 --> 00:50:49,410
search- slides please. So, what we have here
is, when we talk
394
00:50:49,410 --> 00:50:56,030
about state space search, we talk about the
search space which is in the form of a set
395
00:50:56,030 --> 00:51:00,260
of states and set of state transition operators.
Now, when we have
396
00:51:00,260 --> 00:51:04,260
informed state space search, it means that
we have additional information indicating
397
00:51:04,260 --> 00:51:11,260
the proximity of the goal, from each state.
So, as I just outlined in the
398
00:51:12,579 --> 00:51:19,579
previous lecture, the notion of heuristics
is as follows: that you have heuristics that
399
00:51:20,049 --> 00:51:25,099
use domain specific information to estimate
the quality or potential of
400
00:51:25,099 --> 00:51:31,039
partial solutions, so that you know- that
if I have if the current state is the partial
401
00:51:31,039 --> 00:51:34,970
solution, then I know what is the potential
of growing this into a full
402
00:51:34,970 --> 00:51:40,410
solution; what is the additional cost that
I will require for doing that? Let us start
403
00:51:40,410 --> 00:51:47,170
few examples. The one of most common heuristics
for the 8 puzzle is the
404
00:51:47,170 --> 00:51:50,329
Manhattan distance heuristics.
405
00:51:50,329 --> 00:51:57,329
Now, you remember the 8 puzzle? Where you
have all the tiles- the 8 tiles- arranged
406
00:51:58,079 --> 00:52:04,530
in a 3 by 3 square, and we have to slide the
tiles to bring it to some
407
00:52:04,530 --> 00:52:11,530
configuration? To see the Manhattan mode heuristics
for this problem, let us say that the tiles
408
00:52:19,549 --> 00:52:26,549
are like this that I have, and I want to reach
the
409
00:52:33,079 --> 00:52:40,079
configuration- my goal configuration- which
is known, again. Now, the heuristic- the Manhattan
410
00:52:55,010 --> 00:53:00,760
mode heuristic says that find for every tile,
the
411
00:53:00,760 --> 00:53:07,760
Manhattan distance from its current position
to its final position. Manhattan distance
412
00:53:09,490 --> 00:53:14,589
is a commonly used term, which says that it
is the distance computed
413
00:53:14,589 --> 00:53:21,589
in terms of the distance on the x axis plus
the distance on the y axis. It comes from
414
00:53:21,970 --> 00:53:28,970
the fact that Manhattan apparently has all
roads which are either east
415
00:53:30,690 --> 00:53:33,030
to west or north to south.
416
00:53:33,030 --> 00:53:38,430
So, to travel from place c to place b, the
total distance that you have to travel is
417
00:53:38,430 --> 00:53:44,030
your distance northwards plus your distance
eastwards or westwards,
418
00:53:44,030 --> 00:53:51,030
right? You know why? Because suppose there
is some state. This is our start state. And
419
00:53:53,789 --> 00:54:00,789
there is some state here; some state n. And
the cost of n the cost of
420
00:54:01,980 --> 00:54:08,980
n is less than C*, and if your algorithm a
does not expand n, then I am going to give
421
00:54:15,589 --> 00:54:20,670
the algorithm a. Another instance of the problem
where the entire
422
00:54:20,670 --> 00:54:27,670
state space will be similar, except that just
below n, I will add a goal, right, and whose
423
00:54:30,339 --> 00:54:37,339
cost will be say cn, or just cn plus some
epsilon, where cn plus
424
00:54:39,299 --> 00:54:40,980
epsilon is also less than C*.
425
00:54:40,980 --> 00:54:47,980
I can always find such an epsilon and then,
because nothing else has changed in the state
426
00:54:49,440 --> 00:54:55,349
space, the algorithm a will be unable to find
this goal, because it
427
00:54:55,349 --> 00:55:02,349
is not expanding n. And if it does not expand
n, then it will never discover this goal and
428
00:55:05,109 --> 00:55:08,539
therefore, it will give you a sub-optimal
solution. It will still give
429
00:55:08,539 --> 00:55:15,539
you C*, but you have a goal which has better
cost. Now, is this analysis clear? Once again,
430
00:55:21,020 --> 00:55:28,020
okay? My claim is that if cn is less than
C* and C* is, what,
431
00:55:37,170 --> 00:55:44,170
optimal cost, then, n must be expanded. This
is my claim. Then, n must be expanded. This
432
00:56:03,730 --> 00:56:10,730
is my claim. Now, how do we establish this
claim? We say that,
433
00:56:11,799 --> 00:56:18,799
let us assume, that we have an algorithm a,
which does not expand n, okay? Let algorithm
434
00:56:31,210 --> 00:56:38,210
a does not expand n. Then, what we can do
is, we can keep the
435
00:56:40,400 --> 00:56:42,270
remaining state space identical.
436
00:56:42,270 --> 00:56:49,270
You do not make any change to the remaining
state space, except that below n, we just
437
00:56:50,520 --> 00:56:57,520
add a goal and give it a cost which is between
cn and C*. We can
438
00:57:00,160 --> 00:57:07,160
always do that, because cn is less than C*.
You can have some epsilon which you add to
439
00:57:07,500 --> 00:57:13,859
cn, and then this edge cost is that epsilon,
right? This goal will
440
00:57:13,859 --> 00:57:20,579
have cost cn plus epsilon. Now, from the point
of view of a, nothing has changed, because
441
00:57:20,579 --> 00:57:27,510
the entire remaining state space is similar
and in that scenario a
442
00:57:27,510 --> 00:57:34,510
was not expanding n. So, a will still not
expand n, and if it does not expand n, then,
443
00:57:37,079 --> 00:57:43,539
it will not see this goal. It will not be
able to see this goal unless it
444
00:57:43,539 --> 00:57:45,309
expands n.
445
00:57:45,309 --> 00:57:52,309
The minimum cost state n from open, right?
Now, if you have many states having the same
446
00:57:53,059 --> 00:58:00,059
cost, which one will we select? What we do
there is, if you
447
00:58:02,880 --> 00:58:09,880
have many costs with the same cost, select
the one which has minimum g value. Among those
448
00:58:11,210 --> 00:58:15,779
states which have the same f value, select
the ones select
449
00:58:15,779 --> 00:58:22,779
the one which has minimum g value, because
the others have already incurred a more cost
450
00:58:25,109 --> 00:58:29,680
in terms of g, and we do not know the accuracy
of the
451
00:58:29,680 --> 00:58:32,650
heuristics, right? Okay.
452
00:58:32,650 --> 00:58:39,650
So, with that, we will conclude this lecture.
In the next lecture, I will start by analyzing
453
00:58:45,440 --> 00:58:51,369
some results of A*, and then we will study
how we can create
454
00:58:51,369 --> 00:58:57,289
variants of A* which will work better than
A*. A* does not work very well in practice,
455
00:58:57,289 --> 00:59:01,569
that is because it requires too much of memory.
It is storing the
456
00:59:01,569 --> 00:59:06,150
whole of open and the whole of close, and
it uses up too much of memory. So, it does
457
00:59:06,150 --> 00:59:09,880
not work well in practice, but there are variants
of that which are
458
00:59:09,880 --> 00:59:11,990
used. We will study some of those in the next
lecture.