Presentation is loading. Please wait.

Presentation is loading. Please wait.

Solving problems by searching Chapter 3 Modified by Vali Derhami.

Similar presentations


Presentation on theme: "Solving problems by searching Chapter 3 Modified by Vali Derhami."— Presentation transcript:

1 Solving problems by searching Chapter 3 Modified by Vali Derhami

2 2/20 Outline Problem-solving agents Problem types Problem formulation Example problems Basic search algorithms

3 3/20 عاملهاي حل مساله  عاملهاي حل مساله با پيدا كردن رشته هايي از اقدامات كه به حالتهاي مطلوب منجر مي شوند تصميم ميگرند كه چه عملي را انجام دهند.  عامل مذكور هدف گرا است.  اين روش حل offline (برون خط) است.  حل بر خط (online) شامل عمل كردن بدون دانش كاملي از مساله و پاسخ آن مي باشد.  مراحل انجام كار: 1-تعيين هدف Goal formulation مجموعه اي از حالتها كه كه هدف در آنها برآورده مي شود. 2-تعريف مساله Problem formulation 3-جستجو در فضاي حالت Search پيدا كردن توالي هاي مختلف ممكن از اقدامات كه به حالتهايي با مقادير معلوم منجر مي شوند و انتخاب بهترين آنها. 4- اجراي راه حل Execution

4 4/20 Example: Romania On holiday in Romania; currently in Arad. Flight leaves tomorrow from Bucharest Agent has to be Bucharest on tomorrow Formulate goal: be in Bucharest Formulate problem: states: various cities, initial state (Arad) actions: drive between cities Find solution: sequence of cities, e.g., Arad, Sibiu, Fagaras, Bucharest

5 5/20 Example: Romania

6 6/20 Problem-solving agents ابتدا هدف بر اساس ادراك مشاهده شده تدوين، بعد مساله تدوين مي شود. آنگاه جستجو براي سلسله اقداماتي كه به هدف منجر ميشود و بعد انتخاب بهترين سلسله اقدامات و اجراي آن.

7 7/20 Discussion about Environment Static: تدوين و حل مساله بدون توجه به تغييراتي كه ممكن است در محيط رخ دهد صورت گرفته Deterministic fully observable  single-state problem Agent knows exactly which state it will be in; solution is a sequence Discrete: Open loop: انجام عملها بدون توجه به ادراكات

8 8/20 Single-state problem formulation A problem is defined by four items: 1. initial state e.g., "at Arad" In (Arad) 2. actions or successor function S(x) = set of action–state pairs هر تابع پسين يك حالت را گرفته و يك مجموعه از زوجهاي مرتب (پسين،اقدام)را بر مي گرداند كه هر اقدام يكي از اقدامهاي ممكن در حالت فعلي و پسين حالتي است كه پس از آن اقدام محيط به آن حالت مي رود. e.g., S(Arad) = {, … } حالت ابتدايي و تابع پسين بهمراه يكديگر بطور ضمني فضای حالت مساله را تعريف ميكنند.

9 9/20 Single-state problem formulation (Cont.) 3. goal test, determines whether a given state is a goal state. can be explicit, e.g., x = "at Bucharest“ مجموعه شمارش پذيري از حالات. implicit, e.g., Checkmate(x) يك ويژگي مجرد 4. path cost (additive): assigns a numeric cost to each path e.g., sum of distances, number of actions executed, etc. c(x,a,y) is the step cost, assumed to be ≥ 0 A solution is a sequence of actions leading from the initial state to a goal state

10 10/20 Selecting a state space Real world is absurdly complex  state space must be abstracted for problem solving (Abstract) state = set of real states بسياري از جنبه هاي دنياي واقعي از قلم مي افتند چرا كه نسبت به هدف بي ارتباط هستند (Abstract) action = complex combination of real actions e.g., "Arad  Zerind" represents a complex set of possible routes, detours, rest stops, etc. تجريد: فرايند حذف جزييات از يك بازنمايي را گويند For guaranteed realizability, any real state "in Arad“ must get to some real state "in Zerind" (Abstract) solution = set of real paths that are solutions in the real world Each abstract action should be "easier" than the original problem

11 11/20 Vacuum world state space graph states? integer dirt and robot location actions? Left, Right, Suck goal test? no dirt at all locations path cost? 1 per action

12 12/20 Example: The 8-puzzle states? actions? goal test? path cost?

13 13/20 Example: The 8-puzzle states? locations of tiles actions? move blank left, right, up, down goal test? = goal state (given) path cost? 1 per move [Note: optimal solution of n-Puzzle family is NP-hard]

14 14/20 Example: robotic assembly states?: real-valued coordinates of robot joint angles parts of the object to be assembled actions?: continuous motions of robot joints goal test?: complete assembly path cost?: time to execute

15 15/20 Tree search example درخت جستجو با استفاده از حالت ابتدايي و تابع پيسين ايجاد ميشود. زماني كه يك حالت از چند مسير قابل دسترسي باشد بجاي درخت گراف جستجو داريم.

16 16/20 Tree search example

17 17/20 Tree search example

18 18/20 Tree search algorithms Basic idea: offline, simulated exploration of state space by generating successors of already-explored states (a.k.a.~expanding states)

19 19/20 گره ها ساختار داده اي با پنج جز: 1- حالت: حالت متناظر با گره 2- گره والد: گره توليد كنندهِ گره مذكور از درخت جستجو 3- اقدام: اقدام اعمال شده بر گره والد براي توليد گره مذكور 4- هزينه مسير: هزينه مسير ازحالت اوليه تا گره مذكور، g(n) 5- عمق: تعداد گامهاي مسير از حالت اوليه

20 20/20 Implementation: states vs. nodes A state is a (representation of) a physical configuration A node is a data structure constituting part of a search tree includes state, parent node, action, path cost g(x), depth The Expand function creates new nodes, filling in the various fields and using the SuccessorFn of the problem to create the corresponding states. لبه (Fringe): گره هاي توليد شده ولي گسترش نيافته. هر عنصر لبه، گره برگي (Leaf Node) ناميده ميشود.


Download ppt "Solving problems by searching Chapter 3 Modified by Vali Derhami."

Similar presentations


Ads by Google