ARTIFICIAL INTELLIGENCE Lecture 2: Introduction to Agents Asst. Prof. Syed Faisal Ali [email protected] Outcome Based Education Learning Objectives: Learning Outcomes: 1. To understand different types of agents 1. Students will demonstrate an and its mechanism. understanding of agent-based AI architectures. 2. To understand the types of agents and how agents can work. 2. Students will get familiar with the environments of agents. 3. Applications and performances of agents. 3. Students will know the performance parameters based on PAGE and PEAS. 3/13/2017 © Asst. Prof. Syed Faisal Ali 2 What are Agents? An intelligent agent is a software that assists people and act on their behalf. Agents are used to provide a consistent viewpoint on various topics in the field AI. Agents require essential skills to perform tasks that require intelligence. Intelligent agents use methods and techniques from the field of AI. 3/13/2017 © Asst. Prof. Syed Faisal Ali 3 An agent and its Environment sensors percepts ? environment agent actions effectors In general, an entity that interacts with its environment, perception through sensors and actions through effectors or actuators 3/13/2017 © Asst. Prof. Syed Faisal Ali 4 How to design an intelligent agent? Definition: An agent perceives its environment via sensors and acts in that environment with its effectors. Hence, an agent gets percepts one at a time, and maps this percept sequence to actions (one action at a time). Properties: Autonomous خود مختار Interacts with other agents plus the environment Reactive to the environment Pro-active (goal-directed) 3/13/2017 © Asst. Prof. Syed Faisal Ali 5 Agents & Environments an agent perceives its environment through sensors the complete set of inputs at a given time is called a percept the current percept, or a sequence of percepts may influence the actions of an agent it can change the environment through actuators an operation involving an actuator is called an action actions can be grouped into action sequences 3/13/2017 © Asst. Prof. Syed Faisal Ali 6 Examples of agents human agent eyes, ears, skin, taste buds, etc. for sensors hands, fingers, legs, mouth, etc. for actuators powered by muscles robot camera, infrared, bumper, etc. for sensors grippers, wheels, lights, speakers, etc. for actuators often powered by motors software agent functions as sensors information provided as input to functions in the form of encoded bit strings or symbols functions as actuators results deliver the output © Asst. Prof. Syed Faisal Ali 3/13/2017 7 Examples of Agents in different Types of Applications Agent type Percept Action Goals Environment Medical diagnosis system Symptoms, findings, patient’s answers Questions, tests, treatments Healthy patients, minimize costs Patient, hospital Satellite image analysis system Pixels of varying intensity, color Print a categorization of scene Correct categorization Images from orbiting satellite Part-Picking Robot Pixels of varying intensity Pick up parts and sort Place parts in correct into bins bins Refinery Controller Temperature, Pressure readings Open, close valves, adjust temperatures Maximize purity, Yield safety Refinery Interactive English tutor Typed Words Print exercises, suggestions, corrections Maximize student’s score on test Set of students 3/13/2017 © Asst. Prof. Syed Faisal Ali Conveyor belts with parts 8 Definition of Ideal Rational Agent Ideal Rational Agent: For each possible percept sequence, such an agent does whatever action is expected to maximize its performance measure, on the basis of the evidence provided by the percept sequence and whatever built-in knowledge the agent has. What do you think? Is this an acceptable definition? Not looking left when crossing the street: If I don’t see a car coming from the left, it is rational to cross the street? No. Should also consider taking information gathering actions. Limited/costly computation time Bounded rationality Limited/costly memory … 3/13/2017 © Asst. Prof. Syed Faisal Ali 9 Agents and their actions • a rational agent does “the right thing” • the action that leads to the best outcome under the given circumstances • an agent function maps percept sequences to actions • abstract mathematical description • an agent program is a concrete implementation of the respective function • it runs on a specific agent architecture (“platform”) problems: • what is “ the right thing” • how do you measure the “best outcome” 3/13/2017 © Asst. Prof. Syed Faisal Ali 10 Performance of Agents • criteria for measuring the outcome and the expenses of the agent • often subjective, but should be objective • task dependent • time may be important Example: vacuum agent • number of tiles cleaned during a certain period • based on the agent’s report, or validated by an objective authority • doesn’t consider expenses of the agent, side effects • energy, noise, loss of useful objects, damaged furniture, scratched floor • might lead to unwanted activities • agent re-cleans clean tiles, covers only part of the room, drops dirt on tiles to have more tiles to clean, etc. 3/13/2017 © Asst. Prof. Syed Faisal Ali Vacc. Agent 11 Rational Agent and OMNISCIENCE • a rational agent is not omniscient • it doesn’t know the actual outcome of its actions • it may not know certain aspects of its environment • rationality takes into account the limitations of the agent • percept sequence, background knowledge, feasible actions • it deals with the expected outcome of actions 3/13/2017 © Asst. Prof. Syed Faisal Ali 12 Environment Properties 1. 2. 3. 4. 5. 6. 7. fully observable vs. partially observable • sensors capture all relevant information from the environment deterministic vs. stochastic (non-deterministic) • changes in the environment are predictable episodic vs. sequential (non-episodic) • independent perceiving-acting episodes static vs. dynamic • no changes while the agent is “thinking” discrete vs. continuous • limited number of distinct percepts/actions single vs. multiple agents • interaction and collaboration among agents competitive, cooperative 3/13/2017 © Asst. Prof. Syed Faisal Ali 13 PEAS Description of Task Environment used for high-level characterization of agents Performance Measures used to evaluate how well an agent solves the task at hand Environment surroundings beyond the control of the agent Actuators determine the actions the agent can perform Sensors provide information about the current state of the environment 3/13/2017 © Asst. Prof. Syed Faisal Ali 14 PAGE Description used for high-level characterization of agents Percepts information acquired through the agent’s sensory system Actions operations performed by the agent on the environment through its actuators Goals desired outcome of the task with a measurable performance Environment surroundings beyond the control of the agent 3/13/2017 © Asst. Prof. Syed Faisal Ali 15 Vacuum Bot PEAS Description cleanliness of the floor time needed energy consumed Performance Measures Environment grid of tiles dirt on tiles possibly obstacles, varying amounts of dirt Actuators movement (wheels, tracks, legs, ...) dirt removal (nozzle, gripper, ...) Sensors 3/13/2017 position (tile ID reader, camera, GPS, ...) dirtiness (camera, sniffer, touch, ...) possibly movement (camera, wheel movement) © Asst. Prof. Syed Faisal Ali 16 Vacuum Bot PAGE Description Percepts Actions Goals tile properties like clean/dirty, empty/occupied movement and orientation pick up dirt, move desired outcome of the task with a measurable performance Environment surroundings beyond the control of the agent 3/13/2017 © Asst. Prof. Syed Faisal Ali 17 State Space for the Intelligent Vacuum Machine 3/13/2017 © Asst. Prof. Syed Faisal Ali 18 Agent’s Strategy Agent’s strategy is a mapping from percept sequence to action How to encode an agent’s strategy? Long list of what should be done for each possible percept sequence vs. shorter specification (e.g. algorithm) Example: Plan intelligent car route from home to UIT 3/13/2017 © Asst. Prof. Syed Faisal Ali 19 WARNING: Might not get what you ask for in the Performance Measure Cleaning robot Pick up as much trash as possible Vehicle route optimization Maximize utilizations => Driving fully loaded Capitalizing on oddities in tariff list => Renegotiation Don’t include solution method in the criterion 25% of all transportation in Dubai will be smart and driverless by 2030: Mohammad Bin Rashid 3/13/2017 © Asst. Prof. Syed Faisal Ali 20 agent = architecture + program In this course we concentrates on the program rather on Hardware Physical Agents Soft Agents Physical agents vs. software agents (software agents = softbots) 3/13/2017 © Asst. Prof. Syed Faisal Ali 21 Skeleton Agent function SKELETON-AGENT (percept) returns action static: memory, the agent’s memory of the world memory UPDATE-MEMORY(memory, percept) action CHOOSE-BEST-ACTION(memory) memory UPDATE-MEMORY(memory, action) return action On each invocation, the agent’s memory is updated to reflect the new percept, the best action is chosen, and the fact that the action was taken is also stored in the memory. The memory persists from one invocation to the next. Input = Percept, not history NOTE: Performance measure is not part of the agent 3/13/2017 © Asst. Prof. Syed Faisal Ali 22 Examples of how the agent function can be implemented More sophisticated 3/13/2017 1. Table-driven agent 2. Simple reflex agent 3. Reflex agent with internal state 4. Agent with explicit goals 5. Utility-based agent © Asst. Prof. Syed Faisal Ali 23 BREAK 3/13/2017 © Asst. Prof. Syed Faisal Ali 24 1. Table-driven agent function TABLE-DRIVEN-AGENT (percept) returns action static: percepts, a sequence, initially empty table, a table, indexed by percept sequences, initially fully specified append percept to the end of percepts action LOOKUP(percepts, table) return action An agent based on a pre-specified lookup table. It keeps track of percept sequence and just looks up the best action • Problems – Huge number of possible percepts (consider an automated taxi with a camera as the sensor) => lookup table would be huge – Takes long time to build the table – Not adaptive to changes in the environment; requires entire table to be updated if changes occur 3/13/2017 © Asst. Prof. Syed Faisal Ali 25 2. Simple reflex agent Differs from the lookup table based agent is that the condition (that determines the action) is already higher-level interpretation of the percepts Percepts could be e.g. the pixels on the camera of the automated taxi 3/13/2017 © Asst. Prof. Syed Faisal Ali 26 Simple Reflex Agent sensors Condition - action rules What action I should do now Environment What the world is like now effectors 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 3/13/2017 First match. No further matches sought. Only one level of deduction. A simple reflex agent works by finding a rule whose condition matches the current situation (as defined by the percept) and then doing the action associated with that rule. © Asst. Prof. Syed Faisal Ali 27 Simple reflex agent… • • 3/13/2017 Table lookup of condition-action pairs defining all possible condition-action rules necessary to interact in an environment • e.g. if car-in-front-is-breaking then initiate breaking Problems – Table is still too big to generate and to store (e.g. taxi) – Takes long time to build the table – No knowledge of non-perceptual parts of the current state – Not adaptive to changes in the environment; requires entire table to be updated if changes occur – Looping: Can’t make actions conditional © Asst. Prof. Syed Faisal Ali 28 3. Reflex agent with internal state … function REFLEX-AGENT-WITH-STATE (percept) returns action static: state, a description of the current world state rules, a set of condition-action rules state UPDATE-STATE (state, percept) rule RULE-MATCH (state, rules) action RULE-ACTION [rule] state UPDATE-STATE (state, action) return action A reflex agent with internal state works by finding a rule whose condition matches the current situation (as defined by the percept and the stored internal state) and then doing the action associated with that rule. 3/13/2017 © Asst. Prof. Syed Faisal Ali 29 3.Reflex agent with internal state sensors State How the world evolves What my actions do Condition - action rules Environment What the world is like now What action I should do now effectors 3/13/2017 © Asst. Prof. Syed Faisal Ali 30 Reflex agent with internal state … • Encode “internal state of the world to remember the past as contained in earlier percepts • Needed because sensors do no usually give the entire state of the world at each input, so perception of the environment is captured over time. “State” used to encode different “world states” that generate the same immediate percept • Requires ability to represent change in the world with/without the agent • one possibility is to represent just the latest state, but then cannot reason about hypothetical courses of action • Example: Rodney Brook’s Sub assumption Architecture. Main idea: build complex intelligent robots by decomposing behaviors into a hierarchy of skills, each completely defining a complete percept-action cycle for one very specific task. For example, avoiding contact, wandering, exploring, recognizing doorways, etc. Each behavior is Prof. modeled 3/13/2017 © Asst. Syed Faisalby Ali a finite-state machine with a few 31 4. Agent with explicit goals … • Choose actions so as to achieve a (given or computed) goal = a description of desirable situations. e.g. where the taxi wants to go • Keeping track of the current state is often not enough – need to add goals to decide which situations are good • Deliberative instead of reactive • May have to consider long sequences of possible actions before deciding if goal is achieved – involves considerations of the future, “what will happen if I do…?” (search and planning) • More flexible than reflex agent. (e.g. rain / new destination) In the reflex agent, the entire database of rules would have to be rewritten 3/13/2017 © Asst. Prof. Syed Faisal Ali 32 4. Agent with explicit goals sensors State How the world evolves What my actions do What it will be like if I do action A Goals Environment What the world is like now What action I should do now effectors 3/13/2017 © Asst. Prof. Syed Faisal Ali 33 5. Utility-based agent … • When there are multiple possible alternatives, how to decide which one is best? • A goal specifies a crude destination between a happy and unhappy state, but often need a more general performance measure that describes “degree of happiness” • Utility function U: State Reals indicating a measure of success or happiness when at a given state • Allows decisions comparing choice between conflicting goals, and choice between likelihood of success and importance of goal (if achievement is uncertain) 3/13/2017 © Asst. Prof. Syed Faisal Ali 34 5. Utility-based agent sensors State How the world evolves What the world is like now What my actions do Utility How happy I will be in such as a state Environment What it will be like if I do action A What action I should do now effectors 3/13/2017 © Asst. Prof. Syed Faisal Ali 35 Properties of environments Accessible (observable) : The agent’s sensory apparatus gives it access to the complete state of the environment Deterministic: The next state of the environment is completely determined by the current state and the actions selected by the agent Subjective non-determinism - Limited memory (poker) - Too complex environment to model directly (weather, dice) - Inaccessibility Episodic: The agent’s experience is divided into independent “episodes,” each episode consisting of agent perceiving and then acting. Quality of action depends just on the episode itself, because subsequent episodes do not depend on what actions occur in previous episodes. Do not need to think ahead 3/13/2017 © Asst. Prof. Syed Faisal Ali 36 Properties of environments … Static: If the environment can change while the agent is deliberating, then the environment is dynamic; otherwise it’s static. Need to worry about time Dynamic Need to observe while deliberating Discrete: There are a limited number of distinct, clearly defined percepts and actions we say that environment is discrete. 3/13/2017 © Asst. Prof. Syed Faisal Ali 37 PROPERTIES OF ENVIRONMENTS … Environment Accessible Deterministic Episodic Static Discrete Chess with a clock Yes Yes No Semi Yes Chess without a clock Yes Yes No Yes Yes Poker No No No Yes Yes Backgammon Yes No No Yes Yes Taxi Driving No No No No No Medical Diagnosis System No No No No No Image-analysis system Yes Yes Yes Semi No Part Picking robot No No Yes No No Refinery Controller No No No No No Interactive English Tutor No No No No Yes 3/13/2017 © Asst. Prof. Syed Faisal Ali 38 Running the agents and the environment procedure RUN-ENVIRONMENT (state, UPDATE-FN, agents, termination) inputs: state, the initial state of the environment UPDATE-FN, function to modify the environment agents, a set of agents termination, a predicate to test when we are done repeat for each agent in agents do PERCEPT[agent] GET-PERCEPT(agent,state) end for each agent in agents do ACTION[agent] PROGRAM[agent] (PERCEPT[agent]) end state UPDATE-FN(actions, agents, state) until termination (state) 3/13/2017 © Asst. Prof. Syed Faisal Ali 39 Question & Answer 3/13/2017 © Asst. Prof. Syed Faisal Ali 40 END OF LECTURE 1 3/13/2017 © Asst. Prof. Syed Faisal Ali 41
© Copyright 2024 Paperzz