notes n.
Skip this Video
Loading SlideShow in 5 Seconds..
Notes PowerPoint Presentation
Download Presentation

Loading in 2 Seconds...

play fullscreen
1 / 34

Notes - PowerPoint PPT Presentation

  • Uploaded on

Notes. Dijstra’s Algorithm Corrected syllabus. Tree Search Implementation Strategies. Require data structure to model search tree Tree Node: State (e.g. Sibiu) Parent (e.g. Arad) Action (e.g. GoTo (Sibiu)) Path cost or depth (e.g. 140 )

I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
Download Presentation

PowerPoint Slideshow about 'Notes' - dewey

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.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
  • Dijstra’sAlgorithm
  • Corrected syllabus
tree search implementation strategies
Tree Search Implementation Strategies
  • Require data structure to model search tree
  • Tree Node:
    • State (e.g. Sibiu)
    • Parent (e.g. Arad)
    • Action (e.g. GoTo(Sibiu))
    • Path cost or depth (e.g. 140)
    • Children (e.g. Faragas, Oradea) (optional, helpful in debugging)
  • Methods:
    • Empty(queue)
      • Returns true if there are no more elements
    • Pop(queue)
      • Remove and return the first element
    • Insert(queue, element)
      • Inserts element into the queue
        • InsertFIFO(queue, element) – inserts at the end
        • InsertLIFO(queue, element) – inserts at the front
        • InsertPriority(queue, element, value) – inserts sorted by value



Uninformed search

Informed search

informed search1
Informed Search
  • What if we had an evaluation function h(n) that gave us an estimate of the cost associated with getting from n to the goal
    • h(n) is called a heuristic
greedy best first search
Greedy best-first search
  • Evaluation function f(n) = h(n) (heuristic)
    • e.g., f(n) = hSLD(n) = straight-line distance from n to Bucharest
  • Greedy best-first search expands the node that is estimated to be closest to goal
performance of greedy best first search1
Performance of greedy best-first search
  • Complete?
    • No – can get stuck in loops, e.g., Iasi Neamt Iasi Neamt
  • Optimal?
    • No
complexity of greedy best first search
Complexity of greedy best first search
  • Time?
    • O(bm), but a good heuristic can give dramatic improvement
  • Space?
    • O(bm) -- keeps all nodes in memory
a search
A* search
  • Ideas:
    • Avoid expanding paths that are already expensive
    • Consider
      • Cost to get here (known) – g(n)
      • Cost to get to goal (estimate from the heuristic) – h(n)
a evaluation functions
A * Evaluation functions
  • 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







a heuristics
A* 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)
what happens if heuristic is not admissible
What happens if heuristic is not admissible?
  • Will still find solution (complete)
  • But might not find best solution (not optimal)
properties of a w admissible heuristic
Properties of A* (w/ admissible heuristic)
  • Complete?
    • Yes (unless there are infinitely many nodes with f ≤ f(G) )
  • Optimal?
    • Yes
  • Time?
    • Exponential, approximately O(bd)in the worst case
  • Space?
    • O(bm) Keeps all nodes in memory
the heuristic h x guides the performance of a
The heuristic h(x) guides the performance of A*
  • Let d(x) be the actual distance between S and G
    • h(x) = 0 :
      • A* is equivalent to Uniform-Cost Search
    • h(x) <= d (x) :
      • guarantee to compute the shortest path; the lower the value h(x), the more node A* expands
    • h(x) = d (x) :
      • follow the best path; never expand anything else; difficult to compute h(x) in this way!
    • h(x) > d(x) :
      • not guarantee to compute a best path; but very fast
    • h(x) >> g(x) :
      • h(n) dominates -> A* becomes the best first search
admissible heuristics1
Admissible heuristics

E.g., for the 8-puzzle:

admissible heuristics2
Admissible heuristics

E.g., for the 8-puzzle:

  • h1(n) = number of misplaced tiles
  • h2(n) = summed Manhattan distance for all tiles (i.e., no. of squares from desired location of each tile)
  • h1(S) = ?
  • h2(S) = ?
admissible heuristics3
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

Which is better?

  • If h2(n) ≥ h1(n) for all n (both admissible)
    • then h2dominatesh1
    •  h2is better for search
  • What does better mean?
    • All searches we’ve discussed are exponential in time
where do heuristics come from
Where do heuristics come from?
  • From people
    • Knowledge of the problem
  • From computers
    • By considering a simpler version of the problem
    • Called a relaxation
relaxed problems
Relaxed problems
  • 8-puzzle
    • 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
  • Consider the example of straight line distance (Romania navigation)
    • Is that a relaxation?
iterative deepening a ida
Iterative-Deepening A* (IDA*)
  • Further reduce memory requirements of A*
  • Regular Iterative-Deepening: regulated by depth
  • IDA*: regulated by f(n)=g(n)+h(n)