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 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 TELUS US Open House No BS Career er Succe cess ss Talk Date: : Mon., ., Sept t 23 Date: : Fri., ., Sept 27 Time: e: 5:30 pm Time: e: 12:30 0 – 3 pm Location tion: : DMP 110 Location tion: : 3777 Kingsw sway ay Ericsso csson n Info fo Sessio ion IBM Info o Sessi sion on Date: e: Tues., s., Sept t 24 Date: e: Mon., ., Sept t 30 Time: : 5:45 – 7:30 pm Time: : 11:30 am – 1:30 pm Location tion: : Kaiser er 2020 Location tion: : DMP 110 Gameloft eloft Tech h Talk CS Commun unity ity Hackath athon on Info o Sessi sion on Date: e: Tues., s., Oct t 1 Date: e: Tues., s., Sept t 24 Time: : 5:30 – 6:30 pm Time: : 6 pm Location tion: : DMP 110 Location tion: : DMP 110
Course urse Announcements nouncements Marks ks for r Assignm gnment0: nt0: poste ted d on Connect ct Assignment1: nment1: posted ted 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 ork 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) CPSC 322, Lecture 7 Slide 3
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 CPSC 322, Lecture 7 Slide 4
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* CPSC 322, Lecture 8 Slide 5
How w to to Combine mbine Heuristics uristics If h 1 (n) is admissible and h 2 (n) is also admissible then A. A. min( h 1 (n) n), , h 2 (n (n)) )) is also admissible and dominates its components B. max( h 1 (n B. (n), ), h 2 (n (n)) )) is also admissible and dominates its components C. C. avg vg( ( h 1 (n (n), ), h 2 (n (n)) )) is also admissible and dominates its components D. D. None of the above CPSC 322, Lecture 6 Slide 6
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 CPSC 322, Lecture 3 Slide 7
Another other approach proach to to co construct nstruct heuristics uristics So Solutio tion n cost t for a subpro robl blem SubProblem Original Problem 1 3 1 3 8 2 5 @ 2 @ 7 6 4 @ @ 4 Current node 1 2 3 1 2 3 @ 4 8 4 @ @ @ 7 6 5 CPSC 322, Lecture 3 Slide 8 Goal node
Combining mbining Heurist uristics: ics: Exa xample mple In 8-puzzl zzle, e, soluti ution on cost st for the 1,2,3 2,3,4 ,4 subpr prob oble lem is substantially more accurate than sum of Manhattan distance of each tile from its goal position in some cases es So….. CPSC 322, Lecture 3 Slide 9
Adm dmis issible sible he heur uris istic tic fo for Vac acuu uum m wor orld ld? states? Where it is dirty and robot location actions? Left , Right , Suck Possible goal test? no dirt at all locations CPSC 322, Lecture 3 Slide 10
Adm dmis issible sible he heur uris istic tic fo for Vac acuu uum m wor orld ld? states? Where it is dirty and robot location actions? Left , Right , Suck Possible goal test? no dirt at all locations CPSC 322, Lecture 6 Slide 11
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* CPSC 322, Lecture 8 Slide 12
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 CPSC 322, Lecture 7 Slide 13
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(b m ) • Space complexity is O(b m ) CPSC 322, Lecture 7 Slide 14
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 CPSC 322, Lecture 8 Slide 15
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 ) CPSC 322, Lecture 6 Slide 16
A * Search rch Algorithm gorithm • 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. CPSC 322, Lecture 8 Slide 17
Computing mputing f-va values lues f-value of UBC KD JB? 6 9 10 11
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 CPSC 322, Lecture 6 Slide 19
Analysi alysis s of f A * Let's assume that arc costs are strictly positive. • Time complexity is O(b m ) • the heuristic could be completely uninformative and the edge costs could all be the same, meaning that A * does the same thing as…. DFS BFS LCFS • Space complexity is O(b m ) like ….., A * maintains a frontier which grows with the size of the tree • Completeness: yes. • Optimality: ?? CPSC 322, Lecture 8 Slide 20
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. CPSC 322, Lecture 8 Slide 21
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' CPSC 322, Lecture 8 Slide 22
Wh Why is A * optimal? (cont’) p p'' p' • 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. This contradicts our assumption that p' is the shortest path. CPSC 322, Lecture 8 Slide 23
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 of paths. CPSC 322, Lecture 8 Slide 24
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
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
Recommend
More recommend