chapter 2 intelligent agents. chapter 2 intelligent agents what is an agent ? an agent is anything...

46
Chapter 2 Intelligent Agents

Upload: posy-hampton

Post on 01-Jan-2016

236 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Chapter 2 Intelligent Agents. Chapter 2 Intelligent Agents What is an agent ? An agent is anything that perceiving its environment through sensors and

Chapter 2

Intelligent Agents

Page 2: Chapter 2 Intelligent Agents. Chapter 2 Intelligent Agents What is an agent ? An agent is anything that perceiving its environment through sensors and

Chapter 2 Intelligent Agents

What is an agent ?An agent is anything that perceiving its

environment through sensors and acting upon that environment through actuators

Example: Human is an agentA robot is also an agent with cameras and motorsA thermostat detecting room temperature.

Page 3: Chapter 2 Intelligent Agents. Chapter 2 Intelligent Agents What is an agent ? An agent is anything that perceiving its environment through sensors and

Intelligent Agents

Page 4: Chapter 2 Intelligent Agents. Chapter 2 Intelligent Agents What is an agent ? An agent is anything that perceiving its environment through sensors and

Diagram of an agent

What AI should fill

Page 5: Chapter 2 Intelligent Agents. Chapter 2 Intelligent Agents What is an agent ? An agent is anything that perceiving its environment through sensors and

Simple Terms

PerceptAgent’s perceptual inputs at any given instant

Percept sequenceComplete history of everything that the agent

has ever perceived.

Page 6: Chapter 2 Intelligent Agents. Chapter 2 Intelligent Agents What is an agent ? An agent is anything that perceiving its environment through sensors and

Agent function & program

Agent’s behavior is mathematically described byAgent functionA function mapping any given percept

sequence to an action

Practically it is described by An agent programThe real implementation

Page 7: Chapter 2 Intelligent Agents. Chapter 2 Intelligent Agents What is an agent ? An agent is anything that perceiving its environment through sensors and

Vacuum-cleaner world

Perception: Clean or Dirty? where it is in?

Actions: Move left, Move right, suck, do nothing

Page 8: Chapter 2 Intelligent Agents. Chapter 2 Intelligent Agents What is an agent ? An agent is anything that perceiving its environment through sensors and

Vacuum-cleaner world

Page 9: Chapter 2 Intelligent Agents. Chapter 2 Intelligent Agents What is an agent ? An agent is anything that perceiving its environment through sensors and

Program implements the agent function tabulated in Fig. 2.3

Function Reflex-Vacuum-Agent([location,statuse]) return an action

If status = Dirty then return Suck

else if location = A then return Right

else if location = B then return left

Page 10: Chapter 2 Intelligent Agents. Chapter 2 Intelligent Agents What is an agent ? An agent is anything that perceiving its environment through sensors and

Concept of Rationality

Rational agentOne that does the right thing= every entry in the table for the agent

function is correct (rational).

What is correct?The actions that cause the agent to be

most successfulSo we need ways to measure success.

Page 11: Chapter 2 Intelligent Agents. Chapter 2 Intelligent Agents What is an agent ? An agent is anything that perceiving its environment through sensors and

Performance measurePerformance measureAn objective function that determines

How the agent does successfullyE.g., 90% or 30% ?

An agent, based on its percepts action sequence :

if desirable, it is said to be performing well.No universal performance measure for all

agents

Page 12: Chapter 2 Intelligent Agents. Chapter 2 Intelligent Agents What is an agent ? An agent is anything that perceiving its environment through sensors and

Performance measure

A general rule:Design performance measures according to

What one actually wants in the environmentRather than how one thinks the agent should

behave

E.g., in vacuum-cleaner worldWe want the floor clean, no matter how the

agent behaveWe don’t restrict how the agent behaves

Page 13: Chapter 2 Intelligent Agents. Chapter 2 Intelligent Agents What is an agent ? An agent is anything that perceiving its environment through sensors and

Rationality

What is rational at any given time depends on four things:The performance measure defining the criterion

of successThe agent’s prior knowledge of the environmentThe actions that the agent can performThe agents’s percept sequence up to now

Page 14: Chapter 2 Intelligent Agents. Chapter 2 Intelligent Agents What is an agent ? An agent is anything that perceiving its environment through sensors and

Rational agent For each possible percept sequence, an rational agent should select

an action expected to maximize its performance measure, given the evidence provided by the percept sequence and whatever built-in knowledge the agent has

E.g., an examMaximize marks, based on

the questions on the paper & your knowledge

Page 15: Chapter 2 Intelligent Agents. Chapter 2 Intelligent Agents What is an agent ? An agent is anything that perceiving its environment through sensors and

Example of a rational agent

Performance measureAwards one point for each clean square

at each time step, over 10000 time steps

Prior knowledge about the environmentThe geography of the environmentOnly two squaresThe effect of the actions

Page 16: Chapter 2 Intelligent Agents. Chapter 2 Intelligent Agents What is an agent ? An agent is anything that perceiving its environment through sensors and

Actions that can performLeft, Right, Suck and NoOp

Percept sequencesWhere is the agent?Whether the location contains dirt?

Under this circumstance, the agent is rational.

Example of a rational agent

Page 17: Chapter 2 Intelligent Agents. Chapter 2 Intelligent Agents What is an agent ? An agent is anything that perceiving its environment through sensors and

An omniscient agentKnows the actual outcome of its actions in

advanceNo other possible outcomesHowever, impossible in real world

An examplecrossing a street but died of the fallen

cargo door from 33,000ft irrational?

Omniscience

Page 18: Chapter 2 Intelligent Agents. Chapter 2 Intelligent Agents What is an agent ? An agent is anything that perceiving its environment through sensors and

Based on the circumstance, it is rational.

As rationality maximizesExpected performance

Perfection maximizesActual performance

Hence rational agents are not omniscient.

Omniscience

Page 19: Chapter 2 Intelligent Agents. Chapter 2 Intelligent Agents What is an agent ? An agent is anything that perceiving its environment through sensors and

Learning

Does a rational agent depend on only current percept?No, the past percept sequence should also

be usedThis is called learningAfter experiencing an episode, the agent

should adjust its behaviors to perform better for the same job next time.

Page 20: Chapter 2 Intelligent Agents. Chapter 2 Intelligent Agents What is an agent ? An agent is anything that perceiving its environment through sensors and

Autonomy

If an agent just relies on the prior knowledge of its designer rather than its own percepts then the agent lacks autonomy

A rational agent should be autonomous- it should learn what it can to compensate for partial or incorrect prior knowledge.E.g., a clock No input (percepts) Run only but its own algorithm (prior knowledge) No learning, no experience, etc.

Page 21: Chapter 2 Intelligent Agents. Chapter 2 Intelligent Agents What is an agent ? An agent is anything that perceiving its environment through sensors and

Sometimes, the environment may not be the real worldE.g., flight simulator, video games, InternetThey are all artificial but very complex

environmentsThose agents working in these environments

are calledSoftware agent (softbots)Because all parts of the agent are software

Software Agents

Page 22: Chapter 2 Intelligent Agents. Chapter 2 Intelligent Agents What is an agent ? An agent is anything that perceiving its environment through sensors and

Task environmentsTask environments are the problemsproblems While the rational agents are the solutionssolutions

Specifying the task environment PEAS description as fully as possible

Performance Environment Actuators Sensors

In designing an agent, the first step must always be to specify the task environment as fully as possible.

Use automated taxi driver as an example

Page 23: Chapter 2 Intelligent Agents. Chapter 2 Intelligent Agents What is an agent ? An agent is anything that perceiving its environment through sensors and

Task environments

Performance measureHow can we judge the automated driver?Which factors are considered?

getting to the correct destinationminimizing fuel consumptionminimizing the trip time and/or costminimizing the violations of traffic lawsmaximizing the safety and comfort, etc.

Page 24: Chapter 2 Intelligent Agents. Chapter 2 Intelligent Agents What is an agent ? An agent is anything that perceiving its environment through sensors and

EnvironmentA taxi must deal with a variety of roadsTraffic lights, other vehicles, pedestrians,

stray animals, road works, police cars, etc. Interact with the customer

Task environments

Page 25: Chapter 2 Intelligent Agents. Chapter 2 Intelligent Agents What is an agent ? An agent is anything that perceiving its environment through sensors and

Actuators (for outputs)Control over the accelerator, steering, gear

shifting and brakingA display to communicate with the

customers

Sensors (for inputs)Detect other vehicles, road situationsGPS (Global Positioning System) to know

where the taxi is Many more devices are necessary

Task environments

Page 26: Chapter 2 Intelligent Agents. Chapter 2 Intelligent Agents What is an agent ? An agent is anything that perceiving its environment through sensors and

A sketch of automated taxi driver

Task environments

Page 27: Chapter 2 Intelligent Agents. Chapter 2 Intelligent Agents What is an agent ? An agent is anything that perceiving its environment through sensors and

Properties of task environments

Fully observable vs. Partially observable If an agent’s sensors give it access to the

complete state of the environment at each point in time then the environment is effectively and fully observable

if the sensors detect all aspectsThat are relevant to the choice of action

Page 28: Chapter 2 Intelligent Agents. Chapter 2 Intelligent Agents What is an agent ? An agent is anything that perceiving its environment through sensors and

Partially observable

An environment might be Partially observable because of noisy and inaccurate sensors or because parts of the state are simply missing from the sensor data.

Example: A local dirt sensor of the cleaner cannot tell Whether other squares are clean or not

Page 29: Chapter 2 Intelligent Agents. Chapter 2 Intelligent Agents What is an agent ? An agent is anything that perceiving its environment through sensors and

Deterministic vs. stochastic next state of the environment Completely

determined by the current state and the actions executed by the agent, then the environment is deterministic, otherwise, it is Stochastic.

-Cleaner and taxi driver are:Stochastic because of some unobservable

aspects noise or unknown

Properties of task environments

Page 30: Chapter 2 Intelligent Agents. Chapter 2 Intelligent Agents What is an agent ? An agent is anything that perceiving its environment through sensors and

Episodic vs. sequential An episode = agent’s single pair of perception & action The quality of the agent’s action does not depend on

other episodes Every episode is independent of each other

Episodic environment is simpler The agent does not need to think ahead

Sequential Current action may affect all future decisions

-Ex. Taxi driving and chess.

Properties of task environments

Page 31: Chapter 2 Intelligent Agents. Chapter 2 Intelligent Agents What is an agent ? An agent is anything that perceiving its environment through sensors and

Static vs. dynamic A dynamic environment is always changing

over time E.g., the number of people in the street

While static environment E.g., the destination

Semidynamicenvironment is not changed over timebut the agent’s performance score does

Properties of task environments

Page 32: Chapter 2 Intelligent Agents. Chapter 2 Intelligent Agents What is an agent ? An agent is anything that perceiving its environment through sensors and

Discrete vs. continuous If there are a limited number of distinct

states, clearly defined percepts and actions, the environment is discrete

E.g., Chess gameContinuous: Taxi driving

Properties of task environments

Page 33: Chapter 2 Intelligent Agents. Chapter 2 Intelligent Agents What is an agent ? An agent is anything that perceiving its environment through sensors and

Single agent VS. multiagentPlaying a crossword puzzle – single agentChess playing – two agentsCompetitive multiagent environment

Chess playingCooperative multiagent environment

Automated taxi driverAvoiding collision

Properties of task environments

Page 34: Chapter 2 Intelligent Agents. Chapter 2 Intelligent Agents What is an agent ? An agent is anything that perceiving its environment through sensors and

Properties of task environments

Known vs. unknownThis distinction refers not to the environment itslef but to

the agent’s (or designer’s) state of knowledge about the environment.

-In known environment, the outcomes for all actions are

given. ( example: solitaire card games).

- If the environment is unknown, the agent will have to learn how it works in order to make good decisions.( example: new video game).

Page 35: Chapter 2 Intelligent Agents. Chapter 2 Intelligent Agents What is an agent ? An agent is anything that perceiving its environment through sensors and

Examples of task environments

Page 36: Chapter 2 Intelligent Agents. Chapter 2 Intelligent Agents What is an agent ? An agent is anything that perceiving its environment through sensors and

Structure of agents

Page 37: Chapter 2 Intelligent Agents. Chapter 2 Intelligent Agents What is an agent ? An agent is anything that perceiving its environment through sensors and

Structure of agents

Agent = architecture + programArchitecture = some sort of computing

device (sensors + actuators) (Agent) Program = some function that

implements the agent mapping = “?”Agent Program = Job of AI

Page 38: Chapter 2 Intelligent Agents. Chapter 2 Intelligent Agents What is an agent ? An agent is anything that perceiving its environment through sensors and

Agent programs

Input for Agent ProgramOnly the current percept

Input for Agent FunctionThe entire percept sequenceThe agent must remember all of them

Implement the agent program asA look up table (agent function)

Page 39: Chapter 2 Intelligent Agents. Chapter 2 Intelligent Agents What is an agent ? An agent is anything that perceiving its environment through sensors and

Agent programs

Skeleton design of an agent program

Page 40: Chapter 2 Intelligent Agents. Chapter 2 Intelligent Agents What is an agent ? An agent is anything that perceiving its environment through sensors and

Agent Programs

P = the set of possible percepts

T= lifetime of the agentThe total number of percepts it receives

Size of the look up table

Consider playing chessP =10, T=150Will require a table of at least 10150 entries

T

t

tP

1

Page 41: Chapter 2 Intelligent Agents. Chapter 2 Intelligent Agents What is an agent ? An agent is anything that perceiving its environment through sensors and

Agent programsDespite of huge size, look up table does what we want.

The key challenge of AIFind out how to write programs that, to the

extent possible, produce rational behaviorFrom a small amount of codeRather than a large amount of table entries

E.g., a five-line program of Newton’s MethodV.s. huge tables of square roots, sine, cosine,

Page 42: Chapter 2 Intelligent Agents. Chapter 2 Intelligent Agents What is an agent ? An agent is anything that perceiving its environment through sensors and

Types of agent programs

Four typesSimple reflex agentsModel-based reflex agentsGoal-based agentsUtility-based agents

Page 43: Chapter 2 Intelligent Agents. Chapter 2 Intelligent Agents What is an agent ? An agent is anything that perceiving its environment through sensors and

Simple reflex agentsIt uses just condition-action rulesThe rules are like the form “if … then …” efficient but have narrow range of applicabilityBecause knowledge sometimes cannot be

stated explicitly Work only

if the environment is fully observable

Page 44: Chapter 2 Intelligent Agents. Chapter 2 Intelligent Agents What is an agent ? An agent is anything that perceiving its environment through sensors and

Simple reflex agents

Page 45: Chapter 2 Intelligent Agents. Chapter 2 Intelligent Agents What is an agent ? An agent is anything that perceiving its environment through sensors and

Simple reflex agents (2)

Page 46: Chapter 2 Intelligent Agents. Chapter 2 Intelligent Agents What is an agent ? An agent is anything that perceiving its environment through sensors and

A Simple Reflex Agent in Naturepercepts(size, motion)

RULES:(1) If small moving object, then activate SNAP(2) If large moving object, then activate AVOID and inhibit SNAPELSE (not moving) then NOOP

Action: SNAP or AVOID or NOOPneeded forcompleteness