Vous êtes sur la page 1sur 14

Bab 2 Intelligent Agents [Russel and Norvig, Chapter 2] Apa yang dimaksud dengan Agent

Percepts

Sensors

AGENT Environment Actions

Effectors

o o o o

Agen (Agents) dapat dianggap sebagai segala sesuatu yang menerima dan merasakan keadaan mengenai lingkungannya melalui sensor sensor yang dimilikinya dan melakukan action terhadap lingkungannya tersebut dengan memanfaatkan effectors yang dimilikinya. Analogi dapat dilihat pada human agents yang memiliki mata, telinga dan bagian tubuh lainnya sebagai sensor dan tangan, kaki dsb sebagai effector. Robotic agent menggunakan kamera dan infrared range finder sebagai sensor dan motor sebagai effector. Software agent memanfaatkan encoded bit string untuk menentukan keadaan lingkungannya [percepts] dan action yang dilakukan. Bentuk generik dari Agents dapat dilihat pada gambar diatas.

Bagaimana suatu agen melakukan suatu action.


Rational agent adalah agen yang melakukan hal yang benar, dengan manfaat yang dapat dirasakan oleh lingkungannya. Keberhasilan suatu agent untuk suatu tujuan tertentu ditentukan melalui pengukuran performance yang dicapai oleh agent tersebut. Pengukuran performance atau tingkat keberhasilan suatu agents ditentukan oleh 1. Bagaimana (How) menentukan kriteria keberhasilan dari agent. 2. Bilamana (When) evaluasi keberhasilan tersebut dilakukan.

Rational Agents = Map from percept sequences into Actions. Performance measure = criteria for determining the quality of agents.

Misalnya: for diagnosis agents # of successful diagnoses/day, for vacuum cleaner dirt collected/day. So, the definition of rational agents for each percept sequence, choose action that maximizes expected value of performance measure, given only built in knowledge and percept sequence. Perlu dibedakan antara Rational Agent dan Omniscience Agent. 1. Rational agent lebih menekankan pada keberhasilan yang diharapkan berdasarkan pada kondisi lingkungan yang dihadapinya 2. Omniscience Agent adalah agent yang mengetahui dengan pasti tentang hasil yang harus diperoleh dan berusaha untuk mencapainya dari action yang dilakukan. Avoiding Omniscience: performance criterion should not require predicting future perfectly. Rational agent tergantung pada 4 hal yaitu: 1. Pengukuran performance (menentukan tingkat keberhasilan agents) 2. Percept sequence (urutan hal yang dialami hingga saat tertentu) 3. Hal apa saja tentang lingkungannya yang diketahuinya. 4. Action apa saja yang dapat dilakukan oleh agents tersebut.

For each possible percept sequence, an ideal rational agent should do whatever action is expected to maximize its performance measure, on the basis of the evidence provided by the percept sequence and what ever built-in knowledge the agent has.

Blok Diagram Intelligent Agent

Contoh Aplikasi Inteligent Agent


1. Delivery Robot

Task yang harus dilakukan: Berpindah ke suatu lokasi tertentu [Move self to location L] Memindahkan object A dari suatu lokasi ke lokasi lain [Move A from L1 to L2] Menemukan dimana lokasi benda A dll Suatu Autonomous Delivery robot memiliki: Goal : when and where to deliver what; trade-off antara acting quickly and acting safely. Percepts: images from camera, sonar, laser range finders, instructions from keyboards, dst Operations: translate, rotate, pick-up, put-down, look-at, dst Proses Reasoning (Sub)Tasks yang terlibat antara lain: Find a path between locations Plan how to carry out multiple tasks Make assumptions about Russ's location Make tradeoffs under uncertainty: should it go near the stairs? Proses Learning yang terjadi: which actions are useful and when which objects are where how its actions affect its position

2. Diagnostic Assistant
Task yang harus dilakukan suatu Diagnostic Assistant Menentukan apa yang terjadi jika[ What should happen if . . .] Menetukan mengapa sesuatu tdk bekerja [Something doesn't work. Why?] Menentukan test terbaik untuk menentukan suatu fault. Dll

Suatu Diagnostic Assistant memiliki: Goals: identify fault, decide which tests to perform, fix device, explain treatment, tradeoffs between fixing vs replacing components Percepts: symptoms of device/patient, results of tests Operations: ask further diagnostic questions (order tests), provide treatment Reasoning (Sub)Tasks Plan tests / treatments to address problems Derive possible causes for symptoms; rule out other causes Reason about uncertainties/ambiguities given symptoms Trade off alternate courses of action Learning Association between symptoms and faults Effects of treatments Accuracy of tests

3. Infobot
Infobot interacts with an information environment dan memiliki tugas: takes in high-level, perhaps informal, queries finds relevant information and presents information in meaningful way Suatu Infobot memiliki: Goals: get requested information; tradeoffs between volume and quality of information vs expense involved; explain (non) answer

Percepts: information at current site; what links are available; load on various connections Operations: initiate search; report results; ask for refinement/confirmation Reasoning (Sub)Tasks Derive implicit information Reach appropriate conclusions even if knowledge is insuffcient/conicting Infer (default) where to find information Tradeoff between information quality and cost Learning User preferences Information sources Speed of servers

Dari 3 contoh diatas dapat disimpulkan bahwa common task suatu intelligent agent adalah sbb:
1. Percept/Operation: Sense (visual, acoustic, . . . ) Communicate (Natural language, Program, Spec) Move (\arms", \legs", . . . ) Order (Natural language, instruction, . . . ) Explain (Natural language, . . . ) 2. Reasoning: Answer queries Plan (paths, activities, . . . ) Make assumptions / guesses Deal with tradeoffs 3. Adapting/Learning Perform more tasks; perform task better; . . . faster Update model of world, user, dll. Update model of agent itself Update distribution of tasks

What is involved in intelligence?


1. Ability to interact with real world speech recognition, understanding, and synthesis image understanding (computer vision) 2. Reason modelling external world problem solving, planning, decision making ability to deal with unexpected problems, uncertainties 3. Learning/Adaptation We are continuously learning and adapting and want systems that adapt to us

Contoh intelligent agent lainnya seperti pada tabel berikut:

Note: PAGE (Percepts, Actions, Goals, Environment)

Basic Action Policy dari suatu Intelligent Agent


Maping from percept sequences to actions. Agent programming: designing and implementing good policies.

Types of Policy
1. Reflex (respond immediately to percept) Tables Rules with State (Memory) 2. Goal-based (act to achieve a goal) 3. Utility-based (try to maximize \happiness")

Implementing Agents using Tables


Contoh: Tic Tac Toe Program 1.
Data structures : A nine element vector representing the board, where the elements of the vector correspond to the board positions as follows:

1 4 7

2 5 8

3 6 9

An element contains the value : 0 if the corresponding square is blank 1 if the filled with an X 2 if it is filled with an O Move_table : vector of 3 ( 19.683 ) elements, each element is a nine element vector. Algorithm : 1. View the vector board as a base three number. And convert to decimal. Ex : O X
9

The board above in the condition 2 1 0 0 0 0 0 0 0 3 2.

23 +13 =5

Use the number above as an index into Movetable and access the vector stored there. 3. The vector selected in step 2 represents the way the board will look after the move that should be made, so set board to that vector.

Problem for program 1 1. Even the problem is very efficient in time, it takes a lot of space to store the table 2. You have to do a lot of work to enter the vector to the table 3. Step 2 is prone of error 4. To extend the game into 3 dimensions, we have to start from the scratch again. Problem with table approach Should keep entire history of percepts. 100 Memory Space: For chess, requires 35 entries Design Diffculty: Designer must anticipate how agent should respond to every possible percept sequence. Avoiding Intractably Large Tables Many cells in table are identical. Markov Environments: Eg: In Chess, only current board position matters; independent of all previous percepts. . . . Irrelevant Percepts: Eg: If car in front of you slows down, you should brake; color/model of car, music on radio, temperature, dll are all irrelevant. Summarizing Percept Sequence: Use state" yaitu synopsis of percept history state + current percept identic dengan kondisi Markov diatas

Compact Representation: Implement Agents using Rules


Rules express regularities in the table, Misalnya: if car-in-front-is-braking then initiatebraking This rule only needs only last percept, jadi ignores all irrelevant percepts

simple reflex agent

Program 2
Data structures : A nine element vector representing the board, where the elements of the vector correspond to the board positions as follows :

1 4 7

2 5 8

3 6 9

An element contains the value : 2 if the corresponding square is blank 3 if the filled with an X 5 if it is filled with an O Turn : An integer indicating which move of the game is about to be played, 1 indicates the first move, 9 the last move. Algorithm : There are 3 subprocedures Make2 This procedure returns 5 if the center square of the board is blank, that is, Board[5] = 2 , otherwise, this function returns any blank non corner square ( 2, 4, 6 or 8 ).

Posswin(p)

this procedures returns 0 if player p cant win on his next move, otherwise it returns the number of the square that constitutes a winning move. By checking the value of every row, every column or every diagonal, the function will enable the program both to win or block the opponents win. If the value is 18 ( 3 x 3 x 2 ) then X can win, if the value is 50 ( 5 x 5 x 2 ) then O can win. If the procedure find a winning row, determine which element is blank, and then return the number of that square. This procedure set Board[n] to 3 if Turn is odd or 5 if Turn is even, then it increments Turn by 1

Go(n)

(note : the algorithm has a built in strategy, it makes the odd numbered moves if it is playing X and even numbered moves if it playing O.) The strategy for each turn is as follows: Turn 1 2 3 4 5 6 7 8 9 Rules Go(1) if Board[5] = 2 then Go(5) else Go(1) if Board[9] = 2 then Go(9) else Go(3) if Posswin(X) is not 0 then Go(Posswin(X)) else Go(Make2) if Posswin(X) is not 0 then Go(Posswin(X)) else if Posswin(O) is not 0 then Go(Posswin(O)) else if Board[7] = 2 then Go(7) else Go(3) if Posswin(O) is not 0 then Go(Posswin(O)) else if Posswin(X) is not 0 then Go(Posswin(X)) else Go(Make2) if Posswin(X) is not 0 then Go(Posswin(X)) else if Posswin(O) is not 0 then Go(Posswin(O)) else go anywhere that is blank if Posswin(O) is not 0 then Go(Posswin(O)) else if Posswin(X) is not 0 then Go(Posswin(X)) else go anywhere that is blank Same as Turn = 7

Note : 1. Since Turn = 4 the program will be able to block the opponents win 2. The program needs time more than program 1 because it has to check several condition before it moves but it saves a lot of space 3. We can not generalize any of the program knowledge, only for 3 by 3 tic tac toe game

Summarizing Percept Sequence


May require > 1 percept to understand situation, can use state" to help encode situation

Eg: distinguish BRAKE from TURN signal requires several percepts. . . but can summarize as \car signalling turn" state Use this state when interpreting next percepts

reflex agent with state

Program 3
Data structures : A nine element vector representing the board, where the elements of the vector correspond to the board positions as follows :

8 1 6

3 5 7

4 9 2

Board position is arranged as a Magic Square. (all the rows, columns, diagonals sum is 15) We can simplify the process of checking for a possible win We mark the board as moves are made and also we keep a list of the squares in which each player has played To check for a possible win of one player, we consider each pair of squares owned by the player, compute the difference betwen 15 and the sum of two squares.

10

If the difference (+) and (> 9) then not colinier and ignored it else if the difference is equal to blank, a move there will produce a win No player own move the 4 squares at a time, so fewer square is examine compare with program 2. So, the way of representation give an impact on the effesiency of the program

Compute Action Dynamically


Why pre-compute entire table? Instead. . . Have agent compute desired action, rather than look it up. (Tradeoff: reduce space, but increase CPU time) Compute paths, select best, take action that leads to best situation Note table is NOT explicitly pre-computed.

Program 4
Data structures : Board Position :A structure containing 9 element vector representing the board, a list of board positions that could result from the next move, a number representing an estimate of how likely the board position is to lead to an ultimate win for the player to move. Algorithm : Called : Minimax Procedure Look ahead various sequence of moves in order to find a sequence that leads to a win. This means to maximixe the likelihood of winning while the opponent will try to mininmize the likelihood. To decide on the next move : Look ahead at the board positions that result from each possible move. Decide which position is best by doing the following steps for each of the board position 1. see if it is a win 2. if so call it the best and give the highest possible rating 3. otherwise, consider all the moves the opponent could make next and see which of them is worst for us. Make the move that lead to that position Assign the rating of that best move to current position

11

Problems with Computing Action Dynamically


Search space may be exponentially large: Choosing the best action may be computationally intractable. World may change while we are searching: In dynamic environment, agent must act promptly. It may not have time to consider all possible action sequences. Knowledge of world may be incomplete or wrong: Agent may not be able to accurately predict the future.

But this approach is still usually best option. . .

Problems with Reflex Agent


Only single response for each situation maka only for achieving single goal dan Designer must anticipate, for each situation, which action is best for achieving goal

Goal-Based Agents
Generate possible sequences of actions Predict resulting states Assess goals in each resulting state Choose an action that achieves goal

12

Note: can reprogram agent simply by changing goals

Utility-Based Agents
While goals are qualitative, (eg, get to destination) may want to make quantitative comparisons of actions. (eg, quicker, safer, more reliable paths) Important for making tradeoffs (speed vs safety), the likelihood of success against importance of goal

Environments
Best agent design depends on: + performance measure (goal, utility, . . .) + complexity of its environment

13

Sifat sifat Environment


Accessible: Percepts determine state policy based on current percept no need for (internal) state Deterministic: Actions cause deterministic changes. Simpler model of action effects (If env. also accessible, everything is certainty) Episodic: Performance measured on short sequence of actions (then start over) No long-term issues. Static: World doesn't change while agent is thinking. Allows lots of computing per decision Discrete: Percepts, actions are discrete. Easier to interpret percepts & to evaluate actions

Comments on Environments
Known: (by designer/agent) Environment can be modeled Agent does not need to adapt Most real situations appear non-deterministic as complex, inaccessible, and/or stochastic Hardest: Inaccessible, Nonepisodic, Dynamic, Continuous (Unknown)

Beberapa contoh kondisi environment:

14

Vous aimerez peut-être aussi