He Heur urist stic ic Sea earc rch: h: Bes estFS tFS an and - - PowerPoint PPT Presentation

he heur urist stic ic sea earc rch h bes estfs tfs an and
SMART_READER_LITE
LIVE PREVIEW

He Heur urist stic ic Sea earc rch: h: Bes estFS tFS an and - - PowerPoint PPT Presentation

He Heur urist stic ic Sea earc rch: h: Bes estFS tFS an and d A * Computer Co ter Sc Scienc nce e cpsc sc322 322, , Lectu cture e 8 (Te Text xtbo book ok Chpt 3.6) Sept, t, 23, 2013 CPSC 322, Lecture 8 Slide 1 Departm


slide-1
SLIDE 1

CPSC 322, Lecture 8 Slide 1

He Heur urist stic ic Sea earc rch: h: Bes estFS tFS an and d A*

Co Computer ter Sc Scienc nce e cpsc sc322 322, , Lectu cture e 8 (Te Text xtbo book

  • k Chpt 3.6)

Sept, t, 23, 2013

slide-2
SLIDE 2

Departm tment ent of Computer ter Scien ence ce Undergr grad aduat uate e Events ts More details ils @ https:// ://www www.cs. .cs.ub ubc.ca c.ca/stu studen ents/u ts/und nderg ergra rad/lif d/life/u /upco pcomin ming-even vents ts

No BS Career er Succe cess ss Talk Date: : Mon., ., Sept t 23 Time: e: 5:30 pm Location tion: : DMP 110 Ericsso csson n Info fo Sessio ion Date: e: Tues., s., Sept t 24 Time: : 11:30 am – 1:30 pm Location tion: : Kaiser er 2020 CS Commun unity ity Hackath athon

  • n Info
  • Sessi

sion

  • n

Date: e: Tues., s., Sept t 24 Time: : 6 pm Location tion: : DMP 110

TELUS

US Open House Date: : Fri., ., Sept 27 Time: e: 12:30 0 – 3 pm Location tion: : 3777 Kingsw sway ay IBM Info

  • Sessi

sion

  • n

Date: e: Mon., ., Sept t 30 Time: : 5:45 – 7:30 pm Location tion: : DMP 110 Gameloft eloft Tech h Talk Date: e: Tues., s., Oct t 1 Time: : 5:30 – 6:30 pm Location tion: : DMP 110

slide-3
SLIDE 3

CPSC 322, Lecture 7 Slide 3

Course urse Announcements nouncements

Marks ks for r Assignm gnment0: nt0: poste ted d on Connect ct If f you are confuse fused d on basic search ch algorith rithm, m, differ ferent ent search strategies….. Check learnin ning g goals at the end of lectu tures.

  • res. Work
  • rk on the Practice

ctice Exercises cises and and Please e come to offi fice ce hours Giuseppe : Fri 2-3, my office CICSR 105 Kamyar Ardekani Mon 2-3, X150 (Learning Center) Tatsuro Oya Thur 11-12, X150 (Learning Center) Xin Ru (Nancy) Wang Tue 2-3, X150 (Learning Center) Assignment1: nment1: posted ted

slide-4
SLIDE 4

CPSC 322, Lecture 7 Slide 4

Course urse Announcements nouncements

Inked ed Sl Slid ides

  • At the end of each lecture

ure I revise/ se/cl clean an-up p the slides. s. Adding comments, improving writing… make sure you check k them m out

slide-5
SLIDE 5

CPSC 322, Lecture 8 Slide 5

Lecture cture Ov Overview rview

  • Re

Recap ap / Fi Fini nish sh He Heur uristic stic Fu Func nction tion

  • Be

Best Fi First t Se Sear arch

  • A*
slide-6
SLIDE 6

CPSC 322, Lecture 6 Slide 6

How w to to Combine mbine Heuristics uristics

If h1(n) is admissible and h2(n) is also admissible then A.

  • A. min( h1(n)

n), , h2(n (n)) )) is also admissible and dominates its components B.

  • B. max( h1(n

(n), ), h2(n (n)) )) is also admissible and dominates its components C.

  • C. avg

vg( ( h1(n (n), ), h2(n (n)) )) is also admissible and dominates its components D.

  • D. None of the above
slide-7
SLIDE 7

CPSC 322, Lecture 3 Slide 7

Exa xample mple Heuristic uristic Fu Functio ctions ns

  • 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

slide-8
SLIDE 8

CPSC 322, Lecture 3 Slide 8

Another

  • ther approach

proach to to co construct nstruct heuristics uristics

So Solutio tion n cost t for a subpro robl blem

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

Current node Goal node

Original Problem SubProblem

slide-9
SLIDE 9

CPSC 322, Lecture 3 Slide 9

Combining mbining Heurist uristics: ics: Exa xample mple

In 8-puzzl zzle, e, soluti ution

  • n cost

st for the 1,2,3 2,3,4 ,4 subpr prob

  • ble

lem is substantially more accurate than sum of Manhattan distance of each tile from its goal position in some cases es So…..

slide-10
SLIDE 10

CPSC 322, Lecture 3 Slide 10

Adm dmis issible sible he heur uris istic tic fo for Vac acuu uum m wor

  • rld

ld?

states? Where it is dirty and robot location actions? Left, Right, Suck Possible goal test? no dirt at all locations

slide-11
SLIDE 11

CPSC 322, Lecture 6 Slide 11

Adm dmis issible sible he heur uris istic tic fo for Vac acuu uum m wor

  • rld

ld?

states? Where it is dirty and robot location actions? Left, Right, Suck Possible goal test? no dirt at all locations

slide-12
SLIDE 12

CPSC 322, Lecture 8 Slide 12

Lecture cture Ov Overview rview

  • Re

Recap ap He Heur uristic stic Fu Func nctio tion

  • Be

Best Fi First t Se Sear arch

  • A*
slide-13
SLIDE 13

CPSC 322, Lecture 7 Slide 13

Best st-First First Search arch

  • Idea:

a: select the path whose end is closest to a goal according to the heuristic function.

  • Be

Best-Fi First rst search rch selects a path on the frontier with minimal h-value (for the end node).

  • It treats the frontier as a priority queue ordered by h.

(similar to ?)

  • This is a greedy approach: it always takes the path

which appears locally best

slide-14
SLIDE 14

CPSC 322, Lecture 7 Slide 14

Analysis alysis of f Best st-First First Search arch

  • Not Complete : a low heuristic value can mean

that a cycle gets followed forever.

  • Optimal: no (why not?)
  • Time complexity is O(bm)
  • Space complexity is O(bm)
slide-15
SLIDE 15

CPSC 322, Lecture 8 Slide 15

Lecture cture Ov Overview rview

  • Re

Recap ap He Heur uristic stic Fu Func nctio tion

  • Be

Best Fi First t Se Sear arch

  • A* Search Strategy
slide-16
SLIDE 16

CPSC 322, Lecture 6 Slide 16

How w ca can we eff ffective ectively ly use se h(n) n)

Maybe we should combine it with the cost. How? Shall we select from the frontier the path p with:

  • A. Lowest cost(p) – h(p)
  • B. Highest cost(p) – h(p)
  • C. Highest cost(p)+h(p)
  • D. Lowest cost(p)+h(p)
slide-17
SLIDE 17

CPSC 322, Lecture 8 Slide 17

  • A* is a mix of:
  • lowe

west-cost cost-first first and

  • best-fir

irst st search ch

  • A* treats the frontier as a priority queue ordered

by f(p)=

  • It always selects the node on the frontier with the

………….. estimated …………….distance.

A* Search rch Algorithm gorithm

slide-18
SLIDE 18

f-value of UBC  KD JB? 6 10 11 9

Computing mputing f-va values lues

slide-19
SLIDE 19

CPSC 322, Lecture 6 Slide 19

An Analysis alysis of f A* A*

If the heuristic is completely uninformative and the edge costs are all the same, A* is equivalent to….

  • A. BFS
  • B. LCFS
  • C. DFS
  • D. None of the Above
slide-20
SLIDE 20

CPSC 322, Lecture 8 Slide 20

Analysi alysis s of f A*

Let's assume that arc costs are strictly positive.

  • Time complexity is O(bm)
  • the heuristic could be completely uninformative and the

edge costs could all be the same, meaning that A* does the same thing as….

  • Space complexity is O(bm) like ….., A* maintains a

frontier which grows with the size of the tree

  • Completeness: yes.
  • Optimality: ??

DFS LCFS BFS

slide-21
SLIDE 21

CPSC 322, Lecture 8 Slide 21

Op Optim timality ality of f A*

If A* returns a solution, that solution is guaranteed to be optimal, as long as

When

  • the branching factor is finite
  • arc costs are strictly positive
  • h(n) is an underestimate of the length of the shortest path

from n to a goal node, and is non-negative Theorem rem If A* selects a path p as the solution, p is the shortest (i.e., lowest-cost) path.

slide-22
SLIDE 22

CPSC 322, Lecture 8 Slide 22

Wh Why is A* optimal? timal?

  • A* returns p
  • Assume for contradiction that some other path p' is actually the

shortest path to a goal

  • Consider the moment when p is chosen from the frontier. Some

part of path p' will also be on the frontier; let's call this partial path p''.

p p' p''

slide-23
SLIDE 23

CPSC 322, Lecture 8 Slide 23

Wh Why is A* optimal? (cont’)

  • Because p was expanded before p'',
  • Because p is a goal,

Thus

  • Because h is admissible, cost(p'') + h(p'')  for any path

p' to a goal that extends p''

  • Thus

for any other path p' to a goal.

p p' p''

This contradicts our assumption that p' is the shortest path.

slide-24
SLIDE 24

CPSC 322, Lecture 8 Slide 24

Op Optim timal al eff fficiency iciency of f A*

  • In fact, we can prove something even stronger

about A*: in a sense (given the particular heuristic that is available) no searc rch h algorith rithm m could ld do better ter!

  • Op

Optim imal al Ef Effici icienc ency: y: Among all optim imal al algorith rithms ms that start rt from the same start rt node and use the same heuris istic tic h, A* expands the minimal number

  • f paths.
slide-25
SLIDE 25

Sample mple A* applications plications

  • An

An Ef Effici icient ent A* A* Se Search h Al Algorit rithm hm Fo For St Statistica istical Machine Translation. 2001

  • Th

The Genera raliz lized ed A* A* Ar Archite itect ctur

  • ure. Journal of

Artificial Intelligence Research (2007)

  • Machine Vision … Here we consider a new

compositional model for finding salient curves.

  • Fa

Factor tored d A* A*searc arch h for models ls over seque uences nces and trees es International Conference on AI. 2003…. It starts saying… The primary challenge when using A*

search is to find heuristic functions that simultaneously are admissible, close to actual completion costs, and efficient to calculate… applied to NLP and BioInformatics

CPSC 322, Lecture 9 Slide 25

slide-26
SLIDE 26

Sample A* applications (cont’)

Aker, A., Cohn, T., Gaizauskas, R.: Multi-do docu cumen ent t summariz rizatio ation n using g A* A* searc rch h and disc scri rimin minative ative traini ining.

  • ng. Proceedings of the 2010 Conference on

Empirical Methods in Natural Language Processing.. ACL (2010)

CPSC 322, Lecture 8 Slide 26

slide-27
SLIDE 27

CPSC 322, Lecture 8 Slide 27

  • The AI-Search animation system

http://www.cs.rmit.edu.au/AI-Search/Product/

  • To examine Search strategies when they are applied to

the 8puzzle

  • Compare only DFS, BFS and A* (with only the two

heuristics we saw in class )

DFS FS, , BFS FS, , A* Animatio imation n Exampl ample

  • With default start state and goal
  • DFS will find

Solution at depth 32

  • BFS will find

Optimal solution depth 6

  • A* will also find opt. sol. expanding

much less nodes

slide-28
SLIDE 28

CPSC 322, Lecture 9 Slide 28

nPuzzles uzzles are e not t always ways so solvable lvable

Half of the starting positions for the n-puzzle are impossible to resolve (for more info on 8puzzle)

http://www.isle.org/~sbay/ics171/project/unsolvable

  • So experiment with the AI-Search animation system with

the default configurations.

  • If you want to try new ones keep in mind that you may pick

unsolvable problems

slide-29
SLIDE 29

CPSC 322, Lecture 7 Slide 29

Learning Goals for today’s class

  • Defin

ine/r e/read ad/writ /write/tr e/trace/d ace/debu bug & Compare re different search algorithms

  • With / Without cost
  • Informed / Uninformed
  • Formally prove A* optimality.
slide-30
SLIDE 30

CPSC 322, Lecture 8 Slide 30

Next xt cl class ass

Finish Search (finish Chpt 3)

  • Branch-and-Bound
  • A* enhancements
  • Non-heuristic Pruning
  • Dynamic Programming