1 / 36

WAES 3308 Numerical Methods for AI

WAES 3308 Numerical Methods for AI. Searching Algorithm WEK070139 Wong Yik Foong WEK070134 Tee Jing Hong. Introduction. Searching algorithm:- Is an algorithm for finding an item with specified properties among a collection of items.

neal
Download Presentation

WAES 3308 Numerical Methods for AI

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. WAES 3308 Numerical Methods for AI Searching Algorithm WEK070139 Wong Yik Foong WEK070134 Tee Jing Hong

  2. Introduction • Searching algorithm:- • Is an algorithm for finding an item with specified properties among a collection of items. • Is a problem-solving technique that systematically explores a space of problem states, e.g. puzzle game, chess game, etc. • We concentrate on:- • Depth first search • Breadth first search • A* search

  3. Depth-First Search • An algorithm for traversing or searching a tree, tree structure, or graph. • How it works? • Begin at the root and explores as far as possible along each branch before backtracking to other branch.

  4. Depth-First Search • The diagram shows the sequence of the moves until the goal is found using depth-first search. • Start with the root node (1) • Search the nodes within the same branch before proceeding to next. • It takes 10 nodes to examine until the goal is found.

  5. Breadth-First Search • A technique of searching through a tree whereby all nodes in a tree at same level are searched before searching nodes at next level. • How it works? • It will check all nodes of a lower hierarchy first before further descending to higher ones.

  6. Breadth-First Search • The diagram show the sequences of moves by using breadth-first search. • Start with the root node (1) • Search the nodes within same level first before proceeding to next. • It takes 4 nodes to examine until the goal is found.

  7. A* Search • A* is a best-first search algorithm that finds the least-cost path from a given initial node to one goal node. • A* is a network searching algorithm that takes a "distance-to-goal + path-cost" score into consideration.

  8. Example of implementation • 1) Puzzle game • Initial state Our goal • Number from 1 to 8 are arranged in 3x3 field • An empty spot that can move adjacent number to in order to change their state representation configuration of the puzzle

  9. Knowledge representation for puzzle game • Using 2-dimension array in C, Java, C# and etc. • Every number in the puzzle can be stored using the respective integer • Empty spot can store as -1 or any other integer that is not use in the puzzle tiles

  10. Initial state • 3 possible states from current state : 1. move down ‘4’ 2. move right ‘8’ 3. move left ‘6’

  11. Continue… • To make life more easy, we assume we are moving the empty spot instead of the number tiles. • Diagram below show the next 3 possible state

  12. 2) Searching tree * / | \ x x $ / | \ / | \ / | \ x xxxxxxxx • Where • * is the root of the tree • x is a node of the tree • $ is the goal node of the tree • / is an edge of the tree

  13. Using depth-first • the most intuitive and naive strategy • Disadvantage in this case: does not guarantee to find the “best solution” which normally is referred to as the shallowest goal in the tree/graph. • Worse case : the search tree has infinite depth(may cause impossible to find solution)

  14. Continue… • Diagram above show the sequence of traversed node using depth-first search • Take 10 steps to find the solution • Not that bad as the best goal is found

  15. But how if … • There is 2 solutions in the search tree? ($1 and $2)

  16. Or more worse when… • When search tree has an infinite depth, the goal may not be found at all

  17. Using breath-first • Has advantage over depth-first search in this example because it guarantees to always find the best solution in the first try • Disadvantage : cause additional to exponential time complexity, because breath-first search will check all nodes of a lower hierarchy before further descending to higher ones

  18. Continue… • Diagram above show the sequence of traversed node using breath-first search • Obviously, this guarantees it finds the shallowest solution

  19. Using A* search • Estimation of how far a node might be away from the actual goal turns out to be very helpful. • A good measurement may reach the goal from root like this :

  20. Continue… • The next node to be traversed is determined by: • The cost of reaching that node • The estimated rest cost of finding the goal from that node

  21. 3) A* Search Example • The diagram illustrated with green box(the starting point, A), red box(the ending point, B) and the blue filled squares being the wall in between.

  22. Algorithm: • Begin at the starting point A and add it to an “open list” of squares to be considered. • Look at all the reachable or walkable squares adjacent to the starting point, ignoring squares with walls, water, or other illegal terrain. Add them to the open list. For each of these squares, save point A as its “parent square”. • Drop the starting square A from your open list, and add it to a “closed list”. - A “closed list” of squares is the square that don’t need to look at again for now.

  23. Dark green square is the starting square. • It is outlined in light green to indicate that the square has been added to the closed list. • All of the adjacent squares are now on the open list of squares to be checked, and they are outlined in light green. • A gray pointer that points back to its parent

  24. Which square do we choose? • The one with the lowest F cost.

  25. Path Scoring, F = G + H  • where G = the movement cost to move from the starting point A to a given square on the grid, following the path generated to get there.  • H = the estimated movement cost to move from that given square on the grid to the final destination, point B.

  26. Continue search… 4. Drop it from the open list and add it to the closed list. 5. Check all of the adjacent squares. Ignoring those that are on the closed list or unwalkable (terrain with walls, water, or other illegal terrain), add squares to the open list if they are not on the open list already. Make the selected square the “parent” of the new squares.

  27. Continue search… 6. If an adjacent square is already on the open list, check to see if this path to that square is a better one. In other words, check to see if the G score for that square is lower if we use the current square to get there. If not, don’t do anything. On the other hand, if the G cost of the new path is lower, change the parent of the adjacent square to the selected square. Finally, recalculate both the F and G scores of that square.

  28. Summary of the A* Method • 1) Add the starting square (or node) to the open list. • 2) Repeat the following: • a) Look for the lowest F cost square on the open list. • b) Switch it to the closed list. • c) For each of the 8 squares adjacent to this current square … • If it is not walkable or if it is on the closed list, ignore it. Otherwise do the following.            • If it isn’t on the open list, add it to the open list. Make the current square the parent of this square. Record the F, G, and H costs of the square.  • If it is on the open list already, check to see if this path to that square is better, using G cost as the measure. A lower G cost means that this is a better path. If so, change the parent of the square to the current square, and recalculate the G and F scores of the square. If you are keeping your open list sorted by F score, you may need to resort the list to account for the change.

  29. d) Stop when you: • Add the target square to the closed list, in which case the path has been found (see note below), or • Fail to find the target square, and the open list is empty. In this case, there is no path.    • 3) Save the path. Working backwards from the target square, go from each square to its parent square until reach the starting square. That is the path.

  30. Google PageRank • PageRank is most important technique for Google to verify the ranking of the webpage. • Methods: • Find all the related web pages based on the keywords • Based on the title and the occurrence of keyword to arrange the level of the web pages • Calculate the keywords inside the inbound link pages • Based on the PageRank scoring to adjust the website ranking on the SERP (Search Engine Results Page)

  31. Google PageRank • If page B have a link to page A (B is inbound link of A), then B think A have linking value, considered as a vote from page B to page A. • Votes cast by pages that are themselves "important" weigh more heavily and help to make other pages "important". • When B ranking is high, then A will based on the inbound link, B to receive certain rank and the score will separate averagely to all of the outbound link of A.

  32. Thank you

More Related