1 / 20

Solving problems by searching

Solving problems by searching. Chapter 3 Modified by Vali Derhami. Outline. Problem-solving agents Problem types Problem formulation Example problems Basic search algorithms. عاملهاي حل مساله.

awen
Download Presentation

Solving problems by searching

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. Solving problems by searching Chapter 3 Modified by Vali Derhami

  2. Outline • Problem-solving agents • Problem types • Problem formulation • Example problems • Basic search algorithms

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

  4. 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. Example: Romania

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

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

  9. Single-state problem formulation (Cont.) • goal test, determines whether a given state is a goal state. can be • explicit, e.g., x = "at Bucharest“ مجموعه شمارش پذيري از حالات. • implicit, e.g., Checkmate(x) يك ويژگي مجرد • 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. 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. 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. Example: The 8-puzzle • states? • actions? • goal test? • path cost?

  13. 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. 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. Tree search example درخت جستجو با استفاده از حالت ابتدايي و تابع پيسين ايجاد ميشود. زماني كه يك حالت از چند مسير قابل دسترسي باشد بجاي درخت گراف جستجو داريم.

  16. Tree search example

  17. Tree search example

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

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

  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 costg(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)ناميده ميشود.

More Related