solving problems by searching chapter 3 modified by vali derhami

20
Solving problems by searching Chapter 3 Modified by Vali Derhami

Upload: junior-whitehead

Post on 29-Jan-2016

232 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Solving problems by searching Chapter 3 Modified by Vali Derhami

Solving problems by searching

Chapter 3Modified by Vali Derhami

Page 2: Solving problems by searching Chapter 3 Modified by Vali Derhami

2/20

Outline

Problem-solving agents Problem types Problem formulation Example problems Basic search algorithms

Page 3: Solving problems by searching Chapter 3 Modified by Vali Derhami

3/20

عاملهاي حل مساله عاملهاي حل مساله با پيدا كردن رشته هايي از اقدامات كه به

حالتهاي مطلوب منجر مي شوند تصميم ميگرند كه چه عملي را انجام دهند.

.عامل مذكور هدف گرا است اين روش حلoffline .برون خط( است( حل بر خط(online) شامل عمل كردن بدون دانش كاملي از مساله و

پاسخ آن مي باشد. :مراحل انجام كار

Goal formulation-تعيين هدف 1مجموعه اي از حالتها كه كه هدف در آنها برآورده مي شود.

Problem formulation -تعريف مساله 2

پيدا كردن توالي هاي مختلف ممكن از Search -جستجو در فضاي حالت 3

اقدامات كه به حالتهايي با مقادير معلوم منجر مي شوند و انتخاب بهترين آنها.

Execution - اجراي راه حل 4

Page 4: Solving problems by searching Chapter 3 Modified by Vali Derhami

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

Page 5: Solving problems by searching Chapter 3 Modified by Vali Derhami

5/20

Example: Romania

Page 6: Solving problems by searching Chapter 3 Modified by Vali Derhami

6/20

Problem-solving agents

ابتدا هدف بر اساس ادراك مشاهده شده تدوين، بعد مساله تدوين مي شود. آنگاه جستجو براي سلسله اقداماتي كه به هدف منجر ميشود و بعد

انتخاب بهترين سلسله اقدامات و اجراي آن.

Page 7: Solving problems by searching Chapter 3 Modified by Vali Derhami

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: انجام عملها بدون توجه به ادراكات

Page 8: Solving problems by searching Chapter 3 Modified by Vali Derhami

8/20

Single-state problem formulation

A problem is defined by four items:2. actions or successor function S(x) = set of

action–state pairs هر تابع پسين يك حالت را گرفته و يك مجموعه از زوجهاي مرتب

)پسين،اقدام(را بر مي گرداند كه هر اقدام يكي از اقدامهاي ممكن در حالت فعلي و پسين حالتي است كه پس از آن اقدام محيط به آن

حالت مي رود. e.g., S(Arad) = {<Arad Zerind, Zerind>, … }

حالت ابتدايي و تابع پسين بهمراه يكديگر بطور ضمني فضای حالت مساله

.را تعريف ميكنند 1. initial state e.g., "at Arad" In )Arad(

Page 9: Solving problems by searching Chapter 3 Modified by Vali Derhami

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

مجرد ويژگي يك

Page 10: Solving problems by searching Chapter 3 Modified by Vali Derhami

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

Page 11: Solving problems by searching Chapter 3 Modified by Vali Derhami

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

Page 12: Solving problems by searching Chapter 3 Modified by Vali Derhami

12/20

Example: The 8-puzzle

states? actions? goal test? path cost?

Page 13: Solving problems by searching Chapter 3 Modified by Vali Derhami

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]

Page 14: Solving problems by searching Chapter 3 Modified by Vali Derhami

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

Page 15: Solving problems by searching Chapter 3 Modified by Vali Derhami

15/20

Tree search example

درخت جستجو با استفاده از حالت ابتدايي و تابع پيسين ايجاد ميشود.

زماني كه يك حالت از چند مسير قابل دسترسي باشد بجاي درخت گراف جستجو داريم.

Page 16: Solving problems by searching Chapter 3 Modified by Vali Derhami

16/20

Tree search example

Page 17: Solving problems by searching Chapter 3 Modified by Vali Derhami

17/20

Tree search example

Page 18: Solving problems by searching Chapter 3 Modified by Vali Derhami

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(

Page 19: Solving problems by searching Chapter 3 Modified by Vali Derhami

19/20

گره ها

ساختار داده اي با پنج جز: حالت متناظر با گره- حالت:1از درخت گره توليد كننده¢ گره مذكور- گره والد:2

جستجو اقدام اعمال شده بر گره والد براي توليد - اقدام:3

گره مذكور هزينه مسير ازحالت اوليه تا گره - هزينه مسير:4

)g)n مذكور، تعداد گامهاي مسير از حالت اوليه- عمق:5

Page 20: Solving problems by searching Chapter 3 Modified by Vali Derhami

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)برگي