Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Lecture 7: Informed Search Methods in CS 1571 Intro to AI - Prof. Milos Hauskrecht, Assignments of Computer Science

A lecture note from cs 1571 introduction to artificial intelligence course by milos hauskrecht. It covers the topic of informed search methods, specifically uniform cost search, best-first search, and greedy search. The notes explain the concepts, provide examples, and discuss the properties and limitations of each method.

Typology: Assignments

Pre 2010

Uploaded on 09/02/2009

koofers-user-g2x
koofers-user-g2x 🇺🇸

10 documents

1 / 24

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
1
CS 1571 Intro to AI M. Hauskrecht
CS 1571 Introduction to AI
Lecture 7
Milos Hauskrecht
milos@cs.pitt.edu
5329 Sennott Square
Informed search methods
CS 1571 Intro to AI M. Hauskrecht
Announcements
Homework assignment 2 is out
Due on Thursday, September 20, 2007
Two parts:
Pen and pencil part
Programming part – heuristics for (Puzzle 8)
Course web page:
http://www.cs.pitt.edu/~milos/courses/cs1571/
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18

Partial preview of the text

Download Lecture 7: Informed Search Methods in CS 1571 Intro to AI - Prof. Milos Hauskrecht and more Assignments Computer Science in PDF only on Docsity!

CS 1571 Intro to AI M. Hauskrecht

CS 1571 Introduction to AI

Lecture 7

Milos Hauskrecht

milos@cs.pitt.edu

5329 Sennott Square

Informed search methods

Announcements

  • Homework assignment 2 is out
    • Due on Thursday, September 20, 2007
    • Two parts:
      • Pen and pencil part
      • Programming part – heuristics for (Puzzle 8)

Course web page: http://www.cs.pitt.edu/~milos/courses/cs1571/

CS 1571 Intro to AI M. Hauskrecht

Evaluation-function driven search

  • A search strategy can be defined in terms of a node evaluation function
  • Evaluation function
    • Denoted
    • Defines the desirability of a node to be expanded next
  • Evaluation-function driven search: expand the node (state) with the best evaluation-function value
  • Implementation: priority queue with nodes in the decreasing order of their evaluation function value

f ( n )

Uniform cost search

  • Uniform cost search (Dijkstra’s shortest path):
    • A special case of the evaluation-function driven search
  • Path cost function ;
    • path cost from the initial state to n
  • Uniform-cost search:
    • Can handle general minimum cost path-search problem:
    • weights or costs associated with operators (links).
  • Note: Uniform cost search relies on the problem definition only
    • It is an uninformed search method

g ( n )

f ( n )= g ( n )

CS 1571 Intro to AI M. Hauskrecht

Best-first search

Best-first search

  • incorporates a heuristic function, , into the evaluation function to guide the search.
  • heuristic function: measures a potential of a state (node) to reach a goal

Special cases (differ in the design of evaluation function):

  • Greedy search
  • A algorithm*
  • iterative deepening version of A* : IDA*

f ( n )

f ( n )= h ( n )

f ( n )= g ( n )+ h ( n )

h ( n )

Greedy search method

  • Evaluation function is equal to the heuristic function
  • Idea: the node that seems to be the closest to the goal is expanded first

f ( n )= h ( n )

CS 1571 Intro to AI M. Hauskrecht

Greedy search

Arad 366

f(n)=h(n) queue (^) Arad 366

Greedy search

Arad

Zerind Sibiu Timisoara

366 75 140 118

374 253 329

queue Sibiu 253 Timisoara 329 Zerind 374

f(n)=h(n)

CS 1571 Intro to AI M. Hauskrecht

Properties of greedy search

  • Completeness:?
  • Optimality:?
  • Time complexity:?
  • Memory (space) complexity:?

Properties of greedy search

  • Completeness: No. We can loop forever. Nodes that seem to be the best choices can lead to cycles. Elimination of state repeats can solve the problem.
  • Optimality: No.

Even if we reach the goal, we may be biased by a bad heuristic estimate. Evaluation function disregards the cost of the path built so far.

  • Time complexity:
  • Memory (space) complexity:

O ( bm )

O ( bm )

Worst case !!! But often better!

Often better!

CS 1571 Intro to AI M. Hauskrecht

Example: traveler problem with straight-line

distance information

  • Greedy search result

Total: 450

Example: traveler problem with straight-line

distance information

  • Greedy search and optimality

Total: 450

Total: 418

CS 1571 Intro to AI M. Hauskrecht

A* search example

Arad

Zerind Sibiu Timisoara

366 75 140 118

449 393 447

queue (^) Sibiu 393 Timisoara 447 Zerind 449

f(n)

A* search example

Arad

Zerind Sibiu Timisoara

75 140 118

Zerind Sibiu

Arad Oradea Fagaras RimnicuVilcea

366

(^140 151 99 )

646 526 417 413

449 393 447

Rimnicu V. 413 Fagaras 417 Timisoara 447 Zerind 449 Oradea 526 Arad 646

queue

f(n)

CS 1571 Intro to AI M. Hauskrecht

A* search example

Arad

Zerind Sibiu Timisoara

75 140 118

Zerind Sibiu

Arad Oradea Fagaras RimnicuVilcea

366

(^140 151 99 )

646 526 417 413

449 393 447

Craiova Pitesti Sibiu 526 415 553

146 97 80

447

Pitesti 415 Fagaras 417 Timisoara 447 Zerind 449 Oradea 526 Craiova 526 Sibiu 553 Arad 646

queue

f(n)

A* search example

Arad

Zerind Sibiu Timisoara

75 140 118

Zerind Sibiu

Arad Oradea Fagaras RimnicuVilcea

366

(^140 151 99 )

646 526 417 413

449 393 447

Craiova Pitesti Sibiu 526 415 553

146 97 80

Craiova Bucharest 607 615 418

97 138 101 Rimnicu Vilcea

447447

Fagaras 417 Bucharest 418 Timisoara 447 Zerind 449 Oradea 526 Craiova 526 Sibiu 553 Rimnicu V. 607 Arad 646

queue

f(n)

CS 1571 Intro to AI M. Hauskrecht

Properties of A* search

  • Completeness: Yes.
  • Optimality:?
  • Time complexity: -?
  • Memory (space) complexity: -?

Optimality of A*

  • In general, a heuristic function :

It can overestimate, be equal or underestimate the true distance of a node to the goal

  • Is the A* optimal for an arbitrary heuristic function?

h *^ ( n )

h ( n )

CS 1571 Intro to AI M. Hauskrecht

Example: traveler problem with straight-line

distance information

  • Admissible heuristics

400

overestimate

Example: traveler problem with straight-line

distance information

  • Admissible heuristics

f(n)= 220+400= 400

f(n)= 239+178= 417

CS 1571 Intro to AI M. Hauskrecht

Optimality of A*

  • In general, a heuristic function : Can overestimate, be equal or underestimate the true distance of a node to the goal
  • Admissible heuristic condition
    • Never overestimate the distance to the goal !!!

Example: the straight-line distance in the travel problem never overestimates the actual distance

Is A search with an admissible heuristic is optimal ??*

h ( n )≤ h *^ ( n ) for all n

h *^ ( n )

h ( n )

Optimality of A* (proof)

  • Let G1 be the optimal goal (with the minimum path distance). Assume that we have a sub-optimal goal G2. Let n be a node that is on the optimal path and is in the queue together with G

( ) since isadmissible

( 1 ) sinceG2issuboptimal

( 2 ) ( 2 ) since ( 2 ) 0

f n h

g G

f G g G hG

start

G

G

n

Then:

And thus A never selects G2 before* n

CS 1571 Intro to AI M. Hauskrecht

Properties of A* search

  • Completeness: Yes.
  • Optimality: Yes (with the admissible heuristic)
  • Time complexity: -?
  • Memory (space) complexity: -?

Properties of A* search

  • Completeness: Yes.
  • Optimality: Yes (with the admissible heuristic)
  • Time complexity:
    • Order roughly the number of nodes with f(n) smaller than the cost of the optimal path _g_*
  • Memory (space) complexity:
    • Same as time complexity (all nodes in the memory)

CS 1571 Intro to AI M. Hauskrecht

Admissible heuristics

Heuristics 1: number of misplaced tiles

Initial position Goal position

h(n) for the initial position: 7

Admissible heuristics

  • Heuristic 2: Sum of distances of all tiles from their goal positions (Manhattan distance)

Initial position Goal position

h(n) for the initial position:

CS 1571 Intro to AI M. Hauskrecht

Admissible heuristics

  • Heuristic 2: Sum of distances of all tiles from their goal positions (Manhattan distance)

Initial position Goal position

h(n) for the initial position: 2 + 3 + 3 + 1 + 1 + 2 + 0 + 2 = 14

For tiles: 1 2 3 4 5 6 7 8

Admissible heuristics

  • We can have multiple admissible heuristics for the same problem
  • Dominance: Heuristic function dominates if
  • Combination: two or more admissible heuristics can be combined to give a new admissible heuristics - Assume two admissible heuristics

n h 1 ( n )≥ h 2 ( n )

h 1 h 2

h 3 (^) ( n )=max( h 1 ( n ), h 2 ( n ))

h 1 , h 2

Then:

is admissible