1 / 151

هوش مصنوع ي

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

Télécharger la présentation

هوش مصنوع ي

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. هوش مصنوعي فصل چهارم جست و جوی آگاهانه و اکتشاف

  2. هوش مصنوعيArtificial Intelligence فهرست • متدهای جست و جوی آگاهانه • يادگيری برای جست و جوی بهتر • جست و جوی محلی و بهينه سازی • جست و جوی محلی در فضاهای پيوسته • عاملهای جست و جوی Online

  3. انواع استراتژی های جستجوی آگاهانه 1) جستجوی حریصانه جستجوی اول بهترین A * 2) جستجوی IDA * 1) جستجوی حافظه محدود شده MA * 2) SMA * 3) تپه نوردی 1) سرد و گرم 2) جستجوی محلی ژنتیک 3) پرتو 4)

  4. جست و جوی آگاهانه و اکتشاف تعاريف • تابع هزينه مسير، g(n) : هزينه مسير از گره اوليه تا گره n • تابع اکتشافی، h(n) :هزينه تخمينی ارزان ترين مسير از گره n به گره هدف • تابع بهترين مسير، h*(n) : ارزان ترين مسير از گره n تا گره هدف • تابع ارزيابي، f(n) : هزينه تخمينی ارزان ترين مسير از طريق n f(n): g(n) + h(n) • f*(n) : هزينه ارزان ترين مسير از طريقnf*(n): g(n) + h*(n)

  5. Best first search function Best-First-Search(problem,Eval-FN) returns solution sequence nodes := 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 returnnode new-nodes := Expand(node, Operarors[problem], Eval-FN))) nodes := Insert-by-Cost(new-nodes,Eval-FN(new-node)) end

  6. Best-first search Idea: use an evaluation functionf(n) for each node estimate of "desirability" Expand most desirable unexpanded node Implementation: Order the nodes in fringe in decreasing order of desirability Special cases: greedy best-first search A* search 7

  7. Example: Tourist 226

  8. یک مثال از تابع هیورستیک در یک مسله مسیر یابی داریم : B 230 185 A 350 200 C

  9. Greedy best-first search Evaluation function f(n) = h(n) (heuristic) = estimate of cost from n to goal e.g., hSLD(n) = straight-line distance from n to Bucharest Greedy best-first search expands the node that appears to be closest to goal 10

  10. Greedy best-first search example 11

  11. Greedy best-first search example 12

  12. Greedy best-first search example 13

  13. Greedy best-first search example 14

  14. Example

  15. Properties of greedy best-first search Complete? No – can get stuck in loops, e.g., Tehran  Karaj  Tehran  Karaj  Time?O(bm), but a good heuristic can give dramatic improvement Space?O(bm) -- keeps all nodes in memory Optimal? No 16

  16. جست و جوی آگاهانه و اکتشاف جستجوی حريصانه A 3 1 2 1 B C 1 1 2 1 3 3 5 2 D E F G 1 3 3 2 1 2 1 3 1 2 3 2 1 3 3 J H I K L M N O 2 2 3 0 2 3 3 3 2 1 3 1 3 P Q R S T U V W X Y Z 1 2 1 2 2 1 0 2 1 1

  17. 1 4 3 2 5      جست و جوی آگاهانه و اکتشاف جستجوی حريصانه A 3 1 2 1 B C 1 1 2 1 3 3 5 2 D E F G 1 3 3 1 N O 1 X 0

  18. 2 1 4 1 B C 1 1 1 5 D E 3 3 1 J K 0 جست و جوی آگاهانه و اکتشاف جستجوی حريصانه A 1 1 3 3 F G 1 3 1 2 1 3 2 3 2 1 3 3 H I L M N O 2 2 3 2 3 3 3 2 1 3 1 3 P Q R S T U V W X Y Z 1 2 1 2 2 1 0 2 1 1

  19. 2 1 3 1 2    4 1 B C 1 1 1 5 D E 3 3 1 J K 0 جست و جوی آگاهانه و اکتشاف جستجوی حريصانه A

  20. جست و جوی آگاهانه و اکتشاف جستجوی حريصانه • کامل بودن: • کامل بودن:خير • اما اگر h = h* آنگاه جستجو کامل ميشود • بهينگی:خير • اما اگر h = h* آنگاه جستجو بهينه ميشود • پيچيدگي زماني: • اما اگر h = h* آنگاه • پيچيدگی فضا: • اما اگر h = h* آنگاه • بهينگی:

  21. A* search Idea: avoid expanding paths that are already expensive Evaluation function f(n) = g(n) + h(n) g(n) = cost so far to reach n h(n) = estimated cost from n to goal f(n) = estimated total cost of path through n to goal 22

  22. جست و جوی آگاهانه و اکتشاف مثال ديگر از جستجوی A* f(n)=g(n) + h(n)

  23. Romania with step costs in km 24

  24. جست و جوی آگاهانه و اکتشاف جستجوی A* در نقشه رومانی جستجوی Bucharest با شروع از Arad f(Arad) = g(Arad)+h(Arad)=0+366=366

  25. جست و جوی آگاهانه و اکتشاف جستجوی A* در نقشه رومانی • ََArad را باز کرده و f(n) را برای هر يک از زيربرگها محاسبه ميکنيم: • f(Sibiu)=c(Arad,Sibiu)+h(Sibiu)=140+253=393 • f(Timisoara)=c(Arad,Timisoara)+h(Timisoara)=118+329=447 • f(Zerind)=c(Arad,Zerind)+h(Zerind)=75+374=449 • بهترين انتخاب شهر Sibiu است

  26. جست و جوی آگاهانه و اکتشاف جستجوی A* در نقشه رومانی • ََSibiu را باز کرده و f(n) را برای هر يک از زيربرگها محاسبه ميکنيم: • f(Arad)=c(Sibiu,Arad)+h(Arad)=280+366=646 • f(Fagaras)=c(Sibiu,Fagaras)+h(Fagaras)=239+179=415 • f(Oradea)=c(Sibiu,Oradea)+h(Oradea)=291+380=671 • f(Rimnicu Vilcea)=c(Sibiu,Rimnicu Vilcea)+ h(Rimnicu Vilcea)=220+192=413 • بهترين انتخاب شهر Rimnicu Vilcea است

  27. جست و جوی آگاهانه و اکتشاف جستجوی A* در نقشه رومانی • ََRimnicu Vilcea را باز کرده و f(n) را برای هر يک از زيربرگها محاسبه ميکنيم: • f(Craiova)=c(Rimnicu Vilcea, Craiova)+h(Craiova)=360+160=526 • f(Pitesti)=c(Rimnicu Vilcea, Pitesti)+h(Pitesti)=317+100=417 • f(Sibiu)=c(Rimnicu Vilcea,Sibiu)+h(Sibiu)=300+253=553 • بهترين انتخاب شهر Fagarasاست

  28. جست و جوی آگاهانه و اکتشاف جستجوی A* در نقشه رومانی • ََ Fagarasرا باز کرده و f(n) را برای هر يک از زيربرگها محاسبه ميکنيم: • f(Sibiu)=c(Fagaras, Sibiu)+h(Sibiu)=338+253=591 • f(Bucharest)=c(Fagaras,Bucharest)+h(Bucharest)=450+0=450 • بهترين انتخاب شهر Pitesti !!! است

  29. جست و جوی آگاهانه و اکتشاف جستجوی A* در نقشه رومانی • ََ Pitestiرا باز کرده و f(n) را برای هر يک از زيربرگها محاسبه ميکنيم: f(Bucharest)=c(Pitesti,Bucharest)+h(Bucharest)=418+0=418 • بهترين انتخاب شهر Bucharest !!! است

  30. 2 1 1 3 2    5 6 B/4 C/4 1 1 5 4 F/3 G/2 1 3 8 4 N/1 O/3 1 X/0 4 جست و جوی آگاهانه و اکتشاف جستجوی A* A/5

  31. جست و جوی آگاهانه و اکتشاف جستجوی A* A/5 2 1 B/1 C/4 1 1 1 1 D/5 E/1 F/3 G/2 1 3 3 3 1 2 1 3 J/1 H/2 I/3 K/0 L/3 M/2 N/1 O/3 2 2 3 2 3 3 3 2 1 3 1 P/3 Q/1 R/2 S/2 T/1 U/1 V/2 W/1 X/0 Y/2 Z/1

  32. 2 1 3 5 4 2 1      5 3 B/1 C/4 1 1 1 1 4 5 8 4 D/5 E/1 F/3 G/2 3 3 1 3 7 8 4 J/1 K/0 N/1 O/3 6 1 X/0 4 جست و جوی آگاهانه و اکتشاف جستجوی A* A/5

  33. جست و جوی آگاهانه و اکتشاف جستجوی A* A/5 2 1 B/1 C/9 1 1 1 1 D/5 E/1 F/3 G/2 1 3 3 3 1 2 1 3 J/1 H/2 I/3 K/0 L/3 M/2 N/1 O/3 2 2 3 2 3 3 3 2 1 3 1 P/3 Q/1 R/2 S/2 T/1 U/1 V/2 W/1 X/0 Y/2 Z/1

  34. 2 1 2 1 3    10 3 B/1 C/9 1 1 4 8 D/5 E/1 3 3 7 J/1 K/0 6 جست و جوی آگاهانه و اکتشاف جستجوی A* A/5

  35. Admissible heuristics A heuristic h(n) is admissible if for every node n, h(n)≤ h*(n), h*(n): true cost to reach the goal state from n An admissible heuristic never overestimates the cost to reach the goal, i.e., it is optimistic Example: hSLD(n) (never overestimates the actual road distance) Theorem: If h(n) is admissible, A* using TREE-SEARCH is optimal 36

  36. A A 1 1 1 1 B B C C 3 1 2 4 1 1 1 1 D D E E 1 1 1 2 1 1 1 1 F F G G 1 1 0 0 1 1 H H 0 0 جست و جوی آگاهانه و اکتشاف جستجوی A* / h ≤ h* h ≤ h*

  37. A A 1 1 1 1 4 6 1 2 3 2 5 1 4 3           B B C C 1 3 2 4 1 1 1 1 D D E E 1 1 1 2 1 1 1 1 F F G G 1 1 0 0 1 1 H H 0 0 جست و جوی آگاهانه و اکتشاف جستجوی A* / h ≤ h* h ≤ h*

  38. Consistent heuristics A 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 have f(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 39

  39. نکات مهم الگوریتم A* نکته 6 : تابع h(n) را یکنوا می گویند اگر رابطه زیر در مورد آن صادق باشد : h(n) < C(n , a , n ) + h( n ) ׳ ׳ S n ׳ G1 n ׳ یعنی׳ n با استفاده از عمل a از حالت n ساخته شده C(n , a , n )

  40. نکات مهم الگوریتم A* مثال : در گراف زیر تابع h(n) یکنوا است زیرا با توجه به رابطه زیر : A 2 2 4 1 2 B C 1 1 3 1 F D 3 3 1 2 G E 1 2 0 1 3 h(A) < C(A , a , B) +h(B) => 2 < 1 + 3 => 2 < 4 ≡ True h(A) < C(A , a , C) +h(C) => 2 < 4 + 1 => 2 < 5 ≡ True

  41. نکات تکمیلی الگوریتم A* توابع هیورستیک که یکنوا نیستند به معادله زیر تبدیل به یکنوا می شوند معادله pathmax : پدر n ׳ فرزند G1 n

  42. مثال : تابع هیورستیک غیر یکنوای زیر را تبدیل به یک تابع هیورستیک یکنوا کنید ؟ شرط یکنوایی : A 2 7 4 1 B C 1 1 4 1 F D 1 2 G 1 0

  43. جست و جوی آگاهانه و اکتشاف جستجوی A* • کامل بودن:بله • بهينگی:بله • پيچيدگي زماني: • اما اگر h = h* آنگاه • پيچيدگی فضا: • اما اگر h = h* آنگاه

  44. Arad` 366=0+366 Zerind Timisoara Sibiu 393=140+253 477=118+329 449=75+374 Arad Fagaras Oradea Rimnicu 671=291+380 413=220+193 415=239+176 646=280+366 Sibiu Craiova Sibiu Bucharest Pitesti 591=338+253 450=450+0 526=366+160 417=317+100 553=300+253 Optimal: Craiova Bucharest Rimnicu 418=418+0 615=455+160 607=414+193

  45. یادآوری: مساله رومانی

  46. A* search example 47

  47. A* search example 48

  48. A* search example 49

  49. A* search example 50

More Related