1 / 50

Intelligent Agents

Intelligent Agents. Outline. Agents and environments Concept of rational behavior PEAS ( P erformance measure, E nvironment, A ctuators, S ensors) Environment types Agent structure & implementation. Agents.

orenda
Télécharger la présentation

Intelligent Agents

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. Intelligent Agents Languages for AI - Lesson 3

  2. Outline • Agents and environments • Concept of rational behavior • PEAS (Performance measure, Environment, Actuators, Sensors) • Environment types • Agent structure & implementation Languages for AI - Lesson 3

  3. Agents • An agentis anythingthat can be viewed as perceiving its environment through sensors and acting upon that environment through actuators • Human agent: • eyes, ears, and other organs for sensors • hands, legs, mouth, and other body parts for actuators • Robotic agent: • cameras and infrared range finders for sensors • various motors for actuators Languages for AI - Lesson 3

  4. Agents and Environments • The agent function maps percept sequence to actions • f : P*→ A An agent can perceive its own action, but not always its effects. Languages for AI - Lesson 3

  5. Agents and Environments • The agent function will internally be represented by the • agent program. • The agent program runs on the physical architecture to produce f. agent = architecture + program Languages for AI - Lesson 3

  6. Vacuum-Cleaner World • Environment: squares A and B • Percepts: location and contents, e.g., [A, Dirty] • Actions: Left, Right, Suck, NoOp Languages for AI - Lesson 3

  7. Vacuum-Cleaner World Languages for AI - Lesson 3

  8. Vacuum-Cleaner World • function REFLEX-VACUUM-AGENT ([location, status]) return action • ifstatus == Dirtythen returnSuck • elseiflocation == AthenreturnRight • elseiflocation == BthenreturnLeft • What is the right function? • Can it be implemented in a small agent program? Languages for AI - Lesson 3

  9. Concept of Rationality • An agent should strive to "do the right thing", based on what it can perceive and the actions it can perform. The right action is the one that will cause the agent to be most successful. • Performance measure: An objective criterion for success of an agent's behavior. • E.g., performance measure of a vacuum-cleaner agent could be • amount of dirt cleaned up • amount of time taken • amount of electricity consumed • amount of noise generated, etc. Languages for AI - Lesson 3

  10. Rationality • A rational agent is one that does the right thing • Every entry in the table is filled out correctly • What is the right thing? • Approximation: the most succesfull agent • Measure of success? • Performance measure should be objective • E.g. the amount of dirt cleaned within a certain time • E.g. how clean the floor is • … • Performance measure according to • what is wanted in the environment • instead of how the agents should behave. Languages for AI - Lesson 3

  11. Rationality • What is rational at a given time depends on four things: • Performance measure • Prior environment knowledge • Actions • Percept sequence to date (sensors). • Rational Agent: • For each possible percept sequence, a rational agent should select • an action that is expected • to maximize its performance measure, • given the evidence provided by the percept sequence and whatever built-in knowledge the agent has. Languages for AI - Lesson 3

  12. Rationality • Rationality  omniscience • An omniscient agent knows the actual outcome of its actions (all-knowing with infinite knowledge) • Agents can perform actions in order to modify future percepts so as to obtain useful information (information gathering, exploration) • An agent is autonomous if its behavior is determined by its own experience (with ability to learn and adapt) • Rationality  perfection • Rationality maximizes expected performance, while perfection maximizes actual performance. Languages for AI - Lesson 3

  13. PEAS • PEAS: Performance measure, Environment, Actuators, Sensors • To design a rational agent we must specify its task environment • Consider, e.g., the task of designing an automated taxi driver: • Performance measure: Safe, fast, legal, comfortable trip, maximize profits • Environment: Roads, other traffic, pedestrians, customers • Actuators: Steering wheel, accelerator, brake, signal, horn • Sensors: Cameras, sonar, speedometer, GPS, odometer, engine sensors, keyboard Languages for AI - Lesson 3

  14. PEAS • Agent: Medical diagnosis system • Performance measure: Healthy patient, minimize costs, lawsuits • Environment: Patient, hospital, staff • Actuators: Screen display (questions, tests, diagnoses, treatments, referrals) • Sensors: Keyboard (entry of symptoms, findings, patient's answers) Languages for AI - Lesson 3

  15. PEAS • Agent: Part-picking robot • Performance measure: Percentage of parts in correct bins • Environment: Conveyor belt with parts, bins • Actuators: Jointed arm and hand • Sensors: Camera, joint angle sensors Languages for AI - Lesson 3

  16. PEAS • Agent: Interactive English tutor • Performance measure: Maximize student's score on test • Environment: Set of students • Actuators: Screen display (exercises, suggestions, corrections) • Sensors: Keyboard Languages for AI - Lesson 3

  17. Environment Types • Fully observable (vs. partially observable): An agent's sensors give it access to the complete state of the environment at each point in time. • Deterministic (vs. stochastic): The next state of the environment is completely determined by the current state and the action executed by the agent. (If the environment is deterministic except for the actions of other agents, then the environment is strategic) • Episodic(vs. sequential): The agent's experience is divided into atomic "episodes" (each episode consists of the agent perceiving and then performing a single action), and the choice of action in each episode depends only on the episode itself. Languages for AI - Lesson 3

  18. Environment Types • Static(vs. dynamic): The environment is unchanged while an agent is deliberating. (The environment is semidynamic if the environment itself does not change with the passage of time but the agent's performance score does) • Discrete (vs. continuous): A limited number of distinct, clearly defined percepts and actions. • Single agent (vs. multiagent): An agent operating by itself in an environment. Languages for AI - Lesson 3

  19. Environment Types Languages for AI - Lesson 3

  20. Environment Types Fully vs. partially observable: an environment is full observable when the sensors can detect all aspects that are relevant to the choice of action. Languages for AI - Lesson 3

  21. Environment Types Fully vs. partially observable: an environment is full observable when the sensors can detect all aspects that are relevant to the choice of action. Languages for AI - Lesson 3

  22. Environment Types Deterministic vs. stochastic: if the next environment state is completely determined by the current state the executed action then the environment is deterministic. Languages for AI - Lesson 3

  23. Environment Types Deterministic vs. stochastic: if the next environment state is completely determined by the current state the executed action then the environment is deterministic. Languages for AI - Lesson 3

  24. Environment Types Episodic vs. sequential: In an episodic environment the agent’s experience can be divided into atomic steps where the agents perceives and then performs A single action. The choice of action depends only on the episode itself Languages for AI - Lesson 3

  25. Environment Types Episodic vs. sequential: In an episodic environment the agent’s experience can be divided into atomic steps where the agents perceives and then performs a single action. The choice of action depends only on the episode itself Languages for AI - Lesson 3

  26. Environment Types Static vs. dynamic: If the environment can change while the agent is choosing an action, the environment is dynamic. Semi-dynamic if the agent’s performance changes even when the environment remains the same. Languages for AI - Lesson 3

  27. Environment Types Static vs. dynamic: If the environment can change while the agent is choosing an action, the environment is dynamic. Semi-dynamic if the agent’s performance changes even when the environment remains the same. Languages for AI - Lesson 3

  28. Environment Types Discrete vs. continuous: This distinction can be applied to the state of the environment, the way time is handled and to the percepts/actions of the agent. Languages for AI - Lesson 3

  29. Environment Types Discrete vs. continuous: This distinction can be applied to the state of the environment, the way time is handled and to the percepts/actions of the agent. Languages for AI - Lesson 3

  30. Environment Types Single vs. multi-agent: Does the environment contain other agents who are also maximizing some performance measure that depends on the current agent’s actions? Languages for AI - Lesson 3

  31. Environment Types Single vs. multi-agent: Does the environment contain other agents who are also maximizing some performance measure that depends on the current agent’s actions? Languages for AI - Lesson 3

  32. Environment Types • The simplest environment is • Fully observable, deterministic, episodic, static, discrete and single-agent. • Most real situations are: • Partially observable, stochastic, sequential, dynamic, continuous and multi-agent. Languages for AI - Lesson 3

  33. Agent Types • How does the inside of the agent work? • Agent = architecture + program • All agents have the same skeleton: • Input = current percepts • Output = action • Program= manipulates input to produce output • Note difference with agent function. Languages for AI - Lesson 3

  34. Agent Types • function TABLE-DRIVEN_AGENT(percept) returns action • static: percepts, a sequence initially empty • table, a table of actions, indexed by percept sequence • append percept to the end of percepts • action LOOKUP(percepts, table) • returnaction This approach is doomed to failure Languages for AI - Lesson 3

  35. Agent Types • Four basic kinds of agent programs will be discussed: • Simple reflex agents • Model-based reflex agents • Goal-based agents • Utility-based agents • All these can be turned into learning agents. Languages for AI - Lesson 3

  36. Agent Types: Simple Reflex • Select action on the basis of only the current percept, e.g. the vacuum-agent • Large reduction in possible percept/action situations (next page). • Implemented through • condition-action rules: • "If dirty then suck." Languages for AI - Lesson 3

  37. Vacuum-Cleaner World • function REFLEX-VACUUM-AGENT ([location, status]) return action • ifstatus == DirtythenreturnSuck • elseiflocation == AthenreturnRight • else iflocation == Bthen returnLeft • Reduction from 4T to 4 entries, but not a clever agent (why?) Languages for AI - Lesson 3

  38. Agent Types: Simple Reflex • function SIMPLE-REFLEX-AGENT(percept) returns action • static: rules, a set of condition-action rules • state INTERPRET-INPUT(percept) • rule RULE-MATCH(state, rules) • action RULE-ACTION[rule] • returnaction • Will only work if the environment is fully observable otherwise infinite loops may occur. Languages for AI - Lesson 3

  39. Level 2 keys Level 1 keys Level 2 values Level 1 values Agent Types: Simple Reflex • A straightforward agent implementation: • (defun Reflex-Vacuum-Agent (Location Status) • (cond ((eq Status 'Dirty) 'Suck) • ((eq Location 'A) 'Right) • ((eq Location 'B) 'Left) )) • Let us develop a more general table-driven implementation - table: • (Loc1 (Status11 Action11 ...) Loc2 (Status21 Action21 ...) ... ) • (defvar *VacuumTable* • '(A (Dirty Suck Clean Right) B (Dirty Suck Clean Left))) • (defun Reflex-Table-Driven-Agent (Location Status) • (getf (getf *VacuumTable* Location) Status)) • getfis a standard Lisp function to work with property lists Languages for AI - Lesson 3

  40. ! IMPORTANT ! • getf can be used in setf to change property list value part. • Property list is a table-like structure • (key-1 value-1 key-2 value-2 ... key-n value-n) • ;; possible getf implementation • (defun my-getf (P-list Key) • (let ((Position (member Key P-list))) • (cond ((null Position) NIL) ; if Key not found • (t (cadr Position)) ; else take next elm • ) ) ) • (defun member (Elm Lst) • ??? • ) ) Languages for AI - Lesson 3

  41. Another Simple Reflex Agent • function SIMPLE-REFLEX-AGENT(percept) returns action • static: rules, a set of condition-action rules • state INTERPRET-INPUT(percept) • rule RULE-MATCH(state, rules) • action RULE-ACTION[rule] • return action • Assume the percept structure (complete observation of the world) is the same as state description: (Location X A Status-A B Status-B) • (defun Simple-Reflex-Agent (Percept) • (Rule-Match Percept)) ; simplified design • The rules table will be the same as for reflex-table-driven-agent • (defun Rule-Match (State) • (let* ((Loc (getf State 'Location)) ; sequential init! • (Stat (getf State Loc))) • (Reflex-Table-Driven-Agent Loc Stat))) Same as before Languages for AI - Lesson 3

  42. Agent Types: Reflex and State • To tackle partially observable environments • Maintain internal state • Over time update state using • world knowledge • - How does the world change • - How do actions affect world •  Model of World Languages for AI - Lesson 3

  43. Agent Types: Reflex and State • function REFLEX-AGENT-WITH-STATE (percept) returns action • static: rules, a set of condition-action rules • state, a description of the current world state • action, the most recent action. • state UPDATE-STATE(state, action, percept) • rule RULE-MATCH(state, rules) • action RULE-ACTION[rule] • returnaction Languages for AI - Lesson 3

  44. Agent Types: Reflex and State • Percept does not describe ALL aspects of the world at once, assume the following possible percepts: • (Location . L) - agent's location percept • (Status . S) - status percept of the agent's location • Rules are still in the same table, now a global variable *Rules* • Stateis like percept was last time, i.e. • (Location X A Status-A B Status-B) • and is stored in a global variable *State*. • The most recent action is the global variable *RecentAction* • (defun Reflex-Agent-With-State (Percept) • (setf *State* • (Update-State *State* *RecentAction* Percept)) • (setf *RecentAction* • (Rule-Match *State* *Rules*)) ) Languages for AI - Lesson 3

  45. (defun Update-State (State Action Percept) • (let ((Loc (getf State 'Location))) • ;; only if agent location is known the action can be performed • (if Loc (setf State (Perform State Loc Action))) • ;;the State has been possibly transformed by Action • (setf State (Observe State Percept)) • ;; but direct observation of Percept has priority • State)) • (defun Perform (State Location Action) • ;; possible actions are: Suck | Right | Left | NoOp=nil • (cond ((null Action)) ; no State change performed • ((eq Action 'Suck) ; will clean the actual location • (setf (getf State Location) 'Clean)) • ((and (eq Location 'A) (eq Action 'Right)) • ; checking if possible to move right • (setf (getf State 'Location) 'B)) • ; checking if possible to move left • ((and (eq Location 'B) (eq Action 'Left)) • (setf (getf State 'Location) 'A)) ) • State) ; the state has possibly changed Languages for AI - Lesson 3

  46. ;; Let's observe what can actual Percept change in the State • (defun Observe (State Percept) • (if (null Percept) ; possibly no meaningful percept • State ; so nothing changes • ;; split the percept into parts to help processing • (Change-State State (car Percept) (cdr Percept)) )) • (defun Change-State (State Key Val) • (cond ((eq Key 'Location) ; percept specifies the location • (setf (getf State Key) Val)) ; set new location • ;; or Dirty/Clean at the actual location • (t (setf Key (getf State 'Location)) ; find location • (setf (getf State Key) Val))) ; set its status • State) • More careful design ofRule-Match: the state description is possibly incomplete since the agent updates it according to its percepts up to now! • (defun Rule-Match (State Table) • (let* ((Location (getf State 'Location)) • (Status (if Location (getf State Location)))) • (if (and Location Status) ; and some is place DIRTY ! • (Reflex-Table-Driven-Agent Location Status Table)))) Languages for AI - Lesson 3

  47. Agent Types: Goal-Based • The agent needs a goal to know which situations are desirable. • Things become difficult when long sequences of actions are required to find the goal. • Typically investigated in search and planning research. • Major difference: future is • taken into account • Is more flexible since • knowledge is represented • explicitly and can be • manipulated. Languages for AI - Lesson 3

  48. Agent Types: Utility-Based • Certain goals can be reached in different ways. • Some are better, have a higher utility. • Utility function maps a (sequence of) state(s) onto a real number. • Improves on goals: - Selecting between conflicting goals - Select appropriately between several goals based on likelihood of success. Languages for AI - Lesson 3

  49. Agent Types: Learning • All previous agent-programs describe methods for selecting actions • Yet it does not explain the origin of these programs • Learning mechanisms can be used to perform this task • -- Teach them instead of • instructing them • -- Advantage is the • robustness of the program • toward initially unknown • environments Languages for AI - Lesson 3

  50. Agent Types: Learning • Learning element: introduce improvements in performance element • Critic provides feedback on agents performance based on fixed performance standard • Performance element: selecting actions based on percepts. • - Corresponds to the previous • agent programs • Problem generator: suggests actions that will lead to new and informative experiences. • - Exploration vs. exploitation Languages for AI - Lesson 3

More Related