1 / 31

Introduction to Artificial Intelligence

Introduction to Artificial Intelligence. Problem Solving Through Informed Search. S. H. Davarpanah Davarpanah@usc.ac.ir. Computer Group Engineering Department University of Science and Culture. Heuristically informed search.

yank
Download Presentation

Introduction to Artificial Intelligence

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. Introduction to Artificial Intelligence Problem Solving Through Informed Search S. H. Davarpanah Davarpanah@usc.ac.ir Computer Group Engineering Department University of Science and Culture

  2. Heuristically informed search Uses domain-dependent (heuristic) information in order to search the space more efficiently. What kind of heuristic information would be useful?

  3. Heuristically informed search What kind of heuristic information would be useful? Information that helps: • Decide which node to expand next, instead of doing the expansion in a strictly breadth-first or depth-first order; • In the course of expanding a node, decide which successor(s) to generate, instead of blindly generating all possible successors at one time; • Decide which nodes to discard (pruned), from the search space.

  4. انتخاب يك مكاشفه خوب • هر چه مكاشفه بهتر باشد (مطلع‌تر باشد)، نياز به بررسي تعداد كمتري نود در درخت جستجو جهت يافتن راه حل وجود دارد. از اين رو، همانطور كه انتخاب يك روش نمايش درست مي‌تواند نقش مؤثري در تعيين ميزان تواناييما در حل يك مسئله داشته باشد، انتخاب مكاشفه خوب نيز مهم و تأيين‌كننده مي‌باشد. • هزینه تخمینی حاصل از مکاشفه باید همواره از مقدار واقعی آن کمتر باشد. مكاشفه اصطلاحاً پذيرفتني (Admissible ) باشد. • مكاشفه h نسبت به مكاشفه ديگر، j ، آگاه تر است اگر براي همه نودها در فضاي جستجو مقدار h بیشتر مساوی مقدار j باشد.

  5. معماي 8 1 2 3 8 4 7 6 5 7 6 4 3 1 2 5 8 حدوداً ۲۰ حركت طول مي‌كشد تا از حالت شروع تصادفي به وضعيت هدف برسيم، بنابراين درخت جستجو ارتفاع ۲۰ دارد. فاكتور شاخه شاخه شدن بستگي به اين دارد كه خانه خالي كجا قرار دارد. (2, 3 و یا 4) از اين رو متوسط فاكتور شاخه شاخه شدن درخت جستجو برابر ۳ مي‌باشد. بنابراين، جستجوي كوركورانه يك درخت جستجو نياز به تست حدود 3 به توان 20 وضعيت دارد كه حدوداً 5/3 بيليون جستجو مي‌شود و از آنجا كه كلاً !۹ يا 362880 حالت مختلف فقط وجود دارد، درخت جستجو بايد به اين حد و با حذف حالت‌هاي تكراري برسد.

  6. معماي 8 اولين مكاشفه مورد نظر جهت مسئله معماي ۸ شمارش تعداد خانه‌هايي است كه در سر جاي خود قرار ندارند. اين مكاشفه را، (نود) 1h مي‌ناميم. مكاشفه بهبود يافته ديگر، 2h است كه تعداد خانه‌هايي كه هر يك از اعداد بايد حركت كنند تا به سر جاي خود برسند را مي‌شمارد. مقدار 2h از جمع فاصله‌هاي "من هاتان"هر خانه از موقعيت درست آن بدست مي‌آيد. (فاصله‌ من‌هاتان مجموع تعداد حركت‌هاي عمودي و افقي است كه جهت دستيابي از يك موقعيت به موقعيت ديگر نياز است و بعد از اينكه سيستم مشبك براي جاده‌ها در جزيره‌ من‌هاتان استفاده شد به اين نام، ناميده شد.) براي هر نود مقدار h2 آن نود از مقدار h1 آن بيشتر است. اين بدين معني است كهh2 برh1 چيره (Dominate) شده است. در بعضي حالات، ممكن است تعدادي تابع مكاشفه‌ در دست باشند كه هيچ كدام بر ديگري برتري خاصي ندارند، در اين حال مي‌توان يك تابع مكاشفه‌اي جديد براساس مكاشفه‌هاي h1 … hnبراساس رابطه زير بدست آورد.

  7. Sample heuristic knowledge Straight-line distance from the current node to the goal. Can easily be obtained from a map. Straight-line distance from S to G: 10 Straight-line distance from A to G: 8.5 Straight-line distance from D to G: 8 ...

  8. Heuristic search: Hill climbing Heuristic: expand the most promising successor of the node last expanded (e.g. the node that has the shortest straight-line distance to the goal).

  9. تپه‌نوردي تندترين سربالايي تپه‌نوردي تندترين سربالايي، شبيه تپه نوردي مي باشد، با اين تفاوت كه بر اساس آن، بجاي اينكه در هر مرحله به اولين موقعيتي برويم كه ارتفاع بالاتري نسبت به موقعيت فعلي دارد، دور و بر خود را در 4 جهت چك مي كنيم و بالاترين موقعيت را انتخاب مي نماييم.

  10. تپه‌ها(Foothill)

  11. فلات‌ها(Plateaus)

  12. تيغه‌ها(Ridge)

  13. جستجوي محلي تكراري Iterated Local Search تكنيك‌هاي جستجوي محلي تكراري سعي دارند تا بر مشكل ماكزيمم محلي از طريق اجراي مكرر روال بهينه‌سازي از وضعيت‌هاي اوليه متفاوت فائق آيند. اگر به تعداد كافي الگوريتم فوق تكرار شود، اين روند به ماكزيمم سراسري دست خواهد يافت. البته بايد يادآور شد كه هدف در اين گونه مسائل و استفاده از روندهاي اين چنيني اين است كه به يك راه حل خيلي خوب برسيم، بدون اينكه نيازي باشد كه كل فضاي مسئله بررسي شود. در مسائلي چون مسئله فروشنده دوره‌گرد كه با افزايش تعداد شهرها فضاي جستجو به شدت زياد مي‌شود، جواب‌هايي مي‌توانند توليد بشوند كه بدون اينكه نياز به تكرار مراحل زيادي باشند به اندازه كافي خوب هستند (ماكزيمم محلي) و اين در حالي است كه دستيابي به بهترين جواب غيرممكن مي‌نمايد. (يا حداقل اينكه تضميني جهت بهترين بودن يك جواب وجود ندارد).

  14. جستجو تابو Tabu search جستجوي تابو يك فرامكاشفه ميباشد كه به منظور جلوگيري از تكرار حالتهاي تكراري در ليست وضعيت هاي ديده شده تا هر لحظه، استفاده مي شود. فرامكاشفه جستجوي تابو در تركيب با يك مكاشفه ديگر مورد استفاده قرار مي گيرد و اساس عملكرد آن بر اين اصل استوار است كه ادامه دادن راهي كه به نظر مي آيد ناكارآمد مي‌باشد بهتر و ارزشمندتر از دنبال كردن راهي است كه قبلا ديده شده است. به اين طريق، جستجوي تابو از ماكزيمم هاي محلي جلوگيري ميكند. به نقل از سايت www.tabusearch.net يك انتخاب با تامل بد مي تواند هنوز هم اطلاعات بيشتري را نسبت به يك انتخاب تصادفي خوب در برداشته باشد.

  15. شبيه‌سازي ذوب فلزات به منظور تعيين حركت و يا عدم حركت به سمت وضعيت با انرژي بالاتر ميزان احتمالمحاسبه مي‌شود و يك عدد تصادفي بين صفر و يك انتخاب خواهد شد. اگر اين عدد تصادفي كمتر از مقدار تابع احتمال باشد، وضعيت جديد پذيرفته مي‌شود. در حالاتي كه افزايش ميزان انرژي خيلي زياد است و يا مقدار دما خيلي پايين مي‌باشد، تعداد وضعيت‌هاي بسيار كمي در حالي كه انرژي را افزايش مي‌دهند پذيرفته خواهند شد و مقداربه سمت صفر ميل خواهد نمود. اين واقعيت كه بعضي مراحل اجازه دارند تا انرژي سيستم را افزايش دهند، پردازه را جهت رهايي از اكستريم‌هاي محلي توانمند مي‌سازد و از اين رو شبيه‌سازي ذوب فلزات اغلب روشي بسيار توانمند در حل مسائل پيچيده با تعداد زيادي اكستريمم‌هاي محلي مي‌باشد.

  16. شبيه‌سازي ذوب فلزات ذوب‌كاري، پروسه توليد شيشه‌ها و فلزات سخت و محكم مي‌باشد. در اين فرايند ابتدا فلزات را تا دماي بسيار بالايي حرارت مي‌دهند و در ادامه به مرور آنها را خنك مي‌كنند. در اين روش، اتمها مي‌توانند ساختار بسيار مانايي به خود بگيرند و مواد بسيار محكمي را توليد نمايند. شبيه‌سازي ذوب فلزات به مسائلي اعمال مي‌شود كه تركيبي از چند مقدار در آن دخيل هستند. در اين گونه مسائل، لازم است تا مقادير زيادي جهت نسبت‌دهي به متغيرهاي متفاوت انتخاب شوند بگونه‌اي كه بسته به همه اين مقادير، مقدار برخي توابع عمومي مشخص مي‌شود. اين مقدار تحت عنوان انرژي سيستم مطرح مي‌شود. هدف كلي شبيه‌سازي ذوب فلزات پيدا نمودن حداقل انرژي براي يك سيستم است.

  17. Heuristic search: Greedy best-first search S f*(A)=8 f*(A)=8.5 A D f*(A)=8.5 f*(E)=6 A E Expand the leaf node (of the current search tree) that seems ”the most promising" to lead to a goal node. The node selected for expansion is the one at which an evaluation function f* is minimum (e.g. f* could be the straight line distance to the goal).

  18. Discussion What is the difference between hill-climbing and greedy best-first search? Hill climbing search: expand the most promising successor of the node last expanded. Greedy best-first search: expand the leaf node of the current search tree that seems the most promising to lead to a goal node. Hill climbing is a local search method, while greedy best-first search is a global search method. What are some of the problems with hill climbing? Local maxima, plateaus, and ridges

  19. Generality of greedy best-first search What heuristic function leads to breadth-first search? f*(i) = the depth of node i (the distance from the root to i) What heuristic function leads to depth-first search? f*(i) = - the depth of node i What heuristic function leads to uniform-cost search? f*(i) = the cost of the path from the start node to i

  20. A bad example for greedy B 7 6 goal state F A start state E D 4 3 4 • Say: h(A) = 9, h(B) = 5, h(D) = 6, h(E) = 3, h(F) = 0 • Problem: greedy evaluates the promise of a node only by how far is left to go, does not take cost occurred already into account

  21. Heuristic search: The A* algorithm • The A* algorithm is the greedy best-first search method with: • f*(n) = g*(n) + h*(n) • where: g*(n) estimates the minimum cost of a path from • the start node to node n; • h*(n) estimates the minimum cost from node n to a goal. • The node chosen for expansion is the one for which f* is minimum.

  22. Illustration of A* g*(A)=4 h*(A)=8 f*(A)=4+8 g*(A)=3 h*(A)=8.5 f*(A)=3+8.5 step 1 S 3 4 step 3 step 2 A 11.5 12 D 4 5 5 2 step 5 step 4 B 7+6=13 8+8=16 D A 9+8.5=17.5 12 E 6+6 5 4 4 5 step 6 C 14 18 E 11+6 B 17 13 F 10+3 3 G 13

  23. Exercise Apply the A* algorithm to find a path from S to T, in the following map. The value v associated with a link MN is the length of that link. The value [w] associated with a node N is the straight line distance between N and T.

  24. A* and repeated states • Suppose we try to avoid repeated states • Ideally, the second (or third, …) time that we reach a state the cost is at least as high as the first time • Otherwise, have to update everything that came after • This is guaranteed if the heuristic is consistent: if one step takes us from n to n’, then h(n) ≤ h(n’) + cost of step from n to n’ • Similar to triangle inequality

  25. Admissibility • A heuristic is admissible if it never overestimates the distance to the goal • If n is the optimal solution reachable from n’, then g(n) ≥ g(n’) + h(n’) • Straight-line distance is admissible: can’t hope for anything better than a straight road to the goal • Admissible heuristic means that A* is always optimistic

  26. Optimality of A* • If the heuristic is admissible, A* is optimal (in the sense that it will never return a suboptimal solution) • Proof: • Suppose a suboptimal solution node n with solution value C > C* is about to be expanded (where C* is optimal) • Let n* be an optimal solution node (perhaps not yet discovered) • There must be some node n’ that is currently in the fringe and on the path to n* • We have g(n) = C > C* = g(n*) ≥ g(n’) + h(n’) • But then, n’ should be expanded first (contradiction)

  27. A* (and greedy best-first) search: Discussion Complete?: Yes Optimal?: Yes Time complexity: O(bm) Space complexity: O(bm) A* در حقيقت فقط هنگامي كامل است كه درختي كه در آن به جستجو مي‌پردازد مقدار فاكتور شاخه شاخه شدن محدودي داشته باشد و مسيري با هزينه محدود و با تعداد نودهاي نامحدود در آن موجود نباشد. A* هنگامی بهینه است که مکاشفه در نظر گرفته شده پذیرفتنی باشد. A good heuristic reduces the complexity substantially.

  28. A* عميق‌سازي گام به گام IDA* ( Iterative Deepening A* Search ) از تركيب دو روش A* و عميق‌سازي گام به گام، الگوريتمي ارائه مي‌شود كه در عين حال كه كامل و بهينه است (شبيه A*) شبيه جستجوي اول عمق احتياج به حافظه كمي نيز دارد. IDA* يك نمونه از الگوريتم جستجوي گام به گام عمقي است كه در آن محدوديت به جاي اينكه براساس عمق يك نود تعيين گردد، براساس مقدار (نود)f نمونه‌هاي موفق تعيين مي‌شود.

  29. با حافظه محدود داده شدهA* SMA* ( Simplified Memory-Bound A* Search ) تا وقتی حافظه کم نیاورده است شبیه A* عمل می کند. وقتی حافظه پر شد یکی یا تعدادی از نودها که بیشترین f را دارند ( نودهای فراموش شده Forgotten Nodes ) از حافظه بیرون می روند فقط مقدار f تخمینی آنها در نود پدرشان نگه داشته می شود تا اگر بعدا به این نتیجه برسیم که آن نود نود مناسبی بوده است دوباره آنرا تولید کنیم و بسط دهیم. لذا در هر نود باسد به تعداد حداکثر تهداد فرزندانش جا داشته باشیم. این الگوریتم تضمین می کند که ما را به جواب برساند اگر حافظه به اندازه عمق جواب موجود باشد. در عمل با توجه به مشکل بودن پیاده سازی SMA* بیشتر از IDA* استفاده می شود.

  30. Applications of search methods Route Finding • routing in computer networks; • automated travel advisory systems; • airline travel planning systems. Touring and Traveling Salesperson Problems • planning trips for traveling salespersons; • planning movements for automatic circuit board drills. VLSI Layout • cell layout on the chip; • channel routing between the cells. Robot Navigation • in a two dimensional space (moving on a surface); • in a multidimensional space (when the robot has arms and legs that must be controlled). Assembly Sequencing • checking the feasibility of the steps in a sequence (a geometrical search problem).

More Related