Heuris'c Searches recap Describing a state. En're state - - PowerPoint PPT Presentation

heuris c searches recap
SMART_READER_LITE
LIVE PREVIEW

Heuris'c Searches recap Describing a state. En're state - - PowerPoint PPT Presentation

Heuris'c Searches recap Describing a state. En're state space vs. incremental development. Elimina'on of children. the solu'on path. Genera'on


slide-1
SLIDE 1

Heuris'c ¡Searches ¡

slide-2
SLIDE 2

recap ¡

  • Describing ¡a ¡state. ¡
  • En're ¡state ¡space ¡vs. ¡incremental ¡
  • development. ¡
  • Elimina'on ¡of ¡children. ¡
  • the ¡solu'on ¡path. ¡
  • Genera'on ¡of ¡children. ¡
slide-3
SLIDE 3

Heuris'c ¡Search ¡

  • Heuris'cs ¡help ¡us ¡to ¡reduce ¡the ¡size ¡
  • f ¡the ¡search ¡space. ¡ ¡ ¡
  • An ¡evalua'on ¡func'on ¡is ¡applied ¡to ¡

each ¡goal ¡to ¡assess ¡how ¡promising ¡it ¡ is ¡in ¡leading ¡to ¡the ¡goal. ¡

  • Heuris'c ¡searches ¡incorporate ¡the ¡

use ¡of ¡domain-­‑specific ¡knowledge ¡in ¡ the ¡process ¡of ¡choosing ¡which ¡node ¡ to ¡visit ¡next ¡in ¡the ¡search ¡process. ¡

slide-4
SLIDE 4

Heuris'c ¡Search ¡

  • Search ¡methods ¡that ¡include ¡the ¡use ¡of ¡

domain ¡knowledge ¡in ¡the ¡form ¡of ¡ heuris'cs ¡are ¡described ¡as ¡“weak” ¡ search ¡methods. ¡ ¡ ¡

  • The ¡knowledge ¡used ¡is ¡“weak” ¡in ¡that ¡it ¡

may ¡help ¡but ¡does ¡not ¡always ¡help ¡to ¡ find ¡a ¡solu'on. ¡ ¡

  • Examples ¡of ¡heuris'c ¡searches ¡: ¡best ¡

first ¡search, ¡A* ¡algorithm, ¡hill-­‑climbing. ¡

. ¡

slide-5
SLIDE 5

Heuris'c ¡Search ¡

  • Heuris'c ¡searches ¡incorporate ¡the ¡use ¡
  • f ¡domain-­‑specific ¡knowledge ¡in ¡the ¡

process ¡of ¡choosing ¡which ¡node ¡to ¡visit ¡ next ¡in ¡the ¡search ¡process. ¡

  • Search ¡methods ¡that ¡include ¡the ¡use ¡of ¡

domain ¡knowledge ¡in ¡the ¡form ¡of ¡ heuris'cs ¡are ¡described ¡as ¡“weak” ¡ search ¡methods. ¡ ¡ ¡

  • The ¡knowledge ¡used ¡is ¡“weak” ¡in ¡that ¡it ¡

usually ¡helps ¡but ¡does ¡not ¡always ¡help ¡ to ¡find ¡a ¡solu'on. ¡

. ¡

slide-6
SLIDE 6

Calcula'ng ¡Heuris'cs ¡

  • Heuris'cs ¡are ¡rules ¡of ¡thumb ¡that ¡may ¡

find ¡a ¡solu'on ¡but ¡are ¡not ¡guaranteed ¡

  • to. ¡ ¡
  • Heuris'c ¡func'ons ¡have ¡also ¡been ¡

defined ¡as ¡evalua'on ¡func'ons ¡that ¡ es'mate ¡the ¡cost ¡from ¡a ¡node ¡to ¡the ¡ goal ¡node. ¡

  • The ¡incorpora'on ¡of ¡domain ¡knowledge ¡

into ¡the ¡search ¡process ¡by ¡means ¡of ¡ heuris'cs ¡is ¡meant ¡to ¡speed ¡up ¡the ¡ search ¡process. ¡

  • Heuris'c ¡func'ons ¡are ¡not ¡guaranteed ¡

to ¡be ¡completely ¡accurate. ¡ ¡ ¡

. ¡

slide-7
SLIDE 7

Calcula'ng ¡Heuris'cs ¡

  • Heuris'c ¡values ¡are ¡greater ¡than ¡and ¡

equal ¡to ¡zero ¡for ¡all ¡nodes. ¡

  • ¡Heuris'c ¡values ¡are ¡seen ¡as ¡an ¡

approximate ¡cost ¡of ¡finding ¡a ¡solu'on. ¡ ¡ ¡

  • A ¡heuris'c ¡value ¡of ¡zero ¡indicates ¡that ¡

the ¡state ¡is ¡a ¡goal ¡state. ¡

  • A ¡heuris'c ¡that ¡never ¡overes'mates ¡the ¡

cost ¡to ¡the ¡goal ¡is ¡referred ¡to ¡as ¡an ¡ admissible ¡heuris'c. ¡ ¡ ¡

  • Not ¡all ¡heuris'cs ¡are ¡necessarily ¡
  • admissible. ¡

¡

. ¡

slide-8
SLIDE 8

Calcula'ng ¡Heuris'cs ¡

  • A ¡heuris'c ¡value ¡of ¡infinity ¡indicates ¡that ¡

the ¡state ¡is ¡a ¡“deadend” ¡and ¡is ¡not ¡going ¡ to ¡lead ¡anywhere. ¡ ¡ ¡

  • A ¡good ¡heuris'c ¡must ¡not ¡take ¡long ¡to ¡
  • compute. ¡ ¡ ¡
  • Heuris'cs ¡are ¡oMen ¡defined ¡on ¡a ¡

simplified ¡or ¡relaxed ¡version ¡of ¡the ¡ problem, ¡e.g. ¡the ¡number ¡of ¡'les ¡that ¡are ¡

  • ut ¡of ¡place. ¡

. ¡

slide-9
SLIDE 9

Calcula'ng ¡Heuris'cs ¡

  • A ¡heuris'c ¡func'on ¡h1 ¡is ¡beOer ¡than ¡

some ¡heuris'c ¡func'on ¡h2 ¡if ¡fewer ¡ nodes ¡are ¡expanded ¡during ¡the ¡ search ¡when ¡h1 ¡is ¡used ¡than ¡when ¡ h2 ¡is ¡used. ¡

  • Experience ¡has ¡shown ¡that ¡it ¡is ¡

difficult ¡to ¡devise ¡heuris'c ¡func'ons. ¡ ¡ ¡

  • Furthermore, ¡heuris'cs ¡are ¡fallible ¡

and ¡are ¡by ¡no ¡means ¡perfect. ¡ ¡

. ¡

slide-10
SLIDE 10

Example: ¡8-­‑Puzzle ¡Problem ¡

. ¡

2 8 3 1 6 4 7 5 2 8 3 1 6 4 7 5 Goal State Initial State

slide-11
SLIDE 11

Heuris'cs ¡for ¡the ¡8-­‑Puzzle ¡Problem ¡

  • Number ¡of ¡'les ¡out ¡of ¡place ¡-­‑ ¡count ¡

the ¡number ¡of ¡'les ¡out ¡of ¡place ¡in ¡ each ¡state ¡compared ¡to ¡the ¡goal ¡. ¡

  • Sum ¡the ¡distance ¡that ¡the ¡'les ¡are ¡
  • ut ¡of ¡place. ¡
  • Tile ¡reversals ¡-­‑ ¡mul'ple ¡the ¡number ¡
  • f ¡'le ¡reversals ¡by ¡2. ¡

¡

. ¡

slide-12
SLIDE 12

Examples ¡8-­‑Puzzle ¡Problem ¡

. ¡

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

2 8 3 1 6 4 7 5

State

Tiles out

  • f place

Sum of

distances out

  • f place

2 x the number

  • f direct tile

reversals

5 6 3 4 5 6

slide-13
SLIDE 13

Best-­‑First ¡Search ¡

  • The ¡best-­‑first ¡search ¡is ¡a ¡general ¡search ¡

where ¡the ¡minimum ¡cost ¡nodes ¡are ¡ expanded ¡first. ¡ ¡ ¡

  • The ¡best-­‑ ¡first ¡search ¡is ¡not ¡guaranteed ¡

to ¡find ¡the ¡shortest ¡solu'on ¡path. ¡ ¡

  • The ¡best-­‑first ¡search ¡aOempts ¡to ¡

minimize ¡the ¡cost ¡of ¡finding ¡a ¡solu'on. ¡ ¡ ¡

  • Is ¡a ¡combina'on ¡of ¡the ¡depth ¡first-­‑

search ¡and ¡breadth-­‑first ¡search ¡with ¡ heuris'cs. ¡ ¡ ¡

. ¡

slide-14
SLIDE 14

Best-­‑First ¡Search ¡

. ¡

A

B3 E3

D2

H1

I99 C2

F2

J99

G4

K99

L3

Goal ¡States: ¡H, ¡L ¡

slide-15
SLIDE 15

Best ¡first ¡search ¡exercise ¡

A5 ¡to ¡B4 ¡and ¡C4 ¡ B4 ¡to ¡D6 ¡and ¡E5 ¡ ¡ ¡ C4 ¡to ¡F4 ¡and ¡G5 ¡ ¡ ¡ D6 ¡to ¡I7 ¡and ¡J8 ¡ ¡ ¡ I7 ¡to ¡K7 ¡and ¡L8 ¡ ¡ ¡ ¡ Start ¡state ¡: ¡A ¡ Goal ¡state ¡: ¡E ¡ ¡

. ¡

slide-16
SLIDE 16

Hill-­‑Climbing ¡

  • Hill-­‑climbing ¡is ¡similar ¡to ¡the ¡best ¡

first ¡search. ¡

  • While ¡the ¡best ¡first ¡search ¡considers ¡

states ¡globally, ¡hill-­‑climbing ¡ considers ¡only ¡local ¡states. ¡

  • The ¡hill-­‑climbing ¡algorithm ¡

generates ¡a ¡par'al ¡tree/graph. ¡

slide-17
SLIDE 17

Hill-­‑Climbing ¡

A

B3 E3

D2

H1

I99 C2

F2

J99

G4

K99

L3

Goal ¡States: ¡H, ¡L ¡

slide-18
SLIDE 18

Hill ¡climbing ¡exercise ¡

A ¡to ¡B3 ¡and ¡C2 ¡ B3 ¡to ¡D2 ¡and ¡E3 ¡ C2 ¡to ¡F2 ¡and ¡G4 ¡ D2 ¡to ¡H1 ¡and ¡I99 ¡ F2 ¡to ¡J99 ¡ G4 ¡to ¡K99 ¡and ¡L3 ¡ ¡ Start ¡state: ¡A ¡ Goal ¡state: ¡H, ¡L ¡

slide-19
SLIDE 19

Greedy ¡Hill-­‑Climbing ¡

  • Evaluate ¡the ¡ini'al ¡state. ¡
  • Select ¡a ¡new ¡operator. ¡
  • Evaluate ¡the ¡new ¡state ¡
  • If ¡it ¡is ¡closer ¡to ¡the ¡goal ¡state ¡than ¡the ¡

current ¡state ¡make ¡it ¡the ¡current ¡state. ¡

  • If ¡it ¡is ¡no ¡beOer ¡ignore ¡
  • If ¡the ¡current ¡state ¡is ¡the ¡goal ¡state ¡or ¡no ¡

new ¡operators ¡are ¡available, ¡quit. ¡ ¡ Otherwise ¡repeat ¡steps ¡2 ¡to ¡4. ¡

slide-20
SLIDE 20

Example ¡1: ¡Greedy ¡Hill-­‑Climbing ¡ without ¡Backtracking ¡

A

B4 E5

D2

H1

I99 C4

F2

J99

G4

K99

L3

Goal ¡States: ¡H, ¡L ¡

slide-21
SLIDE 21

Example ¡2: ¡Greedy ¡Hill-­‑Climbing ¡ with ¡Backtracking ¡

A

B3 E3

D2

H1

I99 C2

F2

J99

G4

K99

L3

Goal ¡States: ¡H, ¡L ¡

slide-22
SLIDE 22

Example ¡3: ¡Greedy ¡Hill-­‑Climbing ¡ without ¡Backtracking ¡

A

B3 E3

D2

H1

I99 C2

F2

J99

G4

K99

L3

Goal ¡States: ¡H, ¡L ¡

slide-23
SLIDE 23

A ¡Algorithm ¡

  • The ¡A ¡algorithm ¡is ¡essen'ally ¡the ¡best ¡

first ¡search ¡implemented ¡with ¡the ¡ following ¡func'on: ¡f(n) ¡= ¡g(n) ¡+ ¡h(n) ¡ – where ¡g(n) ¡-­‑ ¡measures ¡the ¡length ¡of ¡ the ¡path ¡from ¡any ¡state ¡n ¡to ¡the ¡start ¡ state ¡ – h(n) ¡-­‑ ¡is ¡the ¡heuris'c ¡measure ¡from ¡the ¡ state ¡n ¡to ¡the ¡goal ¡state ¡

slide-24
SLIDE 24

8-­‑Puzzle ¡Example ¡

1 4 3 7 6 5 8 g(n)=0 1 4 3 7 6 5 8 2 1 4 3 7 6 5 8 2 1 4 3 7 6 5 8 2 1 4 3 7 6 5 8 2 1 4 3 7 6 5 8 2 1 4 3 7 6 5 8 2 2 g(n)=1 g(n)=2 h(n)=no. of tiles out of place a) b) c) d) e) f) g)

f(a)=4+0=4 f(c)=3+1=4 f(b)=5+1=6 f(d)=5+1=6 f(e)=3+2=5 f(f)=3+2=5 f(g)=4+2=4

slide-25
SLIDE 25

Admissible ¡Algorithms ¡

  • Search ¡algorithms ¡that ¡are ¡guaranteed ¡to ¡find ¡the ¡

shortest ¡path ¡are ¡called ¡admissible ¡algorithms. ¡ ¡ ¡

  • The ¡breadth ¡first ¡search ¡is ¡an ¡example ¡of ¡an ¡

admissible ¡algorithm, ¡just ¡use ¡h(n)=0 ¡for ¡all ¡n. ¡ ¡ ¡

  • The ¡evalua'on ¡func'on ¡we ¡have ¡considered ¡with ¡

the ¡best ¡first ¡algorithm ¡is ¡ ¡f(n) ¡= ¡g(n) ¡+ ¡h(n), ¡

– where ¡g(n) ¡– ¡is ¡the ¡distance ¡from ¡the ¡start ¡node ¡to ¡some ¡ node ¡n, ¡e.g. ¡the ¡depth ¡at ¡which ¡the ¡state ¡n ¡is ¡found. ¡ – if ¡the ¡heuris'c ¡measure ¡h(n) ¡<= ¡h*(n) ¡, ¡the ¡op'mal ¡ distance ¡from ¡n ¡to ¡a ¡goal ¡, ¡then ¡the ¡A ¡algorithm ¡is ¡op'mal ¡ and ¡denoted ¡A* ¡

slide-26
SLIDE 26

Admissible ¡Heuris'c ¡and ¡the ¡8-­‑ Puzzle ¡Problem ¡

  • The ¡heuris'c ¡that ¡we ¡have ¡developed ¡for ¡

the ¡8-­‑ ¡puzzle ¡problem ¡are ¡bounded ¡above ¡by ¡ the ¡number ¡of ¡moves ¡required ¡to ¡move ¡to ¡ the ¡goal ¡posi'on. ¡ ¡ ¡

  • The ¡number ¡of ¡'les ¡out ¡of ¡place ¡and ¡the ¡

sum ¡of ¡the ¡distance ¡from ¡each ¡correct ¡'le ¡ posi'on ¡is ¡less ¡than ¡the ¡number ¡of ¡required ¡ moves ¡to ¡move ¡to ¡the ¡goal ¡state. ¡ ¡ ¡

  • Thus, ¡the ¡best ¡first ¡search ¡applied ¡to ¡the ¡8-­‑

puzzle ¡using ¡these ¡heuris'cs ¡is ¡in ¡fact ¡an ¡A* ¡

  • algorithm. ¡(see ¡paper ¡from ¡website) ¡