AI3 Search
-
Upload
anindo-saka-fitri -
Category
Documents
-
view
216 -
download
0
Transcript of AI3 Search
-
8/17/2019 AI3 Search
1/48
-
8/17/2019 AI3 Search
2/48
-
8/17/2019 AI3 Search
3/48
FringeFringe
• Set of search nodes that hae not $een
e%panded yet
• &mplemented as a 'ueue F(&)*+ – &)S+(-node,F(&)*+.
– (+/01+-F(&)*+.
• he ordering of the nodes in F(&)*+defines the search strategy
-
8/17/2019 AI3 Search
4/48
Breadth-First StrategyBreadth-First Strategy
)e" nodes are inserted at the end of F(&)*+
2 3
4 5
1
6 7
FRINGE = (1)
-
8/17/2019 AI3 Search
5/48
Breadth-First StrategyBreadth-First Strategy
)e" nodes are inserted at the end of F(&)*+
FRINGE = (2, 3)2 3
4 5
1
6 7
3
-
8/17/2019 AI3 Search
6/48
-
8/17/2019 AI3 Search
7/48
Breadth-First StrategyBreadth-First Strategy
)e" nodes are inserted at the end of F(&)*+
FRINGE = (4, 5, 6, 7)2 3
4 5
1
6 7
5
-
8/17/2019 AI3 Search
8/48
e!th-First Strategye!th-First Strategy
)e" nodes are inserted at the front of F(&)*+
1
2 3
4 5
FRINGE = (1)
6
-
8/17/2019 AI3 Search
9/48
e!th-First Strategye!th-First Strategy
)e" nodes are inserted at the front of F(&)*+
1
2 3
4 5
FRINGE = (2, 3)
7
-
8/17/2019 AI3 Search
10/48
e!th-First Strategye!th-First Strategy
)e" nodes are inserted at the front of F(&)*+
1
2 3
4 5
FRINGE = (4, 5, 3)
89
-
8/17/2019 AI3 Search
11/48
e!th-First Strategye!th-First Strategy
)e" nodes are inserted at the front of F(&)*+
1
2 3
4 5
88
-
8/17/2019 AI3 Search
12/48
e!th-First Strategye!th-First Strategy
)e" nodes are inserted at the front of F(&)*+
1
2 3
4 5
82
-
8/17/2019 AI3 Search
13/48
e!th-First Strategye!th-First Strategy
)e" nodes are inserted at the front of F(&)*+
1
2 3
4 5
8:
-
8/17/2019 AI3 Search
14/48
e!th-First Strategye!th-First Strategy
)e" nodes are inserted at the front of F(&)*+
1
2 3
4 5
8
-
8/17/2019 AI3 Search
15/48
e!th-First Strategye!th-First Strategy
)e" nodes are inserted at the front of F(&)*+
1
2 3
4 5
83
-
8/17/2019 AI3 Search
16/48
e!th-First Strategye!th-First Strategy
)e" nodes are inserted at the front of F(&)*+
1
2 3
4 5
84
-
8/17/2019 AI3 Search
17/48
e!th-First Strategye!th-First Strategy
)e" nodes are inserted at the front of F(&)*+
1
2 3
4 5
85
-
8/17/2019 AI3 Search
18/48
e!th-First Strategye!th-First Strategy
)e" nodes are inserted at the front of F(&)*+
1
2 3
4 5
86
-
8/17/2019 AI3 Search
19/48
;ontoh
-
8/17/2019 AI3 Search
20/48
"ni#orm-Cost Strategy"ni#orm-Cost Strategy
• Each step has some cost ε > 0.• he cost o! the path to each !"#$%e $o&e N #s
%(N) = Σ costs o! a'' steps.• he %oa' #s to %e$e"ate a so't#o$ path o! m#$#ma'• he ee FRINGE #s so"te& #$ #$c"eas#$% cost.
*0
1+
5
15-* G
+
-
5
1
15
10
5
5
G11
G10
29
-
8/17/2019 AI3 Search
21/48
In#ormed $%e&ristic'In#ormed $%e&ristic' SearchSearch
-
8/17/2019 AI3 Search
22/48
22
Search (ith omainSearch (ith omain
)no(ledge added)no(ledge added
• =ninformed -$lind. searches are normally
ery inefficient
• >dding domain #no"ledge can improe
the search process?
-
8/17/2019 AI3 Search
23/48
2:
Conce!t o# in#ormedConce!t o# in#ormed
$he&ristic' search$he&ristic' search
• !euristic -informed. search @A e%plore the
node that is most “li#ely” to $e the nearest
to a goal state?
• here is no guarantee that the heuristic
proided most “li#ely” node "ill get you
closer to a goal state than any other?
-
8/17/2019 AI3 Search
24/48
2
)no(ledge*in#o)no(ledge*in#o
• +%ample
– 1isit the doctor
• Symptoms feer, nausea, headache, C
– eading 'uestions ho" longE, traeledE, C
-/alaria, typhoid, meningitis, flu,??.
– % Blood test, y test,???
-
8/17/2019 AI3 Search
25/48
23
)no(ledge*in#o)no(ledge*in#o
• +%ample
– ;lim$ing a hill in thic# Fog
• !euristic function chec# the change in altitude in
directions the strongest increase is the direction in"hich to moe ne%t?
-
8/17/2019 AI3 Search
26/48
24
%e&ristic Search +ethods%e&ristic Search +ethods
• /ethods that use a heuristic function to
proide specific #no"ledge a$out the
pro$lem• !euristic Functions
• !ill clim$ing
• *reedy search
• >G search algorithm
-
8/17/2019 AI3 Search
27/48
25
%ill clim,ing on a s&r#ace o#%ill clim,ing on a s&r#ace o#
statesstates
!eight Defined $y+aluation
Function
-
8/17/2019 AI3 Search
28/48
26
!ill clim$ing!ill clim$ing
• Steepest descent -H greedy $est@first "ith
no search. may get stuc# into local
minimum
-
8/17/2019 AI3 Search
29/48
27
Ro,ot NaigationRo,ot Naigation
f-). I h-). I straight distance to the goal
Local-minim&m !ro,lem
-
8/17/2019 AI3 Search
30/48
:9
%ill clim,ing e.am!le%ill clim,ing e.am!le2 8 3
1 6 4
7 5
2 8 31 4
7 6 5
2 3
1 8 4
7 6 5
1 3
8 4
7 6 5
2
3
1 8 4
7 6 5
2
1 3
8 4
7 6 5
2
start goal
-5
h = -3
h = -3h = -2
h = -1
h = 0h = -4
-5
-4
-4
-3
-2
f(n) = -(number of tiles out of place)
-
8/17/2019 AI3 Search
31/48
:8
E.am!le o# a local ma.im&mE.am!le o# a local ma.im&m
1 2 5
7 4
8 6 3
1 2 5
7 4
8 6 3
1 2 5
7 4
8 6 3
1 2 5
7 4
8 6 3
1 2 5
7 4
8 6 3
-3
-4
-4
-4
0
start goal
-
8/17/2019 AI3 Search
32/48
:2
Greedy SearchGreedy Search
• f-). I h-). greedy $est@first
-
8/17/2019 AI3 Search
33/48
::
Ro,ot NaigationRo,ot Naigation
-
8/17/2019 AI3 Search
34/48
:
Ro,ot NaigationRo,ot Naigation
9 288
36 5
5
:
5
4
5
4 : 2
6
4
3
2: :
:4 3 2 : 3
3 4
3
4
3
f-). I h-)., "ith h-). I /anhattan distance to the goal
-
8/17/2019 AI3 Search
35/48
:3
Ro,ot NaigationRo,ot Naigation
9 288
36 5
5
:
5
4
5
4 : 2
6
4
3
2: :
:4 3 2 : 3
3 4
3
4
3
f-). I h-)., "ith h-). I /anhattan distance to the goal
5
9
What ha!!ened///
-
8/17/2019 AI3 Search
36/48
:4
%e&ristic Searches -%e&ristic Searches - GreedyGreedy
searchsearch
• So named as it ta#es the $iggest “$ite” it can out
of the pro$lem?
hat is, it see#s to minimise the estimated cost
to the goal $y e%panding the node estimated to$e closest to the goal state
in other "ords,• >l"ays e%pand the heuristically $est nodes first?
-
8/17/2019 AI3 Search
37/48
:5
Greedy search algorithmGreedy search algorithm
1.1. QUEUEQUEUE
-
8/17/2019 AI3 Search
38/48
:6
%e&ristic Searches - Greedy%e&ristic Searches - Greedy
SearchSearch
• &t is only concerned "ith short term aims
• &t is possi$le to get stuc# in an infinite loop, unless
you chec# for repeated states
• &t is not optimal
• &t is not complete
Time and s!ace com!le.ity is 0$Bm'1 (here m is thede!th o# the search tree
-
8/17/2019 AI3 Search
39/48
:7
+ore in#ormed search+ore in#ormed search
• Je #ept loo#ing at nodes closer and closer to thegoal, $ut "ere accumulating costs as "e gotfurther from the initial state
• 0ur goal is not to minimize the distance from thecurrent head of our path to the goal, "e "ant tominimize the overall length of the path to the goalK
• et g-). $e the cost of the $est path found so far $et"een the initialnode and )
• f-). I g-). L h-).
-
8/17/2019 AI3 Search
40/48
9
Ro,ot NaigationRo,ot Naigation
f-). I g-).Lh-)., "ith h-). I /anhattan distance to goal
9 288
36 5
5
:
5
4
5
4 : 2
6
4
3
2: :
:4 3 2 : 3
3 4
3
4
35L9
4L8
4L8
6L8
5L9
5L2
4L8
5L2
4L8
6L8
5L2
6L:
5L2 4L:4L: 3L3L L3L3 :L4:L4 2L5
6L: 5L5L 4L3
3L4
4L: 3L4
2L5 :L6
L5
3L4 L5
:L6
L5 :L6:L6 2L72L7 :L89
2L7
:L6
2L7 8L898L89 9L88
-
8/17/2019 AI3 Search
41/48
8
A2 SearchA2 Search
• +aluation function
f-). I g-). L h-).
"here
– g-). is the cost of the $est path found so far to ) – h-). is an admissi$le heuristic
• hen, $est@first search "ith this ealuation function iscalled >G search
• &mportant >& algorithm deeloped $y Fi#es and )ilsson inearly 59s? 0riginally used in Sha#ey ro$ot?
-
8/17/2019 AI3 Search
42/48
2
Ro,ot naigationRo,ot naigation
;ost of one horizontalMertical step I 8
;ost of one diagonal step I √2
f-). I g-). L h-)., "ith h-). I straight@line distance from ) to goal
-
8/17/2019 AI3 Search
43/48
:
E.am!le road ma!E.am!le road ma!
• &magine the pro$lem of finding a route on a road mapand that the )+ $elo" is the road map
DD EE
GG
SS
AA BB CC
FF
))
))22
// //
DD EE
GGSS
AA BB CC
FF
0.0.1.1.
1111
3.43.40.40.4 ))
Define f-. I the straight@line distance from to *
+he estimate+he estimatecan 5e %rong6can 5e %rong6
R d lRoad ma! e am!le
-
8/17/2019 AI3 Search
44/48
Road ma! e.am!leRoad ma! e.am!le(e@introduce the costs of paths in the )+
AA
77
EE
88
**
99
))
// //
))22
AA
77 EEAA
88 EE EE 77 77 **
** 77 ** 88 EE AA 88 99
99 88 99 **
99
))
)) ))
))
))
22
22
22
////
// //
////
A2 Algorithm E.am!leA2 Algorithm E.am!le
-
8/17/2019 AI3 Search
45/48
3
A Algorithm E.am!leA Algorithm E.am!le
road ma!road ma!
• &magine the pro$lem of finding a route on a road map? hepaths distances $et"een nodes define g-n.
DD EE
GG
SS
AA BB CC
FF
))
))22
// //
DD EE
GGSS
AA BB CC
FF
0.0.1.1.
1111
3.43.40.40.4 ))
Define h-n. I the straight@line distance from node to *
-
8/17/2019 AI3 Search
46/48
4
AA DD) : 1. 1).) : 1. 1). : 3.4 12.4 : 3.4 12.4
SS
SS
AA DD
AA EE
1).1).
4 : 1. 14.4 : 1. 14. 0 : 0.4 12.40 : 0.4 12.4
SS
AA DD
AA EE
BB FF
1).1).
11 : 0. 1.11 : 0. 1. 1 : ). 1).1 : ). 1).
SS
AA DD
AA EE
BB FF
1).1).
1.1.
GG 1) : . 1).1) : . 1).
+"=6+"=6
-
8/17/2019 AI3 Search
47/48
Re#erenceRe#erence
Russel, Stuart J., Peter Norvig,
!rti"i#ial $%tellige%#e, a &o'er%
a((roa#h), Se#o%' *'itio%, Pre%ti#e
+all, Ne Jerse, 2010.
i%sto%, Patri#/ +e%r, !rti"i#ial
$%tellige%#e), !''iso% esle.
-
8/17/2019 AI3 Search
48/48
ERIMAERIMA
KASIH
ASIH