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

54
Chapter 2 Intelligent Agents 1

Upload: dustin-williams

Post on 14-Dec-2015

241 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: Chapter 2 Intelligent Agents 1. Chapter 2 Intelligent Agents What is an agent ? An agent is anything that perceiving its environment through sensors(أجهزة

Chapter 2

Intelligent Agents

1

Page 2: Chapter 2 Intelligent Agents 1. Chapter 2 Intelligent Agents What is an agent ? An agent is anything that perceiving its environment through sensors(أجهزة

Chapter 2 Intelligent Agents

What is an agent ?An agent is anything that

perceiving its environment through sensors( أجهزة(االستشعار

acting upon that environment through actuators(المحركات)

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

2

Page 3: Chapter 2 Intelligent Agents 1. Chapter 2 Intelligent Agents What is an agent ? An agent is anything that perceiving its environment through sensors(أجهزة

Intelligent Agents

3

Page 4: Chapter 2 Intelligent Agents 1. Chapter 2 Intelligent Agents What is an agent ? An agent is anything that perceiving its environment through sensors(أجهزة

Diagram of an agent

What AI should fill 4

Page 5: Chapter 2 Intelligent Agents 1. Chapter 2 Intelligent Agents What is an agent ? An agent is anything that perceiving its environment through sensors(أجهزة

Simple Terms

PerceptAgent’s perceptual inputs at any given instant

Percept sequenceComplete history of everything that the agent

has ever perceived.

5

Page 6: Chapter 2 Intelligent Agents 1. Chapter 2 Intelligent Agents What is an agent ? An agent is anything that perceiving its environment through sensors(أجهزة

Agent function & programAgent’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

6

Page 7: Chapter 2 Intelligent Agents 1. Chapter 2 Intelligent Agents What is an agent ? An agent is anything that perceiving its environment through sensors(أجهزة

Vacuum-cleaner world

Perception: Clean or Dirty? where it is in?

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

7

Page 8: Chapter 2 Intelligent Agents 1. Chapter 2 Intelligent Agents What is an agent ? An agent is anything that perceiving its environment through sensors(أجهزة

Vacuum-cleaner world

8

Page 9: Chapter 2 Intelligent Agents 1. Chapter 2 Intelligent Agents What is an agent ? An agent is anything that perceiving its environment through sensors(أجهزة

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.

9

Page 10: Chapter 2 Intelligent Agents 1. Chapter 2 Intelligent Agents What is an agent ? An agent is anything that perceiving its environment through sensors(أجهزة

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

agents10

Page 11: Chapter 2 Intelligent Agents 1. Chapter 2 Intelligent Agents What is an agent ? An agent is anything that perceiving its environment through sensors(أجهزة

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

11

Page 12: Chapter 2 Intelligent Agents 1. Chapter 2 Intelligent Agents What is an agent ? An agent is anything that perceiving its environment through sensors(أجهزة

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

12

Page 13: Chapter 2 Intelligent Agents 1. Chapter 2 Intelligent Agents What is an agent ? An agent is anything that perceiving its environment through sensors(أجهزة

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 whatever built-in knowledge the agent has

E.g.(latin exempli gratia : for example), an examMaximize marks, based on the questions on the paper & your knowledge13

Page 14: Chapter 2 Intelligent Agents 1. Chapter 2 Intelligent Agents What is an agent ? An agent is anything that perceiving its environment through sensors(أجهزة

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

14

Page 15: Chapter 2 Intelligent Agents 1. Chapter 2 Intelligent Agents What is an agent ? An agent is anything that perceiving its environment through sensors(أجهزة

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

15

Page 16: Chapter 2 Intelligent Agents 1. Chapter 2 Intelligent Agents What is an agent ? An agent is anything that perceiving its environment through sensors(أجهزة

An omniscient agentKnows the actual outcome of its actions in

advanceNo other possible outcomesHowever, impossible in real world

An example

crossing a street but died of the fallen cargo(حمولة) door from 33,000ft(33 000 feet =10.0584 kilometers) irrational?

Omniscience( معرفة غير(محدودة

16

Page 17: Chapter 2 Intelligent Agents 1. Chapter 2 Intelligent Agents What is an agent ? An agent is anything that perceiving its environment through sensors(أجهزة

Based on the circumstance, it is rational.

As rationality maximizesExpected performance

Perfection maximizesActual performance

Hence rational agents are not omniscient.

Omniscience

17

Page 18: Chapter 2 Intelligent Agents 1. Chapter 2 Intelligent Agents What is an agent ? An agent is anything that perceiving its environment through sensors(أجهزة

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.

18

Page 19: Chapter 2 Intelligent Agents 1. Chapter 2 Intelligent Agents What is an agent ? An agent is anything that perceiving its environment through sensors(أجهزة

Autonomy (الحكم الذاتي)

If an agent just relies on Its own prior knowledge of its designerRather than its own percepts then the agent lacks(تفتقر) autonomy

E.g., a clockNo input (percepts)Run only but its own algorithm (prior

knowledge)No learning, no experience, etc.

19

Page 20: Chapter 2 Intelligent Agents 1. Chapter 2 Intelligent Agents What is an agent ? An agent is anything that perceiving its environment through sensors(أجهزة

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 : Software robots)Because all parts of the agent are software

Software Agents

20

Page 21: Chapter 2 Intelligent Agents 1. Chapter 2 Intelligent Agents What is an agent ? An agent is anything that perceiving its environment through sensors(أجهزة

Nature of environmentsTask environments are the problemsproblemsWhile the rational agents are the solutionssolutions

Specifying the task environmentPEAS description as fully as possible

PerformanceEnvironmentActuatorsSensors

Use automated taxi driver as an example

21

Page 22: Chapter 2 Intelligent Agents 1. Chapter 2 Intelligent Agents What is an agent ? An agent is anything that perceiving its environment through sensors(أجهزة

Nature of 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.

22

Page 23: Chapter 2 Intelligent Agents 1. Chapter 2 Intelligent Agents What is an agent ? An agent is anything that perceiving its environment through sensors(أجهزة

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

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

Nature of environments

23

Page 24: Chapter 2 Intelligent Agents 1. Chapter 2 Intelligent Agents What is an agent ? An agent is anything that perceiving its environment through sensors(أجهزة

Actuators (for outputs)Control over the accelerator, steering(توجيه),

gear shifting (نقل العتاد) and braking(فرملة)A 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

Nature of environments

24

Page 25: Chapter 2 Intelligent Agents 1. Chapter 2 Intelligent Agents What is an agent ? An agent is anything that perceiving its environment through sensors(أجهزة

A sketch of automated taxi driver

Nature of environments

25

Page 26: Chapter 2 Intelligent Agents 1. Chapter 2 Intelligent Agents What is an agent ? An agent is anything that perceiving its environment through sensors(أجهزة

Properties of EnvironmentsFully observable vs. Partially observableagent’s sensors access to the complete

state of the worldThe environment is effectively and fully

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

Partially observableA local dirt sensor of the cleaner cannot tellWhether other squares are clean or not

26

Page 27: Chapter 2 Intelligent Agents 1. Chapter 2 Intelligent Agents What is an agent ? An agent is anything that perceiving its environment through sensors(أجهزة

Deterministic (القطعية )vs. stochastic next state of the environment

Completely determined by the current stateand the agent’s actions

then the environment is deterministic Strategic: deterministic except the actions

from other agentsCleaner and taxi driver

Stochastic because of some unobservable aspects noise or unknown

Properties of Environments

27

Page 28: Chapter 2 Intelligent Agents 1. Chapter 2 Intelligent Agents What is an agent ? An agent is anything that perceiving its environment through sensors(أجهزة

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 simplerThe agent does not need to think ahead(قدما)

SequentialCurrent action may affect all future decisions

Properties of Environments

28

Page 29: Chapter 2 Intelligent Agents 1. Chapter 2 Intelligent Agents What is an agent ? An agent is anything that perceiving its environment through sensors(أجهزة

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 performance score does

Properties of Environments

29

Page 30: Chapter 2 Intelligent Agents 1. Chapter 2 Intelligent Agents What is an agent ? An agent is anything that perceiving its environment through sensors(أجهزة

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

clearly defined percepts and actions, the environment is discrete

E.g., the gear phase of a car: 1, 2, 3, 4, 5, RContinuous: 0~100, in between there may

exist real numbers

Properties of Environments

30

Page 31: Chapter 2 Intelligent Agents 1. Chapter 2 Intelligent Agents What is an agent ? An agent is anything that perceiving its environment through sensors(أجهزة

Single agent VS. multiagentPlaying a crossword puzzle – single agentChess playing (لعب الشطرنج) – two agentsCompetitive multiagent environment

Chess playingCooperative multiagent environment

Automated taxi driverAvoiding collision(تجنب االصطدام)

Properties of Environments

31

Page 32: Chapter 2 Intelligent Agents 1. Chapter 2 Intelligent Agents What is an agent ? An agent is anything that perceiving its environment through sensors(أجهزة

Examples of environments

32

Page 33: Chapter 2 Intelligent Agents 1. Chapter 2 Intelligent Agents What is an agent ? An agent is anything that perceiving its environment through sensors(أجهزة

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

33

Page 34: Chapter 2 Intelligent Agents 1. Chapter 2 Intelligent Agents What is an agent ? An agent is anything that perceiving its environment through sensors(أجهزة

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)The next figure but it is no good

34

Page 35: Chapter 2 Intelligent Agents 1. Chapter 2 Intelligent Agents What is an agent ? An agent is anything that perceiving its environment through sensors(أجهزة

Agent programs

Skeleton (هيكل عظمي )design of an agent program

Append = ألحق ; look up = بحث عن35

Page 36: Chapter 2 Intelligent Agents 1. Chapter 2 Intelligent Agents What is an agent ? An agent is anything that perceiving its environment through sensors(أجهزة

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

36

Page 37: Chapter 2 Intelligent Agents 1. Chapter 2 Intelligent Agents What is an agent ? An agent is anything that perceiving its environment through sensors(أجهزة

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, …37

Page 38: Chapter 2 Intelligent Agents 1. Chapter 2 Intelligent Agents What is an agent ? An agent is anything that perceiving its environment through sensors(أجهزة

Types of agent programs

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

38

Page 39: Chapter 2 Intelligent Agents 1. Chapter 2 Intelligent Agents What is an agent ? An agent is anything that perceiving its environment through sensors(أجهزة

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

39

Page 40: Chapter 2 Intelligent Agents 1. Chapter 2 Intelligent Agents What is an agent ? An agent is anything that perceiving its environment through sensors(أجهزة

Simple reflex agents

40

Page 41: Chapter 2 Intelligent Agents 1. Chapter 2 Intelligent Agents What is an agent ? An agent is anything that perceiving its environment through sensors(أجهزة

Simple reflex agents (2)

41

Page 42: Chapter 2 Intelligent Agents 1. Chapter 2 Intelligent Agents What is an agent ? An agent is anything that perceiving its environment through sensors(أجهزة

Model-based Reflex Agents For the world that is partially observable the agent has to keep track of an internal state

That depends on the percept historyReflecting some of the unobserved aspectsE.g., driving a car and changing lane

Requiring two types of knowledgeHow the world evolves independently of the

agentHow the agent’s actions affect the world

42

Page 43: Chapter 2 Intelligent Agents 1. Chapter 2 Intelligent Agents What is an agent ? An agent is anything that perceiving its environment through sensors(أجهزة

Model-based Reflex Agents

The agent is with memory43

Page 44: Chapter 2 Intelligent Agents 1. Chapter 2 Intelligent Agents What is an agent ? An agent is anything that perceiving its environment through sensors(أجهزة

Model-based Reflex Agents

44

Page 45: Chapter 2 Intelligent Agents 1. Chapter 2 Intelligent Agents What is an agent ? An agent is anything that perceiving its environment through sensors(أجهزة

Goal-based agents

Current state of the environment is always not enough

The goal is another issue to achieve Judgment of rationality / correctness

Actions chosen goals, based on the current state the current percept

45

Page 46: Chapter 2 Intelligent Agents 1. Chapter 2 Intelligent Agents What is an agent ? An agent is anything that perceiving its environment through sensors(أجهزة

Goal-based agents

ConclusionGoal-based agents are less efficientbut more flexible

Agent Different goals different tasksSearch and planning

two other sub-fields in AI to find out the action sequences to achieve its goal

46

Page 47: Chapter 2 Intelligent Agents 1. Chapter 2 Intelligent Agents What is an agent ? An agent is anything that perceiving its environment through sensors(أجهزة

Goal-based agents

47

Page 48: Chapter 2 Intelligent Agents 1. Chapter 2 Intelligent Agents What is an agent ? An agent is anything that perceiving its environment through sensors(أجهزة

Utility-based agents

Goals alone are not enough to generate high-qualityhigh-quality behavior E.g. meals in Canteen( وجبات الطعام في

? good or not ,(مقصف

Many action sequences the goals some are better and some worse If goal means success, then utility means the degree of success

(how successful it is) 48

Page 49: Chapter 2 Intelligent Agents 1. Chapter 2 Intelligent Agents What is an agent ? An agent is anything that perceiving its environment through sensors(أجهزة

Utility-based agents (4)

49

Page 50: Chapter 2 Intelligent Agents 1. Chapter 2 Intelligent Agents What is an agent ? An agent is anything that perceiving its environment through sensors(أجهزة

Utility-based agents

it is said state A has higher utility If state A is more preferred than others

Utility is therefore a function that maps a state onto a real number the degree of success

50

Page 51: Chapter 2 Intelligent Agents 1. Chapter 2 Intelligent Agents What is an agent ? An agent is anything that perceiving its environment through sensors(أجهزة

Utility-based agents (3)

Utility has several advantages: When there are conflicting goals,

Only some of the goals but not all can be achieved

utility describes the appropriate trade-off(مفاضله)

When there are several goals None of them are achieved certainlyutility provides a way for the decision-making

51

Page 52: Chapter 2 Intelligent Agents 1. Chapter 2 Intelligent Agents What is an agent ? An agent is anything that perceiving its environment through sensors(أجهزة

Learning AgentsAfter an agent is programmed, can it work immediately?No, it still need teaching

In AI,Once an agent is doneWe teach it by giving it a set of examplesTest it by using another set of examples

We then say the agent learnsA learning agent

52

Page 53: Chapter 2 Intelligent Agents 1. Chapter 2 Intelligent Agents What is an agent ? An agent is anything that perceiving its environment through sensors(أجهزة

Learning Agents

Four conceptual componentsLearning element

Making improvementPerformance element

Selecting external actionsCritic

Feedback from user or examples, good or not?Problem generator

New derived situation, try new solution or method53

Page 54: Chapter 2 Intelligent Agents 1. Chapter 2 Intelligent Agents What is an agent ? An agent is anything that perceiving its environment through sensors(أجهزة

Learning Agents

54