Docsity

Heuristic Search, Lecture notes of Computer science

Partial preview of the text

Download Heuristic Search and more Lecture notes Computer science in PDF only on Docsity!

Heuristic Search

Computer Science cpsc322, Lecture 7

(Textbook Chpt 3.6)

Sept, 19, 2012

Course Announcements

Marks for Assignment0: will be posted on Connect on Fir

If you are confused on basic search algorithm, different search strategies….. Check learning goals at the end of lectures. Work on the Practice Exercises and Please come to office hours

Giuseppe Tue 2 pm, my office. Nathaniel Tomer Fri 11am, X150 (Learning Center) Tatsuro Oya Wed 11am, X150 (Learning Center) Mehran Kazemi Mon 11 am, X150 (Learning Center)

Assignment1: will also be posted on Fri

Recap: Search with Costs

  • Sometimes there are costs associated with arcs.
    • The cost of a path is the sum of the costs of its arcs.
  • Optimal solution: not the one that minimizes the number of links, but the one that minimizes cost
  • Lowest-Cost-First Search: expand paths from the

frontier in order of their costs.

Recap Uninformed Search

Complete Optimal Time Space

DFS N N O(bm) O(mb)

BFS Y Y O(bm) O(bm)

IDS Y Y O(bm) O(mb)

LCFS Y

Costs > 0

Y

Costs >=

O(bm) O(bm)

Lecture Overview

  • Recap
    • Search with Costs
    • Summary Uninformed Search
  • Heuristic Search

Uninformed/Blind search algorithms do not take

into account the goal until they are at a goal

node.

Often there is extra knowledge that can be used

to guide the search: an estimate of the distance from node n to a goal node.

This is called a heuristic

Heuristic Search

More formally (cont.)

Definition (admissible heuristic)

A search heuristic h(n) is admissible if it is never an

overestimate of the cost from n to a goal.

  • There is never a path from n to a goal that has path length less

than h(n).

  • another way of saying this: h(n) is a lower bound on the cost of

getting from n to the nearest goal.

Example Admissible Heuristic Functions

G

Search problem: robot has to find a route from start

location to goal location on a grid (discrete space with

obstacles)

Final cost (quality of the solution) is the number of steps

Example Admissible Heuristic Functions

If there are obstacle, the optimal solution without

obstacles is an admissible heuristic

G

Example Admissible Heuristic Functions

  • Similarly, If the nodes are points on a Euclidean plane and the cost is the distance, we can use the straight-line

distance from n to the closest goal as the value of h(n).

Example Heuristic Functions

  • Another one we can use the number of moves between each tile's current position and its position in the solution

1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8

How to Construct a Heuristic You identify relaxed version of the problem:

  • where one or more constraints have been dropped
  • problem with fewer restrictions on the actions Robot: the agent can move through walls Driver: the agent can move straight 8puzzle: (1) tiles can move anywhere (2) tiles can move to any adjacent square

Result: The cost of an optimal solution to the relaxed

problem is an admissible heuristic for the original

problem (because it is always weakly less costly to solve

a less constrained problem!)

CPSC 322, Lecture 3 Slide 19

Another approach to construct heuristics

Solution cost for a subproblem

Current node

Goal node

Original Problem SubProblem

CPSC 322, Lecture 8

Heuristics: Dominance

If h 2 (n) ≥ h 1 (n) for every state n (both admissible)

then h 2 dominates h 1

Which one is better for search (why?)

8puzzle: (1) tiles can move anywhere (2) tiles can move to any adjacent square (Original problem: tiles can move to an adjacent square if it is empty) search costs for the 8-puzzle (average number of paths expanded): (d = depth of the solution) d=12 IDS = 3,644,035 paths A(h 1 ) = 227 paths A(h 2 ) = 73 paths d=24 IDS = too many paths A(h 1 ) = 39,135 paths A(h 2 ) = 1,641 paths