He Heur uristic c Sea earc rch: : Be Best stFS FS an and d - - PowerPoint PPT Presentation

he heur uristic c sea earc rch be best stfs fs an and
SMART_READER_LITE
LIVE PREVIEW

He Heur uristic c Sea earc rch: : Be Best stFS FS an and d - - PowerPoint PPT Presentation

He Heur uristic c Sea earc rch: : Be Best stFS FS an and d A * Com omputer Science c cpsc sc322, Lecture 8 8 (Te Text xtboo ook k Chpt 3.6) May ay, 2 23, 2 2017 CPSC 322, Lecture 8 Slide 1 Lectu ture re Ov Overv rvie


slide-1
SLIDE 1

CPSC 322, Lecture 8 Slide 1

He Heur uristic c Sea earc rch: : Be Best stFS FS an and d A*

Com

  • mputer Science c

cpsc sc322, Lecture 8 8 (Te Text xtboo

  • ok

k Chpt 3.6)

May ay, 2 23, 2 2017

slide-2
SLIDE 2

CPSC 322, Lecture 8 Slide 2

Lectu ture re Ov Overv rvie iew

  • Re

Recap p / Fi Finis ish He Heuris isti tic Fu Functi tion

  • n
  • Best

st Fi First st Se Search

  • A*
slide-3
SLIDE 3

CPSC 322, Lecture 6 Slide 3

Ho How to to Co Comb mbin ine He Heuri rist stic ics

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

  • A. min( h1(n), h2(n)) is also admissible and dominates

its components B.

  • B. su

sum( 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. No

None of the above

slide-4
SLIDE 4

CPSC 322, Lecture 3 Slide 4

Co Comb mbin inin ing g Admi miss ssib ible le He Heuri rist stic ics

Ho How to

  • com
  • mbine h

heurist stics s when t there is s no

  • dom
  • minance?

If h1(n) is admissible and h2(n) is also admissible then h(n)= ____________________________is also admissible … and dominates all its components

slide-5
SLIDE 5

CPSC 322, Lecture 3 Slide 5

Exa xamp mple le He Heuri rist stic ic Fu Functi tion

  • 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-6
SLIDE 6

CPSC 322, Lecture 3 Slide 6

Anot

  • ther

r appro roach to to con

  • nst

stru ruct t heuri rist stic ics

Sol

  • lution
  • n cos
  • st for
  • r a su

subprob

  • 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-7
SLIDE 7

CPSC 322, Lecture 3 Slide 7

Co Comb mbin inin ing g He Heuri rist stic ics: s: Exa xamp mple le

In In 8-puzz zzle, s , sol

  • lution
  • n cos
  • st for
  • r the 1,2

,2,3 ,3,4 ,4 su subproblem is substantially more accurate than sum of Manhattan distance of each tile from its goal position in so some case ses So…..

slide-8
SLIDE 8

CPSC 322, Lecture 3 Slide 8

Adm dmis issib ible le heuris istic ic fo for Va Vacuum wo world ld?

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

slide-9
SLIDE 9

CPSC 322, Lecture 6 Slide 9

Adm dmis issib ible le heuris istic ic fo for Va Vacuum wo world ld?

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

slide-10
SLIDE 10

CPSC 322, Lecture 8 Slide 10

Lectu ture re Ov Overv rvie iew

  • Re

Recap p He Heuris isti tic Fu Functi tion

  • n
  • Best

st Fi First st Se Search

  • A*
slide-11
SLIDE 11

CPSC 322, Lecture 7 Slide 1 1

Be Best st-Fi Firs rst t Se Sear arch

  • Id

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

  • Be

Best st-Fi First st se search 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-12
SLIDE 12

CPSC 322, Lecture 7 Slide 12

Anal alys ysis is of

  • f Be

Best st-Fi Firs rst t Se Sear 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-13
SLIDE 13

CPSC 322, Lecture 8 Slide 13

Lectu ture re Ov Overv rvie iew

  • Re

Recap p He Heuris isti tic Fu Functi tion

  • n
  • Best

st Fi First st Se Search

  • A* Search Strategy
slide-14
SLIDE 14

CPSC 322, Lecture 6 Slide 14

Ho How can an we eff ffecti tive vely 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-15
SLIDE 15

CPSC 322, Lecture 8 Slide 15

  • A* is a mix of:
  • lowest-cost-fi

first and

  • best-first se

t sear arch

  • 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* Se Sear arch Alg lgor

  • rit

ithm

slide-16
SLIDE 16

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

Co Comp mputi ting g f-va valu lues s

slide-17
SLIDE 17

CPSC 322, Lecture 6 Slide 17

Anal alys ysis is of

  • f 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-18
SLIDE 18

CPSC 322, Lecture 8 Slide 18

Anal alys ysis is of

  • f A*

Let's assume that arc costs are strictly positive.

  • T

ime 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-19
SLIDE 19

CPSC 322, Lecture 8 Slide 19

Op Opti tima mali lity ty 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 If A* selects a path p as the solution, p is the shortest (i.e., lowest-cost) path.

slide-20
SLIDE 20

CPSC 322, Lecture 8 Slide 20

Why y is is A* op

  • pti

tima mal? l?

  • 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-21
SLIDE 21

CPSC 322, Lecture 8 Slide 21

Why y is 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-22
SLIDE 22

CPSC 322, Lecture 8 Slide 22

Opti timal al eff ffic icie iency y of

  • f A*
  • In fact, we can prove something even stronger about

A*: in a sense (given the particular heuristic that is available) no

  • se

search algo gorithm cou

  • uld do
  • better!
  • Optimal Efficiency: Among all op
  • ptimal algo

gorithms s that st start from

  • m the sa

same st start nod

  • de and use

se the sa same heurist stic h, A* expands the minimal number of paths.

slide-23
SLIDE 23

Sa Samp mple les s A* * ap appli lica cati tion

  • ns
  • An

An Efficient A* A* Search Al Algo gorithm Fo For Statist stical Machine Translation. 2001

  • Th

The Ge Generalize zed A* A* Ar

  • Architecture. Journal of Artificial

Intelligence Research (2007)

  • Machine Vision … Here we consider a new

compositional model for finding salient curves.

  • Fa

Factor

  • red A*

A*se search for

  • r mod
  • dels

s ov

  • ver se

sequences a s and trees 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 23

slide-24
SLIDE 24

Samples A* applications (cont’)

Aker, A., Cohn, T., Gaizauskas, R.: Multi-doc

  • cument

su summariza zation

  • n usi

sing g A* A* se search and d disc scriminative training.

  • g. Proceedings of the 2010 Conference on

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

CPSC 322, Lecture 8 Slide 24

slide-25
SLIDE 25

Samples A* applications (cont’)

EMNLP 2014 A* A* CCG G Parsi sing g with a Supertag- factored Mod

  • del M. Lewis, M. Steedman

We introduce a new CCG parsing model which is factored on lexical category

  • assignments. Parsing is then simply a deterministic search for the most

probable category sequence that supports a CCG derivation. The parser is extremely simple, with a tiny feature set, no POS tagger, and no statistical model of the derivation or dependencies. Formulating the model in this way allows a highly effective heuristic for A∗ parsing, which makes parsing extremely fast. Compared to the standard C&C CCG parser, our model is more accurate out-of-domain, is four times faster, has higher coverage, and is greatly simplified. We also show that using our parser improves the performance of a state-of-the-art question answering system

Follow up ACL 2017 (main NLP conference – will be in Vancouver in August!) A* C CCG Par arsing with th a a Superta tag an and D Dependency y Fac acto tored Model Masashi Yoshikawa, Hiroshi Noji, Yuji Matsumoto

CPSC 322, Lecture 8 Slide 25

slide-26
SLIDE 26

CPSC 322, Lecture 8 Slide 26

  • The

AI-Search animation system

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

DEPRECATED 

  • 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, BF BFS, S, A* Anim imat atio ion Exa xample le

  • 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-27
SLIDE 27

CPSC 322, Lecture 9 Slide 27

nPuzz zzle les s ar are n not

  • t al

alway ays s so solv lvab able le

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

  • So experiment with the AI-Search animation system

(DEPRECATED) with the default configurations.

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

unsolvable problems

slide-28
SLIDE 28

CPSC 322, Lecture 7 Slide 28

Learning Goals for today’s class

  • Define/read/write/trace/debug & Compare different

search algorithms

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

CPSC 322, Lecture 8 Slide 29

Ne Next xt cla lass ss

Finish Search (finish Chpt 3)

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