2.5. AIPLAN - Good Heuristics - YouTube

Channel: unknown

[4]
Before we move on to the planning algorithms, I want to tell you a little
[8]
bit more about heuristics and specifically, what makes a good heuristic
[12]
and how do we find these. We have defined a heuristic in a
[17]
technical sense, as a function that estimates the distance to the nearest
[22]
goal node. But a heuristic obviously has colloquial
[25]
meaning as well and that's what's defined here.
[28]
So it's, it's heuristics are criteria, methods, or principles for deciding which
[33]
among several alternative courses of action promises to be the most effective.
[38]
So the alternatives that we're looking at are of course the successor nodes that we
[43]
want to evaluate. We want to see which one of those is the
[47]
most promising. And what we need to do is we need to
[50]
decide which one to follow first. Of course we keep in mind the others and
[55]
follow those later. We use heuristics in everyday life.
[58]
For example, here you see a heuristic for deciding whether a pineapple is ripe.
[62]
If you ever go into a shop and want to buy a ripe pineapple, this may work for
[66]
you, or it may not. So, if you can rip out the inner leaves
[69]
easily and the fruit smells like a pineapple should smell, then you're
[73]
looking at a ripe pineapple and this is one you can buy, assuming the price is
[77]
right. If there are no pineapples where you are,
[80]
tough luck. The reason why I've circled the word,
[83]
deciding, here, is because this gives us a different idea of what heuristic can
[88]
be. All we need from a heuristic is just a
[90]
decision. Which alternative looks best.
[93]
So it doesn't really need to be related to the distance, to the goal, at all.
[98]
All we need is a function that decides which one is the best node.
[102]
If we have that function, that would constitute a perfect heuristic because it
[107]
would tell us which successor to follow. And which path we should explore first.
[112]
If that deciding. Is correct.
[114]
Then we have a perfect heuristic. Another example of a heuristic you've
[120]
applied probably not too long ago, is in choosing this course.
[124]
You looked at the introductory material to this course.
[127]
And used this as information to decide which of the courses that were available
[132]
you want to take. So you used heuristic information about
[135]
the course to make this choice. Okay, assuming you understand what a
[141]
heuristic is, now the question is when is a heuristic a good heuristic?
[145]
And if we have a given search problem and a given heuristic we can evaluate that
[150]
heuristic by looking at the number of states that are generated for a specific
[155]
problem with that heuristic. And if we have two heuristics, we could
[160]
compare them by using the number of states they generate to see which is
[164]
better. The better heuristic would generate fewer
[167]
states. But that is only heuristic for deciding
[171]
which heuristic is better. because what we are really after is, we
[175]
want solutions as fast as possible, so we have time constraints to respect.
[180]
And computing a good heuristic also takes time.
[184]
Unfortunately, this means we are dealing with a trade-off here.
[188]
And this is the trade-off. Some heuristics are simple.
[191]
So they provide a simple way of discriminating between the successes we
[196]
generate. And since we opt-, want to optimize the
[199]
time we take to research. Simplicity here means easy to compute.
[203]
We want to have a fast way to compute the heuristic value for a given state.
[208]
But heuristics that are simple to compute are often not accurate.
[212]
And accurate is the other property in our trade-off here.
[215]
A heuristic, unless it is perfect, does not provide a guarantee that it tells us
[220]
which the best successor is to explore next.
[222]
So, there's no guarantee that it identifies the best course of action.
[226]
But if it's a good heuristic, it will do this more often than a heuristic that is
[231]
not as good. So, a good heuristic does this
[234]
sufficiently often. It's accurate.
[236]
It tells us which is the best course of action, or in the technical sense, it
[241]
tells us how far the goal state really is.
[246]
So now we know what a good heuristic is the important question than is how can we
[251]
find good heuristics for a given problem? And this is somewhat similar to the
[256]
problem of problem formulation it's a matter level problem.
[260]
We have to find good heuristic to do good search.
[263]
Just as a good problem formulation will ease search.
[266]
That means this is a very important question.
[269]
And the answer is, there are methods for doing this and we will look at some
[273]
general methods next. But then there is a different question
[277]
that is just as important. If we have a method, can we automate this
[281]
method? And the answer again is yes, but that's a
[284]
very complex process and we will get to that later in this course.
[288]
In fact, automatically finding good euristics has probably been one of the
[294]
most hot topics in the AI planning research over the last ten, fifteen
[299]
years. So here's a general method for finding
[303]
good heuristic. The idea is based on a simplified problem
[307]
or a relaxed problem. Usually a problem is defined in terms of
[312]
states, and actions that are applicable in states, and achieves certain things
[317]
in, successor states. So what we have is restrictions on these
[321]
actions when they are applicable, when we can use them, and which states they are
[327]
useful. What we can do is relax those
[330]
restrictions. So we can look at the restrictions
[333]
defined in the original problem, and drop some of them or make them less hard.
[339]
And that gives us a new problem, which is the relax problem.
[343]
And then the following should be fairly obvious to see.
[347]
Namely that the cost of an optimal solution for a relaxed problem is an
[352]
admissible heuristic for the original problem.
[355]
In fact it's admissible and consistent, but since we haven't defined consistent
[360]
yet, I won't go into that. So you just, you should see why it is
[364]
admissible. It's very simple to see because the
[367]
optimal solution for our original problem is of course also a solution for our
[373]
relaxed problem. We've only relaxed the restrictions on
[377]
the actions. So, an optimal solution for the relaxed
[380]
problem can have, at most, as many steps as the optimal solution for our original
[385]
problem, because that is a solution for the relaxed problem.
[389]
In general, what we have is that in our relaxed problem, we allow shortcuts to be
[395]
taken with these relaxed actions that are not possible in our original problem, so
[400]
if we take out these shortcuts, we end up with longer solutions.
[406]
And since this method is quite abstract I want to illustrate this with an example
[411]
and we will use the 8 puzzle that we've seen before and the actions that are
[415]
defined for this 8 puzzle. So here is the original condition that we
[420]
had for the applicability of actions. Namely a tile can move from square a to
[425]
square b if a is horizontally or vertically adjacent to b and b is blank.
[431]
So the condition we have here is a conjunction of two sub-conditions and
[436]
that should tell us how we can build a relaxed condition quite easily.
[442]
Namely by dropping one of the two parts or both of them.
[446]
And this is how this works. If we drop the second part.
[450]
Then B is blank. We end up with this heuristic here.
[453]
And that tells us that a tile can move from square A to B if.
[458]
A is adjacent to B. I've dropped the horizontally or
[461]
vertically. And what we get there, of course then, is
[464]
the Manhatten block distance heuristic. Because we now allow a tile to be moved,
[469]
no matter where it is moving to, which gives us exactly the block distance for
[474]
this tile. And if we add all those up, that's the
[477]
Manhatten block distance we've seen. The second one is, if we drop the first
[481]
part of this definition, so that the adjacency distance is dropped, then we
[486]
end up with a heuristic. That's a tile can move from A to B, if B
[490]
is blank. And finally we can have a heuristic if we
[493]
drop both conditions that says a tile can move from a to b and there are no
[497]
conditions. And of course this then gives us the
[500]
misplaced tiles heuristic. We simply count those tiles that can move
[504]
to where they need to be in one step because there's no conditions on how they
[508]
can move. So what you see here is we've derived two
[512]
of the heuristics that we've already used for the 8 puzzle using the method we've
[518]
just introduced by using relaxed conditions of the actions that are
[523]
applicable in our problem. So this concludes this section of the
[529]
course on AI search technology and the A* algorithm.
[533]
You should understand now that a heuristic function encodes
[538]
problem-specific knowledge in a problem-independent way by mapping a
[543]
state to a real number. This information about search states can
[547]
be used to make the search more efficient.
[550]
In general, this is done by using an evaluation function that tells us how
[556]
good a search node is. Greedy best first search simply uses the
[560]
heuristic function as the evaluation function but the better solution is
[565]
provided by the A* algorithm. The evaluation function used by A* is
[570]
simply the sum of the heuristic function for a node plus the cost of getting to
[575]
that node in the first place. We've also seen that A* is optimal.
[579]
It will always find an optimal solution. And it is optimally efficient.
[583]
It does not expand more nodes than absolutely necessary.
[587]
But I've also shown you that A* is not the answer to all questions, specifically
[592]
when it comes to graph surge. Finally, since good heuristics are so
[596]
important for A*, I've also talked a little bit about what good heuristics are
[601]
and how to find them. So now a big tick because you understand
[605]
all of that.