1 / 41

Informed search algorithms

Informed search algorithms. CSC 450 - AI. Outline. Heuristics Best-first search Greedy best-first search A * search Heuristics properties. Motivation. Uninformed Search Strategies can find solutions to problems by Systematically generating new states Testing them against the goal

rbain
Télécharger la présentation

Informed search algorithms

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. Informed search algorithms CSC 450 - AI

  2. Outline • Heuristics • Best-first search • Greedy best-first search • A* search • Heuristics properties

  3. Motivation • Uninformed Search Strategies can find solutions to problems by • Systematically generating new states • Testing them against the goal • Incredibly inefficient in most cases. They will lead away from the goal as easily as it pursues options that lead towards the goal. • Informed Search Strategies • Uses problem-specific knowledge • Can find solutions more efficiently

  4. Heuristics • From Greek heuriskein, “to find”. • Of or relating to a usually speculative formulation serving as a guide in the investigation or solution of a problem. • Computer Science: Relating to or using a problem-solving technique in which the most appropriate solution, of several found by alternative methods, is selected at successive stages of a program for use in the next step of the program.

  5. Heuristic search • Introduction: • Al problem solvers employ heuristics in two situations:- • First: A problem may not have an exact solution, because of inherent ambiguities in the problem statement or available data. • Medical diagnosis is an example of this. A given set of symptoms may have several possible causes. Doctors use heuristics to chose the most likely diagnosis and formulate a plan of treatment.

  6. Heuristic search • Introduction: • Al problem solvers employ heuristics in two situations:- • First: A problem may not have an exact solution, because of inherent ambiguities in the problem statement or available data. • Vision is another example of an inherently inexact problem. • Visual scenes are often ambiguous, allowing multiple interpretations of the connectedness, extent and orientation of objects.

  7. Heuristic search • Introduction: • ALL problem solvers employ heuristics in two situations:- • First: A problem may not have an exact solution, because of inherent ambiguities in the problem statement or available data. • Optical illusions exemplify these ambiguities. • Vision systems use heuristics to select the most likely of several possible interpretations of a given scene.

  8. Heuristic search • Introduction: • Al problem solvers employ heuristics in two situations:- • Second: A problem may have an exact solution, but the computational cost of finding it may be prohibitive. • In many problems, state space growth is combinatorically explosive, with the number of possible states increasing exponentially or factorially with the depth of the search.

  9. Heuristic search • Introduction: • Al problem solvers employ heuristics in two situations:- • Second: A problem may have an exact solution, but the computational cost of finding it may be prohibitive. • Heuristic search handles above problem by guiding the search along the most “promising” path through the space.

  10. Heuristic search • Introduction: • Al problem solvers employ heuristics in two situations:- • Second: A problem may have an exact solution, but the computational cost of finding it may be prohibitive. • By eliminating unpromising states and their descendants from consideration, a heuristic algorithm can defeat this combinatorial explosion and find an acceptable solution.

  11. Heuristic search • Introduction: • Heuristics and the design of algorithms to implement heuristic search have been an important part of artificial intelligence research. • Game playing and theorem proving require heuristics to reduce search space to simplify the solution finding.

  12. Heuristic search • Introduction: • Heuristics are fallible. • A heuristics is only an informed guess of the next step to be taken in solving a problem. It is often based on experience or intuition. • Heuristics are seldom able to predict the exact behavior of the state space farther along in the search. • A heuristics can lead a search algorithm to a sub optimal solutions. • At times a heuristic method may fail to find any solution at all.

  13. Heuristic search strategies • Informedsearchtriestoreducetheamountof searchthatmustbedoneby: • Makingintelligentchoicesforthenodesthatare selectedforexpansion • Thisimpliestheexistenceofsomewayofevaluating thelikelihoodthatagivennodeisonthe solutionpath • In general this is done using a heuristic function

  14. Best-first search • Idea: use an evaluation functionf(n) for each node • f(n) provides an estimate for the total cost. • Expand the node n with smallest f(n). • Implementation: Order the nodes in fringe increasing order of cost. • Special cases: • greedy best-first search • A* search

  15. Romania with straight-line dist.

  16. Best-first search algorithms with different evaluation functions Breadth-first search is a best-first search with: • f(n)=depth(n) • Depth-first search is best-first search with: • f(n)=-depth(n) • A key component of best-first-search algorithms is a heuristic function, denoted: • h(n)=estimated cost of the cheapest path from node n to a goal node • A heuristic function h(n) takes a node as input, but it depends only on the state at that node.

  17. Greedy best-first search • Greedy best-first search tries to expand the node that is closest to the goal, on the grounds that this is likely to lead to a solution quickly. • f(n) = h(n) : estimate of cost from n to goal • e.g., f(n) = hSLD(n) straight-line distance from n to Bucharest • Greedy best-first search expands the node that appears to be closest to goal.

  18. Greedy algorithms • A greedy algorithm follows the “eat dessert first, since you never know if you will get to finish your meal” mantra. That is, we make the best local decisions without worrying about the future (or what Mom will say if you eat dessert before finishing your broccoli). • Greedy best-first search expands the node that appears to be closest to goal.

  19. Greedy Best-First Search example • hSLD(n)=straight-line distance from n to Bucharest. • The values of hSLD cannot be computed from the problem description itself. • It takes a certain amount of experience to know that hSLD is correlated with actual road distances and is, therefore, a useful heuristic,

  20. Greedy best-first search example

  21. Greedy best-first search example

  22. Greedy best-first search example

  23. Greedy best-first search example

  24. GBFS is not complete d c g b a goal state start state f(n) = straightline distance

  25. Properties of greedy best-first search • Complete? No – can get stuck in loops. • Time?O(bm), but a good heuristic can give dramatic improvement • Space?O(bm) - keeps all nodes in memory • Optimal? No e.g. AradSibiuRimnicu VireaPitestiBucharest is shorter!

  26. Properties of greedy best-first search • Greedy best-first search resembles depth-first search in the way it prefers to follow a single path all the way to the goal, but will back up when it hits a dead hit. • The algorithm suffers from the same defects as depth-first search – it is not optimal, and it is incomplete.

  27. A* search • Idea: avoid expanding paths that are already expensive • Evaluation function f(n) = g(n) + h(n) • g(n) = cost so far to reach n • h(n) = estimated cost from n to goal • f(n) = estimated total cost of path through n to goal • Best First search has f(n)=h(n) • Uniform Cost search has f(n)=g(n)

  28. Admissible heuristics • A heuristic h(n) is admissible if for every node n, h(n) ≤ h*(n), where h*(n) is the true cost to reach the goal state from n. • An admissible heuristic never overestimates the cost to reach the goal, i.e., it is optimistic • Example: hSLD(n) (never overestimates the actual road distance) • Theorem: If h(n) is admissible, A* using TREE-SEARCH is optimal

  29. Admissible heuristics E.g., for the 8-puzzle: • h1(n) = number of misplaced tiles • h2(n) = total Manhattan distance (i.e., no. of squares from desired location of each tile) • h1(S) = ? • h2(S) = ?

  30. Admissible heuristics E.g., for the 8-puzzle: • h1(n) = number of misplaced tiles • h2(n) = total Manhattan distance (i.e., no. of squares from desired location of each tile) • h1(S) = ? 8 • h2(S) = ? 3+1+2+2+2+3+3+2 = 18

  31. Dominance • If h2(n) ≥ h1(n) for all n (both admissible) • then h2dominatesh1 • h2is better for search: it is guaranteed to expand less or equal nr of nodes. • Typical search costs (average number of nodes expanded): • d=12 IDS = 3,644,035 nodes A*(h1) = 227 nodes A*(h2) = 73 nodes • d=24 IDS = too many nodes A*(h1) = 39,135 nodes A*(h2) = 1,641 nodes

  32. Relaxed problems • A problem with fewer restrictions on the actions is called a relaxed problem • The cost of an optimal solution to a relaxed problem is an admissible heuristic for the original problem • If the rules of the 8-puzzle are relaxed so that a tile can move anywhere, then h1(n) gives the shortest solution • If the rules are relaxed so that a tile can move to any adjacent square, then h2(n) gives the shortest solution

  33. Consistent heuristics • A heuristic is consistent if for every node n, every successor n' of n generated by any action a, h(n) ≤ c(n,a,n') + h(n') • If h is consistent, we have f(n’) = g(n’) + h(n’) (by def.) = g(n) + c(n,a,n') + h(n’) (g(n’)=g(n)+c(n.a.n’)) ≥ g(n) + h(n) = f(n) (consistency) f(n’) ≥ f(n) • i.e., f(n) is non-decreasing along any path. • Theorem: If h(n) is consistent, A* using GRAPH-SEARCH is optimal It’s the triangle inequality ! keeps all checked nodes in memory to avoid repeated states

  34. A* search example

  35. A* search example

  36. A* search example

  37. A* search example

  38. A* search example

  39. A* search example

  40. Properties of A* • Complete? Yes (unless there are infinitely many nodes with f ≤ f(G) , i.e. step-cost > ε) • Time/Space? Exponential Keeps all nodes in memory • Optimal? Yes

  41. Optimality of A* (proof) • Suppose some suboptimal goal G2has been generated and is in the fringe. Let n be an unexpanded node in the fringe such that n is on a shortest path to an optimal goal G. • f(G2) = g(G2) since h(G2) = 0 • f(G) = g(G) since h(G) = 0 • g(G2) > g(G) since G2 is suboptimal • f(G2) > f(G) from above • h(n) ≤ h*(n) since h is admissible (under-estimate) • g(n) + h(n) ≤ g(n) + h*(n) from above • f(n) ≤ f(G) since g(n)+h(n)=f(n) & g(n)+h*(n)=f(G) • f(n) < f(G2) from We want to prove: f(n) < f(G2) (then A* will prefer n over G2)

More Related