151
1

هوش مصنوع ي

Embed Size (px)

DESCRIPTION

هوش مصنوع ي. فصل چهارم. جست و جوی آگاهانه و اکتشاف. هوش مصنوع ي Artificial Intelligence. فهرست. متدهای جست و جوی آگاهانه يادگيری برای جست و جوی بهتر جست و جوی محلی و بهينه سازی جست و جوی محلی در فضاهای پيوسته عاملهای جست و جوی Online. انواع استراتژی های جستجوی آگاهانه. - PowerPoint PPT Presentation

Citation preview

  • *

  • Artificial Intelligence Online

  • 1) 2) A * 1)IDA * 2)MA * 3)SMA * 1) 2)3) 4)

  • g(n) : n h(n) : n h*(n) : n f(n) : nf(n): g(n) + h(n)f*(n) : n f*(n): g(n) + h*(n)

  • Best first searchfunction Best-First-Search(problem,Eval-FN) returns solution sequencenodes := Make-Queue(Make-Node(Initial-State(problem))loop do if nodes is empty then return failure node := Remove-Front(nodes) if Goal-Test[problem] applied to State(node) succeeds then return node new-nodes := Expand(node, Operarors[problem], Eval-FN))) nodes := Insert-by-Cost(new-nodes,Eval-FN(new-node))end

  • *Best-first searchIdea: use an evaluation function f(n) for each nodeestimate of "desirability"Expand most desirable unexpanded node

    Implementation:Order the nodes in fringe in decreasing order of desirability

    Special cases:greedy best-first searchA* search

  • Example: Tourist226

  • ABC230185350200 :

  • *Greedy best-first searchEvaluation function f(n) = h(n) (heuristic) = estimate of cost from n to goale.g., hSLD(n) = straight-line distance from n to BucharestGreedy best-first search expands the node that appears to be closest to goal

  • *Greedy best-first search example

  • *Greedy best-first search example

  • *Greedy best-first search example

  • *Greedy best-first search example

  • Example

  • *Properties of greedy best-first searchComplete? No can get stuck in loops, e.g., Tehran Karaj Tehran Karaj Time? O(bm), but a good heuristic can give dramatic improvementSpace? O(bm) -- keeps all nodes in memoryOptimal? No

  • ABCDEFGHIKMLNO3PQJWVXYZRSTU1121332323231112321113231253013231221121021312332

  • ABCDEFGNO3X11211113125303132

  • AFGHIMLNOPQWVXYZRSTU13323231112321113233231221121021312333

  • A

  • : h = h* : h = h* : h = h* : h = h* ::

  • *A* searchIdea: avoid expanding paths that are already expensiveEvaluation function f(n) = g(n) + h(n)g(n) = cost so far to reach nh(n) = estimated cost from n to goalf(n) = estimated total cost of path through n to goal

  • A*f(n)=g(n) + h(n)

  • *Romania with step costs in km

  • A* Bucharest Aradf(Arad) = g(Arad)+h(Arad)=0+366=366

  • A* Arad f(n) :f(Sibiu)=c(Arad,Sibiu)+h(Sibiu)=140+253=393f(Timisoara)=c(Arad,Timisoara)+h(Timisoara)=118+329=447f(Zerind)=c(Arad,Zerind)+h(Zerind)=75+374=449 Sibiu

  • A* Sibiu f(n) :f(Arad)=c(Sibiu,Arad)+h(Arad)=280+366=646f(Fagaras)=c(Sibiu,Fagaras)+h(Fagaras)=239+179=415f(Oradea)=c(Sibiu,Oradea)+h(Oradea)=291+380=671f(Rimnicu Vilcea)=c(Sibiu,Rimnicu Vilcea)+ h(Rimnicu Vilcea)=220+192=413 Rimnicu Vilcea

  • A* Rimnicu Vilcea f(n) :f(Craiova)=c(Rimnicu Vilcea, Craiova)+h(Craiova)=360+160=526f(Pitesti)=c(Rimnicu Vilcea, Pitesti)+h(Pitesti)=317+100=417f(Sibiu)=c(Rimnicu Vilcea,Sibiu)+h(Sibiu)=300+253=553 Fagaras

  • A* Fagaras f(n) :f(Sibiu)=c(Fagaras, Sibiu)+h(Sibiu)=338+253=591f(Bucharest)=c(Fagaras,Bucharest)+h(Bucharest)=450+0=450 Pitesti !!!

  • A* Pitesti f(n) :f(Bucharest)=c(Pitesti,Bucharest)+h(Bucharest)=418+0=418

    Bucharest !!!

  • A*A/5

  • A*A/5B/1C/4D/5E/1F/3G/2H/2I/3K/0M/2L/3N/1O/32P/3Q/1J/1W/1V/2X/0Y/2Z/1R/2S/2T/1U/1111133332323111232111323

  • A* A/5

  • A* A/5B/1C/9D/5E/1F/3G/2H/2I/3K/0M/2L/3N/1O/32P/3Q/1J/1W/1V/2X/0Y/2Z/1R/2S/2T/1U/1111133332323111232111323

  • A* A/5

  • *Admissible heuristicsA heuristic h(n) is admissible if for every node n,h(n) h*(n), h*(n): true cost to reach the goal state from nAn admissible heuristic never overestimates the cost to reach the goal, i.e., it is optimisticExample: hSLD(n) (never overestimates the actual road distance)Theorem: If h(n) is admissible, A* using TREE-SEARCH is optimal

  • h h*h h*/ A*

  • A*h h*h h*/

  • *Consistent heuristicsA heuristic is consistent if for every node n, every successor n' of n generated by any action a,

    h(n) c(n,a,n') + h(n')

    If h is consistent, we havef(n') = g(n') + h(n') = g(n) + c(n,a,n') + h(n') g(n) + h(n) = f(n)

    i.e., f(n) is non-decreasing along any path.Theorem: If h(n) is consistent, A* using GRAPH-SEARCH is optimal

  • A* 6 : h(n) :

    h(n) < C(n , a , n ) + h( n )SG1nnC(n , a , n ) n a n

  • A* : h(n) :h(A) < C(A , a , B) +h(B) => 2 < 1 + 3 => 2 < 4 True2E1G0F1D21421113233B32A1Ch(A) < C(A , a , C) +h(C) => 2 < 4 + 1 => 2 < 5 True

  • A* pathmax :G1nn

  • : 2G0F1D214111B47A1C :

  • A* : : : h = h* : h = h*

  • SibiuAradFagarasOradeaRimnicuTimisoaraZerindArad`646=280+366671=291+380413=220+193477=118+329449=75+374526=366+160417=317+100Craiova366=0+366393=140+253415=239+176Pitesti553=300+253Sibiu591=338+253450=450+0SibiuBucharestOptimal:418=418+0Bucharest615=455+160CraiovaRimnicu607=414+193

  • :

  • *A* search example

  • *A* search example

  • *A* search example

  • *A* search example

  • *A* search example

  • *A* search example

  • * A*IDA*RBFSSMA*

  • (Contour): L f L .418415417413393366

  • : (IDS)

  • *Iterative deepening search l =0

  • *Iterative deepening search l =1

  • *Iterative deepening search l =2

  • *Iterative deepening search l =3

  • IDA* IDS A*:(IDA*=IDS+A*) A* f . (Depth-Limit) f (f-limit) f - f-limit . f-limit .

  • IDA*Ah = 8g = 8BC551010DE501010HI501016FG2088JK058 1f-limit = 8Af = 8BC1513DE2520FG1824JK2429 2f-limit = 13 3f-limit = 15 4f-limit = 18 5f-limit = 20E f f-limit . 1 f-limit f . f f-limit .

    : .f-limit f . . f-limit .

    f f-limit .

  • (Recursive Best-First Search)RBFS: () A* f . f ( ) f ( ) f .

  • RBFS f . . O(bd) .

  • RBFSRBFS IDA* . IDA* RBFS . . IDA* RBFS . IDA* f . RBFS

  • SMA* SMA* . SMA* . , . SMA*

  • SMA* f SMA* SMA* .

  • SMA* A* f . f . ( ) f f . f Max f f

  • : SMA*

  • . f . f f () . ( ) Max .

    f f .

    SMA*

    Ah = 8g = 8BC551010DE501010HI501016FG2088JK058 1 A 2 B Af = 8BC1513DE2520FG1824E 3 C 5 G 13 4 F 13 (15)Max13 (Max)15 (15)241515 (24)Max15 (Max)20 (24) f f . 6 B 7 D 8 E : 24 (Max)20 (Max)

  • SMA* :

    . . . . . Optimally efficient .

  • 8 22 3 . 22 :

  • 8

  • 8

    , . .

  • 8 .

    36

  • h 8 :h2: .h1: .ABCD4h2(A) = h2(B) = h2(C) = h2(D) = h1(A) = h1(B) = h1(C) = h1(D) = ????????3801+1+2+1=53+3+2=880 . ..

    12374856

    12384765

    12384765

    12634785

    12783654

  • : -8 h1 h2

    h1: .h2: .g: ( ).

    12384765

    2831647-5

  • - () h2 h1 :

    h2 h1

  • - b* A* N d b* d N+1

    b* 1

  • : 8

  • . . :1) .2) .

  • . . . ( ) :

  • !!

    : 8

  • . . . .

  • : .

  • ( ) . :

  • :

    : 8 8 8 : :

  • - h=17 h - 8 h=1

  • . V1V2V3V4V5V6V7V8 =

  • V1V2V3V4V5V6V7V8{ V1 , V2 }{ V1 , V3 }{ V2 , V3 }{ V2 , V6 }{ V2 , V8 }{ V1 , V5 }{ V2 , V4 }{ V3 , V5 }{ V4 , V5 }{ V4 , V6 }{ V4 , V7 }{ V5 , V6 }{ V5 , V7 }{ V6 , V7 }{ V7 , V8}{ V3 , V7 }{ V6 , V8 }h( ) = 17

  • V1V2V3V4V5V6V7V8h( ) = ?

  • V1V2V3V4V5V6V7V8{ V1 , V3 }{ V1 , V5 }{ V3 , V5 }{ V4 , V5 }{ V4 , V6 }{ V4 , V7 }{ V5 , V6 }{ V5 , V7 }{ V6 , V7 }{ V7 , V8 }{ V3 , V7 }{ V6 , V8 }h( ) = 12

  • V1V3V4V5V6V7V81812141313121414141613151214121614181315121414V2121514131613161417151416161417161815151815151416141413171214121814

  • !! :

  • : ( ) .

  • : .

  • : . :

    1 )

    2 )

  • : ( ) ( )

  • k : k : k k k k

  • *Genetic algorithms

    Fitness function: number of non-attacking pairs of queens (min = 0, max = 8 7/2 = 28)

    24/(24+23+20+11) = 31%

    23/(24+23+20+11) = 29% etc

  • *Genetic algorithms

  • :

  • Online (Offline): (Online): : ,

  • Online Actions(s): s c(s,a,s): s Goal-Test(s): h(s)

  • Online : G : :

  • Online Online .

  • Online Online

  • *

    *****