what is the first step when performing a search on a captured detainee? This is a topic that many people are looking for. granthamandira.org is a channel providing useful information about learning, life, digital marketing and online courses …. it will help you have an overview and solid multi-faceted knowledge . Today, granthamandira.org would like to introduce to you A* Search. Following along are instructions in the video below:
Algorithm. Im going to run for you is the a star search algorithm. This this is also going to return for me the optimal path.
But the theory is you should do a little less work or even a lot less work. Just the fact. Its going to use a heuristic to do an informant version of the search.
Lets have a look at how this works as you can see in the search space. Now each node in the search space has a number next to it and that number is an estimate a quick compute estimate of what the cost is between that state and one of the goal states. So the estimate is the between node b.
And one of the goals. Its going to cost six as you can see the actual cost which the shortest path between d. And the goal state is actually nine.
So this is an under estimate. And this turns out to be important in order for the a star search algorithm to return the shortest path. You must use a heuristic that never overestimate the cost.
So i very underestimate or get two entirely correct. So here. Ive got heuristic values that are never over estimating the cost and therefore.
What that means is that a star is going to return the optimal path for it lets see how this works it works in a similar way to uniform cost search. Except that we use the a star search score. Thats the cost of the path.
So far as we used in uniform cost search plus. We add on to that the heuristic of the end node of the path. So that gives you an estimate of the total cost of the path that youre looking at so.
Far. Lets see how this goes here. We look at this its not the goal state.
So were going to expand it well add it to the visited list and well also store its a star or so that we know its a star score. If we find a better one than that and we know that we need to visit it and this can happen in the a star search algorithm lets expand it so we can go to a to b and to d the cost of five nine and six. We have to take the heuristic measure into account as well the heuristic measure for a is seven.
So it the algorithm thinks its going to take seven units of cost to get from a to the goal state from b. The heuristic measure is three and from b. The heuristic measure is six.
So the a star score is the cost of the path. So far select for this one thats five plus. The cost of the heuristic measure.
So thats an estimate of how far its still to go to get to the goal state and that gives you an estimate of what the total cost of this path is going to be once its actually got down to a goal state. So its 12 here. 9.
Plus. 3. Is 12 for this path as well and 6 plus.
6. Is also 12 for this part so at the moment. The a star search is not distinguishing between these possibilities.
It thinks that each of these paths is going to cost 12 in the end. So lets just take them in alphabetical order. As we did before well look at this one first from a we can go to b or we can go to g1.
So lets put those up there b and g1. The heuristic measure for b is 3 and this heuristic measure for g 1 is 0. Because its a goal state and the heuristic measure can understand that g 1.
Is a goal state and therefore it doesnt cost any units in order to get to a goal state from there from a to b. Thats a cost of 3 from a to g 1. Is a car of nine.
So we now calculate the a star scores. So the total cost of the path along. There here is eight five plus three within add in the further three here and that gets us to 11.
So the total estimated cost of that path is 11. The eight plus another three and for this path. Its five plus nine.
Which is 14 plus. The zero and that takes us to 14. And we now mark a as visited and add it to the visited list with an a star score of 12 if later on in the search.
We find a path to a database source a star score of less than 12 then we will look at that however if we find later on in the algorithm a path to a with an a star score of more than 12. Then we can completely ignore. It and prune that part of the search okay so we now continue weve got four active paths in the tree and the one with the best a star score is this one here ending in node b.
So look at node b. From note b. We can go to a forecast of two or you can go to c for three now if we went to a for a cost of two then the total a star score of the path leading to a here would in fact be twenty thirteen plus seven.
So weve already visited it to 12. We dont need to add it back from the tree. But for the other node b to c.
We will add that to the tree so c has a heuristic cost before thats the estimate of how far it is to a goal state and its cost of one to get there so its now nine along that path. Plus. The four which makes it 13.
And that one has now been 50 so b. Now been visited and its a staff call for the visit was the 11. Weve now got four paths in the tree one for 13 1 for 14 and 2 for 12.
So were going to take one of these two well just take the first what b. Has already been visited for an a star score of 11 over here. So theres no point in visit ticket for they start got 12.
So thats a dead end now look at d from d. We can go back to f. We can go to c and to e the route back to f is not going to be this typical.
Weve already visited that for a star score of 5. However we can add in c. And we can add in e.
The cost is 2 in each case c. Has a heuristic value of 4 e. Has a heuristic value of 5.
Lets calculate the a star scores. So its 8 plus. 4.
Thats 12 along that path and along this path. Here. Its 6 plus 2.
8. Plus. 5.
Which brings us to 13. Along this path. We now add that to our visited list.
So d as the inquisitive released a score of 12 lets look at the remaining active path in the tree well weve got this one to 13 this one for 14 heres one for 12 and again c. And heres one for 13 ending in e. So its going to be this one that gets explored next one ending.
You need for an a star score of 12. Thats lining is c. From a start score of 12 rather so lets look where we can go to from c.
Well we can go back to f. But were not going to do that because its a star score. When we visit it was 5.
And its going to be more if we visit this prime. But we can go to g 2. And we can go to f.
So lets put those into the tree g that has a heuristics gods zero and the cost of the arc is five and two f f. Has a heuristic score. You stick estimate of six and the cost of the arc is seven.
So lets calculate the new a star scores along these new branches. So its eight plus five plus zero is 13 and 8 plus. 7.
Is 15 15. 6. Is 21 for that branch.
There so thats our most expensive branch. So far good to see a tick and add it to the visited list so c. Has been visited for a cost of 12 lets look at the remaining branches.
Well. Weve got c. Here for a nice task.
Or 13g. One a star score. 14 g.
2. And a star score 13 f. For our a star score.
21. And a for 13. Were just going to weve got three end in a 13 3.
Other score 13. Were just going to take them in alphabetical order. So well visit this one for the c for a score of 13.
But we already visited c for no star score of 12. Its in there so theres no point in expanding that note thats a dead end then we go to e4 the next one e. We can go to g 3.
For a cost of 7 to 3. Here. We calculate the a star score of this new path.
So that six plus. Two is eight plus seven is fifteen 15 and zero. Is 15.
For this branch. E. Has now been visited for an a star score of 13 and at this point.
Weve now got one two three four active branches. 14. 13.
21. And 15. So this is the best one we look at the node to see if its a goal state.
And it is so we have now reached the goal and because the heuristic that we used was an admissible heuristic. We know that this path here is the optimal path through the tree now mark that for you in red before what we noticed was that the algorithm the a star algorithm here has done a fair amount of work. Its visited a fair number of nodes and it expanded quite a lot of the tree.
The reason for this is that the heuristic measure that we used in the search space wasnt very accurate so for example. The heuristic is estimating that it costs. 5 to get from s to a goal state and we now know that the actual cost is 13.
So what im going to ask you to do for the assignment is that im going to ask you to run the search. The a star search again. But im going to give you more accurate measures for the heuristics from each of the node to see what difference that makes .
Thank you for watching all the articles on the topic A* Search. All shares of granthamandira.org are very good. We hope you are satisfied with the article. For any questions, please leave a comment below. Hopefully you guys support our website even more.