1
00:00:50,100 --> 00:00:56,559
Okay. In the last couple of lectures, we were
discussing state space search, and if you
2
00:00:56,559 --> 00:01:01,640
remember, in the initial introduction that
I gave on search, we said that there are 3
3
00:01:01,640 --> 00:01:06,690
different paradigms for problem solving, using
search, broadly.
4
00:01:06,690 --> 00:01:11,830
One was state space search, of which there
are few topics which are left; we will cover
5
00:01:11,830 --> 00:01:12,009
that
6
00:01:12,009 --> 00:01:18,630
up later. The second topic is problem reduction
search, and under problem reduction search,
7
00:01:18,630 --> 00:01:18,780
we
8
00:01:18,780 --> 00:01:25,149
will look at 2 kinds of graph search, namely,
and/or graphs and game trees. And/or graphs
9
00:01:25,149 --> 00:01:25,600
are
10
00:01:25,600 --> 00:01:32,050
a kind of structure which we will study, and
it has several different applications, though
11
00:01:32,050 --> 00:01:37,530
people do not always refer to them as and/or
graph search. But the underlying philosophy
12
00:01:37,530 --> 00:01:38,179
is
13
00:01:38,179 --> 00:01:44,369
the same. And then, we will look at game trees,
which is the backbone of game playing programs
14
00:01:44,369 --> 00:01:50,420
and for programs which optimize in the presence
of an adversary. So, game are situations where
15
00:01:50,420 --> 00:01:56,060
you have adversaries, and there is some criterion
that you may have to optimize, and in the
16
00:01:56,060 --> 00:02:01,549
presence of the adversary, you have to do
that optimization.
17
00:02:01,549 --> 00:02:08,549
So, problem reduction search can be broadly
defined as planning how best to solve a problem
18
00:02:10,619 --> 00:02:16,760
that can be recursively decomposed into sub-problems
in multiple ways. So, we can solve the
19
00:02:16,760 --> 00:02:21,500
same problem by decomposition. There are more
than one decompositions of the same problem,
20
00:02:21,500 --> 00:02:21,560
and
21
00:02:21,560 --> 00:02:27,060
we have to decide which is the best way to
decompose the problem, so that the total solution-
22
00:02:27,060 --> 00:02:34,060
cost quality of solution or the effort of
searching- is minimized. To start with, let
23
00:02:36,370 --> 00:02:36,440
us
24
00:02:36,440 --> 00:02:43,440
consider the matrix multiplication problem,
where you are given a set of matrices A1 till
25
00:02:46,590 --> 00:02:48,250
An,
26
00:02:48,250 --> 00:02:55,250
and we have to find out the product of them.
So, we have to find out A1, A2 to An, right?
27
00:02:58,690 --> 00:03:05,690
Now, we can do it in several ways. For example,
we can first multiply A1, A2; with that
28
00:03:11,780 --> 00:03:18,780
product, we can multiply A3, right; with that
product, we can multiply A4, this is one way
29
00:03:20,430 --> 00:03:20,859
of
30
00:03:20,859 --> 00:03:27,859
doing. Another way could be, that we first
multiply A1, A2, then we multiply A3, A4,
31
00:03:29,989 --> 00:03:31,329
right,
32
00:03:31,329 --> 00:03:38,329
then we multiply A5, A6, then A7, A8, in this
way. And then, we multiply these 2, multiply
33
00:03:45,419 --> 00:03:45,479
the
34
00:03:45,479 --> 00:03:52,479
product of A1, A2, with the product of A3,
A4, and the product of these 2; and then,
35
00:03:52,600 --> 00:03:52,889
finally,
36
00:03:52,889 --> 00:03:59,889
in the final step, we multiply the product
of this, right? So, it means, that if you
37
00:04:01,609 --> 00:04:02,030
look at
38
00:04:02,030 --> 00:04:09,030
it bottom up, then here are our matrices A1,
and so on. And one way of multiplying is by
39
00:04:17,120 --> 00:04:24,120
taking these 2, and these 2, and these 2,
right? So, this, if we look at it from the
40
00:04:25,630 --> 00:04:26,310
other
41
00:04:26,310 --> 00:04:33,310
direction; so, the problem of multiplying
it A1, A2, A3, A4, can be thought of, as multiplying
42
00:04:35,410 --> 00:04:42,410
A1, A2 and then A3, A4, and then this, right?
An alternative way of doing this, would be
43
00:04:45,710 --> 00:04:46,090
to
44
00:04:46,090 --> 00:04:53,090
have, right. And A1, A2, A3 can be done with
the A1, A2, A2. This is another decomposition,
45
00:05:12,910 --> 00:05:13,670
right?
46
00:05:13,670 --> 00:05:20,530
So, this way is one decomposition, this way
is another decomposition. These arcs that
47
00:05:20,530 --> 00:05:21,230
I draw
48
00:05:21,230 --> 00:05:26,650
here, indicate that both of these has to be
done, right, so you cannot do one of them.
49
00:05:26,650 --> 00:05:26,910
For
50
00:05:26,910 --> 00:05:32,130
example, when I have an and here, it means
that you have to solve this sub-problem of
51
00:05:32,130 --> 00:05:32,460
finding
52
00:05:32,460 --> 00:05:39,460
out A1, A2, and this sub-problem of multiplying
A3, A4, and then you can solve this. Once
53
00:05:39,590 --> 00:05:39,690
you
54
00:05:39,690 --> 00:05:45,440
have solved this one, and once we have solved
this one, then you can solve this, right?
55
00:05:45,440 --> 00:05:46,630
Now,
56
00:05:46,630 --> 00:05:52,940
as you can see, that there is cost associated
with each of these multiplications. If I have
57
00:05:52,940 --> 00:05:53,070
if
58
00:05:53,070 --> 00:06:00,070
A1 is n cross m, if A1 is n cross m, and A2
is m cross k, then the complexity of finding
59
00:06:06,430 --> 00:06:06,570
the
60
00:06:06,570 --> 00:06:13,570
product A1A2 is what? n into m into k, right?
And what is the size of this matrix? It becomes
61
00:06:25,990 --> 00:06:27,880
n cross k.
62
00:06:27,880 --> 00:06:34,880
So, when I take this n cross k matrix and
then I multiply it with another k cross z
63
00:06:35,790 --> 00:06:36,670
matrix,
64
00:06:36,670 --> 00:06:43,670
then the cost will become n cross k cross
z, right? Now, you can easily see that these
65
00:06:46,050 --> 00:06:51,690
products which all have, will all have different
cause. So, depending on the decomposition,
66
00:06:51,690 --> 00:06:58,690
the total number of operations that you have
to do for the matrix multiplication will vary.
67
00:06:59,389 --> 00:07:05,990
So, one problem is to determine, what is the
best way to multiply a given set of matrices.
68
00:07:05,990 --> 00:07:06,050
And
69
00:07:06,050 --> 00:07:11,210
there are different kinds of solutions to
this problem. For example, you may have studied
70
00:07:11,210 --> 00:07:15,330
dynamic programming solutions to this problem.
It is not difficult to create a dynamic
71
00:07:15,330 --> 00:07:21,120
programming formulation for this problem.
We will see how to cost this general problems
72
00:07:21,120 --> 00:07:21,240
into
73
00:07:21,240 --> 00:07:28,240
an and/or graph search framework, and we will
study one algorithm for solving them. Coming
74
00:07:28,650 --> 00:07:29,460
to
75
00:07:29,460 --> 00:07:36,169
other examples of problem reduction search,
there are several planning problems which
76
00:07:36,169 --> 00:07:36,560
get
77
00:07:36,560 --> 00:07:42,650
decomposed into sub-problems, and there are
many ways of decomposition. Are you familiar
78
00:07:42,650 --> 00:07:42,870
with
79
00:07:42,870 --> 00:07:45,710
the tower of Hanoi problem? Okay.
80
00:07:45,710 --> 00:07:52,710
The problem is like this, that you have 3
pegs, and one of them contains a set of disks.
81
00:08:05,850 --> 00:08:06,050
These
82
00:08:06,050 --> 00:08:11,810
are disks which have been put in from the
top. So, these are round disks, which have
83
00:08:11,810 --> 00:08:12,000
been
84
00:08:12,000 --> 00:08:19,000
inserted, so they have a hole in between,
so you can put them on this disk A. Now, what
85
00:08:20,400 --> 00:08:20,460
we
86
00:08:20,460 --> 00:08:27,460
have to do is to transfer all of these pegs-
all of these disks- from a to c, using b as
87
00:08:29,570 --> 00:08:30,210
an
88
00:08:30,210 --> 00:08:36,620
intermediate. But, the constraint is that
I cannot, at any point of time, put a larger
89
00:08:36,620 --> 00:08:36,740
disk on
90
00:08:36,740 --> 00:08:43,740
top of a smaller one. So, during the entire
transfer, I can move one disk at a time; I
91
00:08:43,750 --> 00:08:44,219
am not
92
00:08:44,219 --> 00:08:46,750
allowed to move more than one disk at a time.
93
00:08:46,750 --> 00:08:53,750
So, the constraints are one disk at a time,
right? And the second constraint is that small
94
00:09:02,990 --> 00:09:09,990
disk- smaller disk- can never sit on a- rather,
it is the other way around: a larger disk
95
00:09:20,959 --> 00:09:27,959
cannot sit on a can never sit on a smaller
one, right? So, with that restriction- with
96
00:09:34,949 --> 00:09:35,790
these 2
97
00:09:35,790 --> 00:09:42,790
restrictions- we have to transfer the set
of disks from a to c. There is very neat recursive
98
00:09:45,319 --> 00:09:52,319
solution to this, that say, that- use the
algorithm; suppose we have an algorithm, say
99
00:09:56,410 --> 00:09:57,680
p. Use
100
00:09:57,680 --> 00:10:04,680
the algorithm p to transfer the top n minus
one disks; the top n minus one disks, from
101
00:10:07,050 --> 00:10:08,019
a to b,
102
00:10:08,019 --> 00:10:08,519
right?
103
00:10:08,519 --> 00:10:15,519
When you are moving this top n minus one disks,
the largest disk is here; it remains here,
104
00:10:15,920 --> 00:10:16,230
so
105
00:10:16,230 --> 00:10:23,230
it is a sub-problem of shifting the smaller
n minus one, to the second disk. Once you
106
00:10:24,009 --> 00:10:24,360
have
107
00:10:24,360 --> 00:10:31,360
solved this sub-problem, then you transfer
the largest disk from a to c; there is no
108
00:10:32,819 --> 00:10:33,240
problem
109
00:10:33,240 --> 00:10:39,740
in doing this, because at that time, c is
empty. And then, recursively, again, transfer
110
00:10:39,740 --> 00:10:40,029
the n
111
00:10:40,029 --> 00:10:47,029
minus one disks, that were in b to c, right?
So, what we have here is, suppose we say that
112
00:10:48,300 --> 00:10:55,300
initial problem was, to transfer n disks from
a to c; then, we are basically decomposing
113
00:10:58,139 --> 00:10:58,360
this
114
00:10:58,360 --> 00:11:05,360
into 3 sub-problems- that transfer the top
n minus one disks from a to b, then, transfer
115
00:11:12,499 --> 00:11:12,670
the
116
00:11:12,670 --> 00:11:19,670
largest disk from a to c, and then, transfer
the n minus one disks that we are moved to
117
00:11:24,569 --> 00:11:25,189
b, so
118
00:11:25,189 --> 00:11:27,920
they are now moved to b to c.
119
00:11:27,920 --> 00:11:34,569
We have to solve all this problems in order
to solve the tower of Hanoi. This is one kind
120
00:11:34,569 --> 00:11:34,679
of
121
00:11:34,679 --> 00:11:39,879
decomposition of the problem. There can be
many other ways of decomposing the problem,
122
00:11:39,879 --> 00:11:40,939
right?
123
00:11:40,939 --> 00:11:47,329
Once we have chosen a decomposition, the solving
procedure is standard, but the objective
124
00:11:47,329 --> 00:11:53,559
here, is to determine that which of these
methodologies of decomposing the problem works
125
00:11:53,559 --> 00:11:53,910
best
126
00:11:53,910 --> 00:12:00,910
for a given problem? Then, there are blocks
world problems in planning; we will discuss
127
00:12:01,689 --> 00:12:02,079
this
128
00:12:02,079 --> 00:12:08,279
later, when we talked about planning problems,
and also theorem proving, where, in order
129
00:12:08,279 --> 00:12:08,459
to
130
00:12:08,459 --> 00:12:14,059
prove something, we will see that there are
different premises and different ¬¬¬__
131
00:12:14,059 --> 00:12:14,480
and the way
132
00:12:14,480 --> 00:12:21,480
in which we combine these to arrive at the
shortest proof, is also a problem reduction.
133
00:12:22,579 --> 00:12:29,579
Let us see how we create a formulation of
the problem reduction search problem. So,
134
00:12:33,559 --> 00:12:33,980
we will
135
00:12:33,980 --> 00:12:40,980
have an AND/OR graph, where an OR node represents
a choice between possible decompositions.
136
00:12:43,769 --> 00:12:49,399
There can be more than one decomposition,
and we will use an or node to choose between
137
00:12:49,399 --> 00:12:53,739
possible decompositions. I will give you an
example- complete example, of what I mean
138
00:12:53,739 --> 00:12:55,959
by that.
139
00:12:55,959 --> 00:13:02,959
And we will have and nodes, which represents
a given decomposition, right? It means that
140
00:13:04,489 --> 00:13:04,600
if
141
00:13:04,600 --> 00:13:10,420
you have an all node, then you have to solve
any one of its successors; if you have an
142
00:13:10,420 --> 00:13:17,050
node, we have to solve all its successors.
So, and nodes are actually the decompositions.
143
00:13:17,050 --> 00:13:21,230
And/or nodes will represent the choice between
different decomposition. We will come to
144
00:13:21,230 --> 00:13:28,230
examples which will clarify this, and later
on, we will study game trees, where we will-
145
00:13:30,239 --> 00:13:35,999
instead of and and or, we will have max and
min nodes, where max nodes will represent
146
00:13:35,999 --> 00:13:36,149
the
147
00:13:36,149 --> 00:13:40,230
choice of my opponent, and min nodes will
represent my choice.
148
00:13:40,230 --> 00:13:45,709
When we come to game trees, I will elaborate
up on this, but these 2 formulations have
149
00:13:45,709 --> 00:13:46,300
a
150
00:13:46,300 --> 00:13:52,360
similarity, in the sense that both have 2
different kinds of nodes; each node has a
151
00:13:52,360 --> 00:13:52,779
kind of
152
00:13:52,779 --> 00:13:58,290
optimization criterion- like max nodes will
maximize, min will minimize, and nodes will
153
00:13:58,290 --> 00:13:58,489
take
154
00:13:58,489 --> 00:14:03,059
the sum of the cost, or node will take again
the minimum of the cost, if you are looking
155
00:14:03,059 --> 00:14:03,249
in a
156
00:14:03,249 --> 00:14:06,579
minimization problem.
157
00:14:06,579 --> 00:14:13,579
So, this is the AND/OR graph search problem.
We are given implicitly specified AND/OR graph,
158
00:14:17,860 --> 00:14:22,220
where the start node of the AND/OR graph,
s is the start node of the AND/OR graph, t
159
00:14:22,220 --> 00:14:22,709
is a set
160
00:14:22,709 --> 00:14:28,209
of terminal nodes and h is a heuristic function
that estimates the cost of solving the sub-
161
00:14:28,209 --> 00:14:34,279
problem at n. And we are to find the minimum
cost solution tree. Let me give an example
162
00:14:34,279 --> 00:14:35,339
first,
163
00:14:35,339 --> 00:14:39,529
and then we will go into the actual algorithm
for doing this. So, while I give this example,
164
00:14:39,529 --> 00:14:40,119
I
165
00:14:40,119 --> 00:14:47,100
will also give you an outline of how we plan
to solve such problems. So, first let us
166
00:14:47,100 --> 00:14:51,499
understand what is what do we mean by an AND
node and an OR node.
167
00:14:51,499 --> 00:14:58,499
So, suppose we start with a problem that we
have to solve. Let us say this is something
168
00:15:02,249 --> 00:15:02,429
like
169
00:15:02,429 --> 00:15:09,429
the matrix multiplication problem. I have
to multiply matrices A1, A2, A3, right? Initially,
170
00:15:19,119 --> 00:15:26,119
let us say that I have an or node, which will
say that I want to solve this as A1, A2, A3,
171
00:15:33,009 --> 00:15:33,040
and
172
00:15:33,040 --> 00:15:40,040
this one says, I will solve it as A1, A2 and
A3. Now, clear, that these are the 2 ways
173
00:15:43,499 --> 00:15:43,799
of
174
00:15:43,799 --> 00:15:50,089
solving the problem? In order to solve it
with this way, I have an AND node, which says
175
00:15:50,089 --> 00:15:50,829
that
176
00:15:50,829 --> 00:15:57,829
you have to solve A1, and you have to solve
A2, A3. So, this is an AND node. And, here
177
00:15:57,989 --> 00:15:58,819
also, I
178
00:15:58,819 --> 00:16:05,819
will have a decomposition A1, A2 and A3. So
this is an AND node, right? Okay. Now, the
179
00:16:16,239 --> 00:16:16,379
way I
180
00:16:16,379 --> 00:16:23,379
am going to evaluate it, is that I will find
out- so, in order to solve this, again, I
181
00:16:25,699 --> 00:16:26,119
have to
182
00:16:26,119 --> 00:16:28,970
take the product of A2 and A3, right?
183
00:16:28,970 --> 00:16:34,949
What is the cost of taking this product? Let
us put some- put the dimensions of these,
184
00:16:34,949 --> 00:16:35,129
so let
185
00:16:35,129 --> 00:16:42,129
us say that the dimension of A is 3 cross
4, dimension of A2 is 4 cross 10, and A3 is
186
00:16:48,459 --> 00:16:50,009
10 cross
187
00:16:50,009 --> 00:16:57,009
1, right? If that is the case, what is the
cost of this A2, A3? 4 into 10 into 1, so
188
00:16:59,649 --> 00:17:00,199
that is
189
00:17:00,199 --> 00:17:07,199
40. So I associate a cost of 40 with this.
And what is the cost of this? 0 is- nothing
190
00:17:07,589 --> 00:17:07,920
to
191
00:17:07,920 --> 00:17:14,920
multiply here, so this is 0, right? What is
the dimension of this A2, A3? 4 cross 1, and
192
00:17:18,000 --> 00:17:18,280
the
193
00:17:18,280 --> 00:17:25,280
dimension of this is 3 cross 4, right? So,
since I have to solve both of these, so therefore,
194
00:17:31,490 --> 00:17:35,559
what do I have as the cost of this operation?
195
00:17:35,559 --> 00:17:42,559
This particular operation will have a cost
of 3 into 4 into 1, so 12, plus the cost of
196
00:17:49,340 --> 00:17:50,059
what I
197
00:17:50,059 --> 00:17:57,059
have from this, so plus 40, so this comes
to 52, right? Likewise, if you look at this-
198
00:18:01,950 --> 00:18:02,080
what is
199
00:18:02,080 --> 00:18:09,080
the cost of this? 3 into 4 into 10, so 120,
right, and this has a cost of this has a dimension
200
00:18:17,139 --> 00:18:24,139
of 3 cross 10, right, and what is the cost
of this? 0? Okay. What is the cost of taking
201
00:18:30,750 --> 00:18:30,860
this
202
00:18:30,860 --> 00:18:37,860
product? 3 into 10 into 1, so 30, plus this
120, so this comes to 150. In all nodes, I
203
00:18:47,059 --> 00:18:47,320
will be
204
00:18:47,320 --> 00:18:52,639
choosing; because this is a minimization problem,
I will be choosing the least cost successor,
205
00:18:52,639 --> 00:18:59,639
so I will be choosing this one, right? Therefore,
finally, what is my solution? It is the
206
00:19:03,679 --> 00:19:10,679
sub-tree that is rooted along the solution,
if I take the arcs along- the selected arcs
207
00:19:12,130 --> 00:19:12,440
along
208
00:19:12,440 --> 00:19:17,149
the OR node. So, it means that this is the
way to solve the problem.
209
00:19:17,149 --> 00:19:22,159
First, take the product of A2 and A3, and
then you take with product, with A1, that
210
00:19:22,159 --> 00:19:22,360
is going
211
00:19:22,360 --> 00:19:27,460
to give you a total cost of 52 which is the
best that you can do for this particular problem.
212
00:19:27,460 --> 00:19:33,590
Let us consider, right? If you have many more
matrices, then this tree would go deeper,
213
00:19:33,590 --> 00:19:33,669
and
214
00:19:33,669 --> 00:19:39,990
you will have more or nodes and more and nodes.
But in and nodes, the cost of taking this
215
00:19:39,990 --> 00:19:45,370
product and this product will add up, plus
the cost of taking the product of this and
216
00:19:45,370 --> 00:19:46,130
this,
217
00:19:46,130 --> 00:19:51,850
will be added to that, right? So, that is
the cost of the and nodes. In the or node,
218
00:19:51,850 --> 00:19:52,130
I will
219
00:19:52,130 --> 00:19:57,190
select only the best among the successors,
and the cost of that best successor will be
220
00:19:57,190 --> 00:19:57,529
backed
221
00:19:57,529 --> 00:20:04,529
up as the cost of the or node, right? Now
all this step we have said so far, is in the
222
00:20:06,659 --> 00:20:07,110
absence
223
00:20:07,110 --> 00:20:11,590
of heuristic functions. in the absence of
heuristic function
224
00:20:11,590 --> 00:20:17,019
Just like we had in state space search, we
can also have heuristic functions, that given
225
00:20:17,019 --> 00:20:17,039
a
226
00:20:17,039 --> 00:20:23,440
particular sub --problem, gives us an estimate
of the best way to solve that problem. It
227
00:20:23,440 --> 00:20:23,669
gives
228
00:20:23,669 --> 00:20:30,669
us the least cost by which we are to be we
can solve that problem. Again, we can have
229
00:20:30,850 --> 00:20:35,090
overestimates; again, we can have underestimates.
So, at this point of time, we will assume
230
00:20:35,090 --> 00:20:41,639
that we have only underestimates, right? So,
if we take heuristics into account, let us
231
00:20:41,639 --> 00:20:42,029
say
232
00:20:42,029 --> 00:20:49,029
let us see what happens. So, let us say that
we start again, with another example, where
233
00:20:49,399 --> 00:20:49,899
at
234
00:20:49,899 --> 00:20:56,899
the top node, we have h is equal to 7. And
let us say that this is an and node. this
235
00:20:58,049 --> 00:20:59,200
is an AND
236
00:20:59,200 --> 00:21:00,470
node
237
00:21:00,470 --> 00:21:07,470
So, the way in which we will solve this problem
is that, we will- just like we were
238
00:21:09,860 --> 00:21:16,860
maintaining open for state space search, we
will maintain a marked and/or graph, indicating
239
00:21:18,370 --> 00:21:25,370
which is the best way of solving the problem
up to now. So, if we have a and node, in order
240
00:21:26,360 --> 00:21:26,429
to
241
00:21:26,429 --> 00:21:31,570
solve it, we will have to solve both of its
successors. So, we simply expand the and node
242
00:21:31,570 --> 00:21:31,909
and
243
00:21:31,909 --> 00:21:38,590
we get its successors. In this case, let us
say that we have 2 successors, and then again,
244
00:21:38,590 --> 00:21:38,860
we
245
00:21:38,860 --> 00:21:45,250
evaluate the heuristic function in the child
nodes. So, let us say that this gives us h
246
00:21:45,250 --> 00:21:45,600
equal
247
00:21:45,600 --> 00:21:52,600
to 4, and this gives us h equal to 3, right,
and in general, we can associate some costs
248
00:21:54,809 --> 00:21:55,059
with
249
00:21:55,059 --> 00:21:56,950
the edges also.
250
00:21:56,950 --> 00:22:03,950
These costs will be the costs of merging these
sub-problems back into the original problem,
251
00:22:05,179 --> 00:22:11,710
like, for example, in that case, this was
the cost of the multiplying of the sub-products,
252
00:22:11,710 --> 00:22:18,710
right? In general, we can have separate costs
for the separate edges, right? So, now, you
253
00:22:19,190 --> 00:22:20,019
see-
254
00:22:20,019 --> 00:22:27,019
what do we have here? We have 2 successors;
this one has an estimate of 4- it means that
255
00:22:28,710 --> 00:22:28,950
in
256
00:22:28,950 --> 00:22:33,590
order to solve this sub-problem, we are estimating
that at least 4 units of costs will have to
257
00:22:33,590 --> 00:22:38,639
be incurred to solve this; at least 3 units
of cost has to be incurred. And because this
258
00:22:38,639 --> 00:22:38,909
is an
259
00:22:38,909 --> 00:22:45,039
AND node, we have to mark both the successors,
because both have to be solved.
260
00:22:45,039 --> 00:22:51,659
The marked ones are the ones that we will
eventually we want to solve. the once we eventually
261
00:22:51,659 --> 00:22:58,659
want to solve. So, now, we can revise this
cost- we can revise this cost, because now,
262
00:23:00,980 --> 00:23:01,360
the
263
00:23:01,360 --> 00:23:08,360
cost has grown, because we know to solve this,
we require 4 plus 2, 6, and from this side,
264
00:23:08,659 --> 00:23:08,820
we
265
00:23:08,820 --> 00:23:15,820
have 3 plus one, 4, so, the total of 10 is
the new cost that I associate with this AND
266
00:23:18,360 --> 00:23:19,669
node,
267
00:23:19,669 --> 00:23:25,409
right? This 10 is also an underestimate, because
this one will require at least 4, this one
268
00:23:25,409 --> 00:23:32,409
will require at least 3, and if I add up this
cost, then the total is at least 10. Is it
269
00:23:32,610 --> 00:23:32,740
clear
270
00:23:32,740 --> 00:23:39,740
how I arrived at this figure-10- 4 plus 2
plus 3 plus 1? Then, let us say I expand.
271
00:23:43,450 --> 00:23:44,380
Now, see,
272
00:23:44,380 --> 00:23:49,279
when I have this marked sub-tree, it does
not matter whether I expand this first or
273
00:23:49,279 --> 00:23:49,759
this
274
00:23:49,759 --> 00:23:54,549
first, because for the and node, I will have
to solve both, right?
275
00:23:54,549 --> 00:24:00,919
So, let us say, I pick up this one, and I
expand that, and this, let us say, is an or
276
00:24:00,919 --> 00:24:03,070
node. We
277
00:24:03,070 --> 00:24:10,070
discover that it is an or node, and now it
has 2 successors, right, and as we keep on
278
00:24:18,039 --> 00:24:23,610
expanding this, we will go to sub-problems
and sub-problems and sub-problems, and finally,
279
00:24:23,610 --> 00:24:23,919
we
280
00:24:23,919 --> 00:24:28,630
will arrive at an leaf level, where those
sub-problems are unit level problems, which
281
00:24:28,630 --> 00:24:28,950
we can
282
00:24:28,950 --> 00:24:35,950
solve, right? That is the end of the decomposition-
the basic units of problems that we will
283
00:24:35,960 --> 00:24:42,960
solve. Let us say here, that these 2 that
we have arrived at, are the basic sub-problems,
284
00:24:43,830 --> 00:24:50,830
right, and let us say, that solving this requires
9, solving this requires 7, and let us say
285
00:24:53,909 --> 00:24:58,320
that these 2 are zero, right?
286
00:24:58,320 --> 00:25:05,320
So, I have 9 here and 7 here, okay? Now, because
this is an or node, I can solve either this
287
00:25:10,169 --> 00:25:17,169
or this, right? I will choose the one which
has lesser cost, right? So, I will choose
288
00:25:18,039 --> 00:25:18,750
this and
289
00:25:18,750 --> 00:25:25,750
mark this successor, right? Now, this cost
is going to get updated. What happens is,
290
00:25:30,210 --> 00:25:30,679
I am
291
00:25:30,679 --> 00:25:37,679
performing a cost revision bottom up, so I
update this one to what? 7, right? And then,
292
00:25:41,559 --> 00:25:41,799
again,
293
00:25:41,799 --> 00:25:46,529
update this one, because this cost has changed,
so this will also change. So, now, this is
294
00:25:46,529 --> 00:25:53,529
going to be 6 plus 8, so 14. So, this one
gets updated to 14. As of now, I can see that
295
00:25:58,429 --> 00:25:58,549
this
296
00:25:58,549 --> 00:26:02,909
is the best way of solving the problem, and
up to so up to this part, that this is the
297
00:26:02,909 --> 00:26:03,330
best
298
00:26:03,330 --> 00:26:06,919
way of solving it- where I have still not
solved this one.
299
00:26:06,919 --> 00:26:13,480
I will expand this I will expand this node
and let us say, that this is also a or node.
300
00:26:13,480 --> 00:26:13,940
So, I
301
00:26:13,940 --> 00:26:20,940
will expand that. And let us say that I get
2 nodes- this one has h equal to 5. This one
302
00:26:29,320 --> 00:26:29,750
has h
303
00:26:29,750 --> 00:26:36,750
equal to 2, right? h equal to 5, h equal to
2. So, you can use pathmax, if you want, into
304
00:26:48,019 --> 00:26:48,120
one
305
00:26:48,120 --> 00:26:55,120
where is heuristic less than that of - yes
yes, so you can update it, if you want, right,
306
00:26:55,820 --> 00:26:56,590
so
307
00:26:56,590 --> 00:27:02,659
if- you can update it, if you want, using
pathmax, as we have done previously, right?
308
00:27:02,659 --> 00:27:03,970
So, let
309
00:27:03,970 --> 00:27:09,320
us go on with this example and those optimizations,
that you can update this; we can do it
310
00:27:09,320 --> 00:27:16,320
later. Let us say that this one has a cost
of 1; this also has a cost of 1, right?
311
00:27:17,460 --> 00:27:23,669
Now, see heuristic of this- suppose this has
cost of 2, then you have nothing to worry
312
00:27:23,669 --> 00:27:23,870
about,
313
00:27:23,870 --> 00:27:28,929
because this is 2 plus 2, 4, which agrees
with this, right? It is because 2 plus one
314
00:27:28,929 --> 00:27:29,610
is 3, and
315
00:27:29,610 --> 00:27:36,610
that is less than this, so if you want, we
can make this 12, let us make it 2. Now, if
316
00:27:39,769 --> 00:27:39,929
we
317
00:27:39,929 --> 00:27:46,929
compare this, this has a cost of 4 and this
has a cost of 6. Therefore, we will mark this
318
00:27:47,639 --> 00:27:48,750
one
319
00:27:48,750 --> 00:27:54,190
as the base successor. In an OR node, we will
always mark the best successor, the current
320
00:27:54,190 --> 00:27:54,480
best
321
00:27:54,480 --> 00:28:01,480
successor. Now, if you mark this, then this
cost has not changed anymore, this cost has
322
00:28:01,870 --> 00:28:02,049
not
323
00:28:02,049 --> 00:28:07,460
changed, so therefore, we do not have to do
any cost revision beyond this point, because
324
00:28:07,460 --> 00:28:07,620
this
325
00:28:07,620 --> 00:28:14,620
cost has not changed. So, there is no need
to go further up; this cost will still remain
326
00:28:14,889 --> 00:28:15,620
as
327
00:28:15,620 --> 00:28:17,080
14, right?
328
00:28:17,080 --> 00:28:23,779
And now, let us see- what is the best solution
that we have? We solve this here, and this
329
00:28:23,779 --> 00:28:30,269
here, right? Now again, we want to expand
another node now, which node we will select?
330
00:28:30,269 --> 00:28:30,559
This
331
00:28:30,559 --> 00:28:36,230
one. We are not selecting this node for expansion,
because currently, this is not good; this
332
00:28:36,230 --> 00:28:42,450
is better- the OR node has picked this as
a successor. So, we are always going to pick
333
00:28:42,450 --> 00:28:42,799
a leaf
334
00:28:42,799 --> 00:28:49,799
node of the marked sub-tree. In this case,
the marked sub-tree, so far, is this.
335
00:28:53,450 --> 00:28:59,779
We will pick up, always, a leaf node of the
mark sub-tree and expand that. In the marked
336
00:28:59,779 --> 00:28:59,950
sub-
337
00:28:59,950 --> 00:29:06,950
tree, we have this one, so we expand this,
and this gives us again: let us say we have
338
00:29:08,610 --> 00:29:09,440
2
339
00:29:09,440 --> 00:29:16,440
successor, one has h equal to 3, and the other
successor is a solved node, which is 10, this
340
00:29:24,169 --> 00:29:31,169
is 0, this is 1, let us say, and this is an
AND node.
341
00:29:31,399 --> 00:29:38,399
So, now, what is the cost? This cost is going
to get updated; it is going to be how much?
342
00:29:43,820 --> 00:29:44,590
10
343
00:29:44,590 --> 00:29:51,590
plus 0 and 3 plus 1, 4, so 14. This cost has
changed, by the way, because this is the and
344
00:29:57,549 --> 00:30:04,549
node; both of it successors will be marked.
Now, we take this node and again, because
345
00:30:06,940 --> 00:30:07,039
this
346
00:30:07,039 --> 00:30:14,039
cost has changed, this whole cost revision
step will have to be done. Now, this one will
347
00:30:14,200 --> 00:30:14,340
get
348
00:30:14,340 --> 00:30:21,340
replaced by 16- 14 plus 2, 16. Wait, wait.
Now, now now at this point of time, we have
349
00:30:28,730 --> 00:30:28,960
to see
350
00:30:28,960 --> 00:30:35,700
which is the best for successor of this or
node. If you look from this side, what you
351
00:30:35,700 --> 00:30:35,820
are
352
00:30:35,820 --> 00:30:41,549
getting up, what is being backed up is 16,
but from this side, we now have a better one-
353
00:30:41,549 --> 00:30:41,710
that
354
00:30:41,710 --> 00:30:42,679
6.
355
00:30:42,679 --> 00:30:49,679
So, we are going to choose the less of the
2, and take 6 as the heuristic cost of this
356
00:30:51,009 --> 00:30:52,440
node.
357
00:30:52,440 --> 00:30:59,440
Now, does that change this- it does, because
it has changed from 4 to 6. This is now going
358
00:31:02,309 --> 00:31:02,470
to
359
00:31:02,470 --> 00:31:09,470
become 16, is this clear? And now, the marked
successor is this- this mark is not there
360
00:31:14,749 --> 00:31:21,749
anymore; this mark has shifted in this direction,
right? So, the mark shifts when I find the
361
00:31:24,259 --> 00:31:31,259
better successor of the OR node, so the mark
has shifted here, right? Then, I expand this,
362
00:31:33,120 --> 00:31:33,179
and
363
00:31:33,179 --> 00:31:40,179
let us say I get the let say that this is
an AND node and I have this with a cost of
364
00:31:43,249 --> 00:31:43,669
3, and
365
00:31:43,669 --> 00:31:50,299
this has a cost of 4, and they are solved
node- terminal nodes. Now, what is going to
366
00:31:50,299 --> 00:31:52,190
happen?
367
00:31:52,190 --> 00:31:59,190
This is going to get updated to 7. This is
going to get updated to 8, but this is still
368
00:32:06,159 --> 00:32:06,340
the
369
00:32:06,340 --> 00:32:12,669
best successor; this is still the best successor,
because we are comparing between 7 plus 1
370
00:32:12,669 --> 00:32:19,669
and 14 plus 2, so between 16 and 8, so, we
will select this one, still.
371
00:32:22,480 --> 00:32:29,480
This is going to get updated to 8, and this
is going to get updated to 18, right? And
372
00:32:35,169 --> 00:32:35,419
now, we
373
00:32:35,419 --> 00:32:42,419
use- we are in a point where all the leaf
nodes of the marked tree are solved. The best
374
00:32:47,519 --> 00:32:47,779
way to
375
00:32:47,779 --> 00:32:54,529
solve this problem, is by following the marked
tree, and solving those problem. What we are
376
00:32:54,529 --> 00:32:59,039
going to do is, we are going to solve this
problem- we are going to solve this problem,
377
00:32:59,039 --> 00:32:59,100
then
378
00:32:59,100 --> 00:33:04,330
we are going to solve this, then we are going
to solve this, then we will solve this, that
379
00:33:04,330 --> 00:33:10,809
will solve this, and then we will solve this
one, and the best cost of solving this, is
380
00:33:10,809 --> 00:33:10,970
going
381
00:33:10,970 --> 00:33:17,970
to be 18. Is it clear? Is that alright? Yes.
Coming back to here, you are saying that we
382
00:33:30,980 --> 00:33:31,139
have
383
00:33:31,139 --> 00:33:38,139
not yet solved this one. Our heuristic are
underestimates, right?
384
00:33:39,389 --> 00:33:45,820
This one is going to cost at least 16, if
not more. If you go further down, your cost
385
00:33:45,820 --> 00:33:46,269
can only
386
00:33:46,269 --> 00:33:50,789
increase, because the heuristic cost are underestimates,
whereas on this side, we have
387
00:33:50,789 --> 00:33:57,789
actually got a solution of cost 8, right?
A complete solution of cost 8for this one,
388
00:33:58,289 --> 00:33:58,480
and in
389
00:33:58,480 --> 00:34:05,409
this side it says it is at least 16. Between
at least 16, and exactly 8, we know that exactly
390
00:34:05,409 --> 00:34:10,220
8 is always going to be better, right? So,
we do not actually go to solve these things
391
00:34:10,220 --> 00:34:10,560
any
392
00:34:10,560 --> 00:34:17,560
further. The full and/or graph is not going
to be explicitly generated; this is progressively
393
00:34:18,409 --> 00:34:25,169
expanding its best first, only up to the point
where we have got the minimum cost solution,
394
00:34:25,169 --> 00:34:32,169
right? Now, if you think that we could have
solved A* also in the same way, we could have
395
00:34:39,310 --> 00:34:45,060
taken the initial problem, except that in
A*, we do not have and nodes; we only have
396
00:34:45,060 --> 00:34:47,330
or nodes.
397
00:34:47,330 --> 00:34:54,330
To solve a start problem, there are several
different choices in a star- the set of successors
398
00:34:56,200 --> 00:35:01,360
and then take the successors of those successors,
and in this way, you could expand it out
399
00:35:01,360 --> 00:35:08,360
into an or graph, right? A graph which has
only or nodes, right, and we could use the
400
00:35:09,260 --> 00:35:09,540
same
401
00:35:09,540 --> 00:35:16,540
marking strategy- always maintain the best
cost successor at every or node, right? Now,
402
00:35:20,490 --> 00:35:20,630
if we
403
00:35:20,630 --> 00:35:27,630
did that, then we will still arrive at the
same solution as A* does. At every point of
404
00:35:28,430 --> 00:35:29,090
time,
405
00:35:29,090 --> 00:35:36,090
the node that you are selecting for expansion
will be the node that is along the best cost
406
00:35:36,150 --> 00:35:43,150
path from the start state, that is, the minimum
cost node that we are always expanding. That
407
00:35:44,840 --> 00:35:50,960
will be the only node which is along the marked
path, because we do not have and nodes, there
408
00:35:50,960 --> 00:35:57,960
will be only one marked path from the start
state. So, try to think of a star in the context
409
00:36:00,880 --> 00:36:02,800
of and/or graph search.
410
00:36:02,800 --> 00:36:09,800
It actually is doing the same thing as well,
but there we were maintaining open as a separate
411
00:36:13,300 --> 00:36:20,300
list, but if you think of open and close together,
it is nothing but this tree. Let us look at
412
00:36:23,810 --> 00:36:30,810
the algorithm that we just now worked out.
Initially, we will define a thing called g*.
413
00:36:37,030 --> 00:36:38,020
g*
414
00:36:38,020 --> 00:36:45,020
here, is the marked sub-tree, rooted at the
start state. At every point of time, it will
415
00:36:47,790 --> 00:36:54,790
denote the sub-graph, which is which has so
far being generated out and rooted at the
416
00:36:55,630 --> 00:36:55,750
state
417
00:36:55,750 --> 00:37:02,750
space. Initially, the estimate of the cost
at the start state is equal to hs, because
418
00:37:03,140 --> 00:37:03,820
we do
419
00:37:03,820 --> 00:37:10,820
not have any other cost at that point of time.
Now, if we find that the start state itself
420
00:37:14,850 --> 00:37:14,970
is
421
00:37:14,970 --> 00:37:21,030
a state belonging to t; t is the set of terminal
states- terminal states represents those
422
00:37:21,030 --> 00:37:26,560
sub-problems which are unit level sub-problems,
which we do not further decompose, but solve
423
00:37:26,560 --> 00:37:33,560
directly. So, t is the set of sub-problems,
which are directly solvable.
424
00:37:34,760 --> 00:37:41,420
If we find that s belongs to t, then we will
label s as solved; whichever is a terminal
425
00:37:41,420 --> 00:37:41,670
node
426
00:37:41,670 --> 00:37:48,670
can be labeled as solved. Then, if a if at
any point of time, the start state is labeled
427
00:37:49,420 --> 00:37:50,120
as
428
00:37:50,120 --> 00:37:57,120
solved, then we terminate. Let, now, when
we are in or node, right, and the best cost
429
00:38:01,170 --> 00:38:06,160
successor is marked solved; then we labeled
the or node as solved. In a and node, when
430
00:38:06,160 --> 00:38:06,860
all its
431
00:38:06,860 --> 00:38:13,550
successors are labeled solved, then we label
it as solved; so we are coming to that. The
432
00:38:13,550 --> 00:38:13,880
third
433
00:38:13,880 --> 00:38:19,590
step is the select step- so, what we do is,
we select a non-terminal leaf node from the
434
00:38:19,590 --> 00:38:19,770
marked
435
00:38:19,770 --> 00:38:26,770
sub-tree, as we were doing previously. At
every point of time, we just look at marked
436
00:38:27,320 --> 00:38:27,890
sub-tree
437
00:38:27,890 --> 00:38:34,890
and select the non-terminal leaf node, then
expand that node to generate the successors
438
00:38:37,740 --> 00:38:37,970
of
439
00:38:37,970 --> 00:38:41,420
this state n.
440
00:38:41,420 --> 00:38:48,420
For each new successor, we set fm equal to
hm; for each new successor mind you, we set
441
00:38:49,460 --> 00:38:49,980
fm
442
00:38:49,980 --> 00:38:56,910
equal to hm. If m is terminal-if any of the
successors is a terminal node- then we label
443
00:38:56,910 --> 00:38:57,170
it as
444
00:38:57,170 --> 00:39:04,170
solved. And then, after we have done this,
we will call cost revise, which is the bottom
445
00:39:05,270 --> 00:39:05,480
of
446
00:39:05,480 --> 00:39:12,480
cost revision step, and finally, we will return
to step 2, right? Now, let us recall the
447
00:39:19,530 --> 00:39:25,410
example that we had done just now, where,
well, it is all cluttered up here.
448
00:39:25,410 --> 00:39:31,920
But if you remember, that we had initially
started with the and node, generated it successors,
449
00:39:31,920 --> 00:39:38,920
right? Expanded the node, generate it successors,
then marked for an n node. We marked both
450
00:39:39,100 --> 00:39:39,350
of
451
00:39:39,350 --> 00:39:46,350
its successors, right? And then, for an or
node, we mark only the best cost successor,
452
00:39:46,870 --> 00:39:47,420
and we
453
00:39:47,420 --> 00:39:53,800
label a node as solved only when the best
cost successor is labeled solved. When this
454
00:39:53,800 --> 00:39:53,840
is
455
00:39:53,840 --> 00:40:00,840
solved, and at this node, we find that the
best successor is this- and the best successor
456
00:40:01,660 --> 00:40:02,130
is
457
00:40:02,130 --> 00:40:09,130
solved, so we can label this as solved. Then,
we expanded this node, and initially, first
458
00:40:10,320 --> 00:40:16,530
time, we went this way- when we backed up
this cost; when this was the best cost successor,
459
00:40:16,530 --> 00:40:17,080
it
460
00:40:17,080 --> 00:40:22,720
was not solved, that is why we never labeled
as solved, at that point of time.
461
00:40:22,720 --> 00:40:29,720
But when we went this way, and found that
this was solved, this was solved and then
462
00:40:32,750 --> 00:40:33,650
because
463
00:40:33,650 --> 00:40:38,350
this is an and node, both of its successors
are solved, so, we labeled this as solved.
464
00:40:38,350 --> 00:40:39,660
Then,
465
00:40:39,660 --> 00:40:46,660
when we went back to this or node and found
that the best successor is solved, that is
466
00:40:47,840 --> 00:40:49,080
when we
467
00:40:49,080 --> 00:40:56,080
label this as solved, right? When the best
successor is labeled solved, we label it as
468
00:40:59,440 --> 00:41:00,000
solved.
469
00:41:00,000 --> 00:41:06,470
Why? Yes, because the other along the other
directions, we will only have more costs,
470
00:41:06,470 --> 00:41:06,650
because
471
00:41:06,650 --> 00:41:11,500
they are all underestimates. And if this is
the better, then those underestimates, and
472
00:41:11,500 --> 00:41:11,590
this is
473
00:41:11,590 --> 00:41:16,000
the best that we can get, so we label it as
solved. And then, when this AND node has both
474
00:41:16,000 --> 00:41:16,260
of
475
00:41:16,260 --> 00:41:19,520
its successor were solved, then we label this
as solved.
476
00:41:19,520 --> 00:41:26,520
And, if you look at the algorithm, whenever
s is solved, that is when we terminate. Let
477
00:41:31,740 --> 00:41:31,880
us
478
00:41:31,880 --> 00:41:38,420
look at in details at this step, what do we
do in cost revise? what do we do in cost revise.
479
00:41:38,420 --> 00:41:45,180
That is where we will compute the costs of
the parents from the successors, and in and
480
00:41:45,180 --> 00:41:45,360
node,
481
00:41:45,360 --> 00:41:50,780
we will decide to shift the marking if necessary.
482
00:41:50,780 --> 00:41:56,930
What we are going to do is, we are going to
start with the node from where we want to
483
00:41:56,930 --> 00:41:57,530
do the
484
00:41:57,530 --> 00:42:04,530
cost revision. Let us say that in this, when
we came up here and updated this cost, right,
485
00:42:06,110 --> 00:42:13,110
then, from here, we will do the cost revision
backward. Initially, which- the node that
486
00:42:13,510 --> 00:42:14,790
we
487
00:42:14,790 --> 00:42:20,370
generate at the bottom, is the one from where
we will start the cost revision. So, we found
488
00:42:20,370 --> 00:42:27,000
out these 3, plus one- 4, and 10 plus zero-
10, so 14. So, we start cost revision from
489
00:42:27,000 --> 00:42:29,060
here,
490
00:42:29,060 --> 00:42:36,060
right? Now, what we do here is, we create
z equal to n, so we start with z equal to
491
00:42:41,650 --> 00:42:42,480
this state
492
00:42:42,480 --> 00:42:49,480
n, right? Then, coming to the slides, slides
slides- when z is empty, that is, where we
493
00:42:58,060 --> 00:42:58,680
have
494
00:42:58,680 --> 00:43:05,600
done. Otherwise, select a node m from z, such
that m has no descendants in z, right? Why
495
00:43:05,600 --> 00:43:06,550
do we
496
00:43:06,550 --> 00:43:12,020
do that? Because we want to go bottom up;
we want to go bottom up, so we will always
497
00:43:12,020 --> 00:43:12,560
select
498
00:43:12,560 --> 00:43:18,090
first, the state which has no descendants
in z.
499
00:43:18,090 --> 00:43:25,090
Then, if m is a and node with successors r1
to rk, then we set fm to the sum of the child
500
00:43:34,460 --> 00:43:41,460
nodes, plus the cost on the edges, right?
So, this is fri plus cmri, which is the cost
501
00:43:43,360 --> 00:43:44,900
of the
502
00:43:44,900 --> 00:43:51,900
successor ri plus the cost of the transition
from m to ri, cost of the edge from m to ri.
503
00:43:52,480 --> 00:43:58,150
Then, we submit over all the edges, that that
is because this is AND node, so we have to
504
00:43:58,150 --> 00:44:04,240
submit over all the edges, and then mark the
edge to each successor of m. Because it is
505
00:44:04,240 --> 00:44:04,430
an and
506
00:44:04,430 --> 00:44:11,410
node, we mark the edge to every successor.
And if each successor is labeled solved, then
507
00:44:11,410 --> 00:44:15,560
m as solved, right? Okay.
508
00:44:15,560 --> 00:44:22,250
After this, what we need to do is, we have
to check whether, after this exercise, the
509
00:44:22,250 --> 00:44:23,230
cost of
510
00:44:23,230 --> 00:44:29,690
m has changed. If cost of m has changed, we
will put it back into z- we will put it into
511
00:44:29,690 --> 00:44:30,280
z, so
512
00:44:30,280 --> 00:44:36,500
that in the next iteration or subsequent iterations,
we also examine whether the parent of m
513
00:44:36,500 --> 00:44:43,500
is also going to change, right? What happens
if m is a OR node?
514
00:44:46,040 --> 00:44:53,040
If m is a OR node with successors r1 to rk,
then similarly, we compute the cost of solving
515
00:44:55,070 --> 00:45:01,800
every child as fri plus cmri, but because
this is a or node, we will find out the minimum
516
00:45:01,800 --> 00:45:08,600
among this. We will find out the minimum among
this, and that is going to be the new cost
517
00:45:08,600 --> 00:45:08,720
of
518
00:45:08,720 --> 00:45:15,050
m. So, cost of the or node is the minimum
of the cost of solving its successors. And
519
00:45:15,050 --> 00:45:15,300
then, we
520
00:45:15,300 --> 00:45:21,380
mark the edge to the best successor of m,
and if the marked successor is label solved,
521
00:45:21,380 --> 00:45:21,900
then we
522
00:45:21,900 --> 00:45:27,480
label the or node as solved, okay?
523
00:45:27,480 --> 00:45:34,480
And then, finally, if the cost of m has changed-
regardless of whether m was a or node or and
524
00:45:34,900 --> 00:45:41,900
node, if the cost or label of m has changed-
then, insert the parents of m into z for which
525
00:45:44,330 --> 00:45:44,540
m
526
00:45:44,540 --> 00:45:51,540
is a marked successor. Now, you might find
something interesting here. We are talking
527
00:45:53,340 --> 00:46:00,340
insert those parents of m into z. Now, when
we are talking about and/or trees, as we have
528
00:46:00,380 --> 00:46:00,580
done
529
00:46:00,580 --> 00:46:07,580
here so far, there can be only one parent,
right? But, in case you have a graph- and/or
530
00:46:10,020 --> 00:46:10,510
graph-
531
00:46:10,510 --> 00:46:15,750
then, you can have more than one___ . At this
point of time, we are not talking about graph,
532
00:46:15,750 --> 00:46:20,400
right? If you are further interested in this
area, you can read up what happens in the
533
00:46:20,400 --> 00:46:20,700
case of
534
00:46:20,700 --> 00:46:25,240
and/or graphs, okay?
535
00:46:25,240 --> 00:46:30,990
In any case, any graph can be unfolded into
a tree, so if you do not want to remember
536
00:46:30,990 --> 00:46:31,220
whether
537
00:46:31,220 --> 00:46:38,220
you are visiting the same node from 2 different
paths, you can keep that as a and/or tree,
538
00:46:40,980 --> 00:46:41,010
is
539
00:46:41,010 --> 00:46:48,010
that alright? Okay. So, the question is, why
do not we just climb up the tree and update
540
00:46:54,200 --> 00:46:54,290
all
541
00:46:54,290 --> 00:47:01,290
of them along that path, right? Now, that
is essentially what we are doing; also what
542
00:47:06,820 --> 00:47:06,950
we are
543
00:47:06,950 --> 00:47:13,390
doing is, in the case of a tree- because there
is only one parent- we can just what will
544
00:47:13,390 --> 00:47:18,020
happen is, it is you will have always z will
n will have a single parent.
545
00:47:18,020 --> 00:47:25,020
So, if the cost of n changes, then the cost-
the parent of z will be put in z, and then
546
00:47:25,260 --> 00:47:25,430
in the
547
00:47:25,430 --> 00:47:30,430
next iteration, the parent will be picked
up, right? And if the parent of that parent
548
00:47:30,430 --> 00:47:30,690
gets
549
00:47:30,690 --> 00:47:35,260
changed, then that is one which is going to
get inserted. So, if it is the same thing
550
00:47:35,260 --> 00:47:36,220
that is
551
00:47:36,220 --> 00:47:43,220
happening; but in the case of a graph, suppose
you have the state n, and this state n could
552
00:47:44,520 --> 00:47:51,100
have been the or successor of some node, and
could have been the and successor of some
553
00:47:51,100 --> 00:47:51,390
node,
554
00:47:51,390 --> 00:47:55,140
right? Or could have been the or successors
of 2 nodes also.
555
00:47:55,140 --> 00:48:02,140
So, in that case, you see, when the cost of
n changes, the cost of this node can also
556
00:48:02,760 --> 00:48:02,970
change,
557
00:48:02,970 --> 00:48:09,970
the cost of this node can also change, right?
Okay. So, as a result, we will put this also
558
00:48:13,100 --> 00:48:20,100
into z; we will put this into z, and we will
also put this into z, right, so that both
559
00:48:21,200 --> 00:48:22,530
of them
560
00:48:22,530 --> 00:48:29,340
are again updated, with respect to their respective
parents, right? So, because this algorithm
561
00:48:29,340 --> 00:48:34,530
that I have talked about, is for and/or graphs
in general, those are examples that I have
562
00:48:34,530 --> 00:48:40,580
given this for and/or trees. But this algorithm
itself is applicable to and/or graphs as well.
563
00:48:40,580 --> 00:48:47,580
So, therefore, the cost revision steps that
we have mentioned here, are actually made
564
00:48:48,400 --> 00:48:48,670
for
565
00:48:48,670 --> 00:48:55,670
graphs. Yes. Yes. No no no, it can be, see-
look at this examples in this or node. The
566
00:49:07,550 --> 00:49:07,690
best
567
00:49:07,690 --> 00:49:12,650
way to solve this or node could be this, and
in this and node, both of these are marked.
568
00:49:12,650 --> 00:49:13,160
So,
569
00:49:13,160 --> 00:49:20,140
it is also the marked successor of this, and
as well marked successor of this. No, see,
570
00:49:20,140 --> 00:49:22,350
if it
571
00:49:22,350 --> 00:49:28,310
is not marked, suppose this or node is actually
pointing in this direction. So, it is not-
572
00:49:28,310 --> 00:49:28,500
it
573
00:49:28,500 --> 00:49:35,500
is not selecting this. So, this option for
this or node- this option is still better,
574
00:49:35,690 --> 00:49:36,280
right?
575
00:49:36,280 --> 00:49:40,690
Therefore, this cost is going to come up from
this side; it is not going to come up from
576
00:49:40,690 --> 00:49:40,840
this
577
00:49:40,840 --> 00:49:42,280
side, right?
578
00:49:42,280 --> 00:49:49,280
So, if there is if the the the parent node
is still marked the other way, then you need
579
00:49:49,380 --> 00:49:51,850
not do
580
00:49:51,850 --> 00:49:58,850
cost revision beyond that point, right? If
this fellow's cost changes, and this the mark
581
00:49:59,030 --> 00:50:05,600
shifts from here to here, then we need to
put this back into z, so that this fellow's
582
00:50:05,600 --> 00:50:06,460
parent
583
00:50:06,460 --> 00:50:13,460
also gets a chance to see, whether, now, this
becomes the better path, understood? Is that
584
00:50:16,270 --> 00:50:23,270
clear? Any other any questions regarding this
algorithm? No, right? What I would suggest
585
00:50:29,060 --> 00:50:29,560
is,
586
00:50:29,560 --> 00:50:36,560
you take a few more examples by AND by gr
graph and/or graph, right, and try to see
587
00:50:37,080 --> 00:50:37,600
how best
588
00:50:37,600 --> 00:50:44,600
to how you can apply this algorithm by and,
to solve it. Yes. If a node is marked as solved,
589
00:50:51,020 --> 00:50:58,020
it means that you have already found out the
best way to solve that sub-problem. So, for
590
00:50:59,280 --> 00:51:06,280
example, if an and node recursively- if an
and node- all of you are successor solved,
591
00:51:09,240 --> 00:51:09,420
then you
592
00:51:09,420 --> 00:51:15,570
have solved that and node, because you know
exactly how to solve everything from below
593
00:51:15,570 --> 00:51:15,780
that
594
00:51:15,780 --> 00:51:16,830
and node.
595
00:51:16,830 --> 00:51:23,530
In an or node, if the currently selected successor
is labeled as solved, then you know that
596
00:51:23,530 --> 00:51:27,940
you need not worry about the other successor,
because those other successor are going to
597
00:51:27,940 --> 00:51:28,230
cost
598
00:51:28,230 --> 00:51:35,230
you more. So, the marked successor- if that
is labeled as solved, then you know that if
599
00:51:36,470 --> 00:51:36,550
I
600
00:51:36,550 --> 00:51:42,230
follow along this mark, then I have already
solved everything below that. So, I can label
601
00:51:42,230 --> 00:51:43,150
that
602
00:51:43,150 --> 00:51:50,150
node as solved. What are the initial set of
solved nodes? The terminal nodes. The basic
603
00:51:51,840 --> 00:51:52,260
sub-
604
00:51:52,260 --> 00:51:59,260
problems, which cannot be further decomposed,
are the initial set of solved node. There
605
00:51:59,580 --> 00:51:59,890
is a
606
00:51:59,890 --> 00:52:03,620
fixed cost associated with each of those terminal
nodes.
607
00:52:03,620 --> 00:52:10,230
So, that is the cost that you have to incur,
that unit sub-problem which cannot be further
608
00:52:10,230 --> 00:52:17,230
decomposed, okay? So, a class- so, how does
AO star fare? So, the this algorithm that
609
00:52:34,130 --> 00:52:34,490
we had
610
00:52:34,490 --> 00:52:41,140
so far, is called AO star; it is a and/or
graph search algorithm, so we call it AO star
611
00:52:41,140 --> 00:52:41,800
and/or
612
00:52:41,800 --> 00:52:46,840
star. How does it fare when the graph has
only OR nodes? Well, it fares exactly like
613
00:52:46,840 --> 00:52:49,200
we having
614
00:52:49,200 --> 00:52:53,340
a*, right?
615
00:52:53,340 --> 00:53:00,340
So, the next topic that we will look at is
searching of game tree. I will not start this
616
00:53:01,040 --> 00:53:01,390
topic
617
00:53:01,390 --> 00:53:05,790
today, because we are nearly towards the end
of this lecture. We are not starting this
618
00:53:05,790 --> 00:53:07,190
topic;
619
00:53:07,190 --> 00:53:12,450
what we are going to see in game tree is,
we will have 2 types of nodes- just like we
620
00:53:12,450 --> 00:53:12,690
have and
621
00:53:12,690 --> 00:53:19,690
nodes and or nodes, we will have max nodes,
min nodes. And we will see how we can model
622
00:53:19,760 --> 00:53:20,210
a game
623
00:53:20,210 --> 00:53:27,210
playing problem, as a problem of solving game
trees, with max nodes and min nodes, right?
624
00:53:27,830 --> 00:53:34,100
So, the next lecture- we will talk about game
trees and how we solve game trees, right?
625
00:53:34,100 --> 00:53:34,900
And, I
626
00:53:34,900 --> 00:53:41,900
also intend to wrap up a little of the previous
things that we left on search, so that from
627
00:53:44,400 --> 00:53:51,400
the next to next lecture, we can get started
with knowledge and deduction, okay? Thank
628
00:53:51,700 --> 00:53:53,070
you.
629
00:53:53,070 --> 00:54:00,070
In today's class, we will start on game trees,
and we will see how we can model different
630
00:54:05,240 --> 00:54:05,680
game
631
00:54:05,680 --> 00:54:12,490
playing situations in terms of game trees.
We will study some very classical algorithms
632
00:54:12,490 --> 00:54:12,620
for
633
00:54:12,620 --> 00:54:19,620
searching in game trees, and finding out when
we are in a better position, and when we are
634
00:54:34,330 --> 00:54:34,540
in
635
00:54:34,540 --> 00:54:35,340
a worst position.
636
00:54:35,340 --> 00:54:40,090
So, in this, on searching game trees, what
essentially game trees are?
637
00:54:40,090 --> 00:54:41,030
They are OR trees, namely. We have already
studied what AND/OR graphs are, and AND/OR
638
00:54:41,030 --> 00:54:41,040
trees
639
00:54:41,040 --> 00:54:44,100
are. Game trees are a special type of OR tree,
but there are 2 types of OR nodes. By OR tree,
640
00:54:44,100 --> 00:54:49,990
we mean that at a time, we will be selecting
only one of the successors of the OR node,
641
00:54:49,990 --> 00:54:50,050
but
642
00:54:50,050 --> 00:54:57,050
which one will be selected will depend on
whether it is a min node or a max node. I
643
00:55:03,060 --> 00:55:03,460
will
644
00:55:03,460 --> 00:55:06,830
shortly explain why we need this kind of a
representation. And briefly in min nodes,
645
00:55:06,830 --> 00:55:06,880
we will
646
00:55:06,880 --> 00:55:11,060
select the minimum cost successor, and in
max nodes, we will select the maximum cost
647
00:55:11,060 --> 00:55:18,060
successor. Terminal nodes can be winning or
losing states, but it is often infeasible
648
00:55:19,610 --> 00:55:19,970
to
649
00:55:19,970 --> 00:55:25,470
search up to the terminal nodes. So, we will
use heuristic costs to compare non-terminal
650
00:55:25,470 --> 00:55:32,470
nodes. So, let me start by showing a simple
formulation of a game tree search problem.
651
00:55:33,920 --> 00:55:35,700
Let us
652
00:55:35,700 --> 00:55:38,450
say we take that example of tic-tac-toe.
653
00:55:38,450 --> 00:55:45,450
In tic-tac-toe, what we have is something
like this, right? And the players alternate
654
00:55:52,860 --> 00:55:53,080
in
655
00:55:53,080 --> 00:56:00,080
putting either a circle or a cross, in any
of these positions. Let us say, that we start
656
00:56:03,380 --> 00:56:04,160
with
657
00:56:04,160 --> 00:56:11,160
a configuration, where we put x here, right?
Then, from here, so this is where the one
658
00:56:17,760 --> 00:56:17,900
of,
659
00:56:17,900 --> 00:56:24,120
this is the starting configuration. Let us
say now, it is the move of player b; so, when
660
00:56:24,120 --> 00:56:24,260
it is
661
00:56:24,260 --> 00:56:29,740
the move of player b, then there are various
different moves that player b can take. Say,
662
00:56:29,740 --> 00:56:29,980
out
663
00:56:29,980 --> 00:56:36,980
out of which, this is one, or this is one,
and so on. Then, for each of these cases,
664
00:56:48,610 --> 00:56:50,330
player a
665
00:56:50,330 --> 00:56:57,330
has a move. Here, let us say player b has
a move. From this point, in each of these
666
00:56:58,790 --> 00:56:59,230
states,
667
00:56:59,230 --> 00:57:01,410
player a has a move.
668
00:57:01,410 --> 00:57:07,490
Suppose player a makes a move here, then player
a can, again, take one of many different
669
00:57:07,490 --> 00:57:14,490
moves. Suppose, if this is the step, and player
b can give something like this, or player
670
00:57:15,210 --> 00:57:16,060
b
671
00:57:16,060 --> 00:57:23,060
can give something like this, and so on, right?
Then, you know that suppose this is the move,
672
00:57:28,740 --> 00:57:33,220
that player b has given, then, again, player
a will have turns, but if you look further
673
00:57:33,220 --> 00:57:33,370
below
674
00:57:33,370 --> 00:57:38,810
this, then you will see that all- there is
a way of playing, by which this fellow always
675
00:57:38,810 --> 00:57:39,410
wins.
676
00:57:39,410 --> 00:57:46,410
Because, if now, the only possible option
of this player is to put a dot here, and if
677
00:57:49,500 --> 00:57:49,630
that
678
00:57:49,630 --> 00:57:55,570
happens, then the other player can put a cross
here, and then there is no way of saving the
679
00:57:55,570 --> 00:57:56,030
game, right?
680
00:57:56,030 --> 00:58:03,030
If you look below this sub-tree, then you
will see that that for every move that this
681
00:58:03,910 --> 00:58:03,970
player
682
00:58:03,970 --> 00:58:10,970
makes, the other player has a winning strategy,
right? Now, so, this is the structure of the
683
00:58:13,270 --> 00:58:20,270
game tree. The game tree is a tree where every
node of the tree, represents a state of the
684
00:58:22,090 --> 00:58:29,090
game, and nodes can be either max node or
a min node. I have not yet defined what I
685
00:58:31,900 --> 00:58:32,230
mean by a
686
00:58:32,230 --> 00:58:39,230
max node or a min node, but let us say that
one of these type of nodes is for player a,
687
00:58:40,980 --> 00:58:41,010
and
688
00:58:41,010 --> 00:58:48,010
the other is for player b. So, depending on
who has the move, we will distinguish between
689
00:58:48,160 --> 00:58:48,660
2
690
00:58:48,660 --> 00:58:50,670
types of nodes, right?