Docsity

Agents - Introduction to Artificial Intelligence | CS 440, Study notes of Computer Science

Toggle sidebar
bg1
1
Agents
Agents
Lecture #2
Lecture #2
8/28/08
8/28/08
What is an agent?
What is an agent?
According to your text:
According to your text:
“
“An
An agent
agent is anything that can be viewed as
is anything that can be viewed as
perceiving its
perceiving its environment
environment through
through sensors
sensors
and acting on that environment through
and acting on that environment through
actuators
actuators.
.”
”(p. 32)
(p. 32)
Caveat
Caveat
Your book also says:
Your book also says:
“
“the notion of an agent is meant to be a tool for
the notion of an agent is meant to be a tool for
analyzing systems, not an absolute
analyzing systems, not an absolute
characterization that divides the world into
characterization that divides the world into
agents and non
agents and non-
-agents. One could view a
agents. One could view a
hand
hand-
-held calculator as an agent that chooses
held calculator as an agent that chooses
the action of displaying
the action of displaying “
“4
4”
”when given the
when given the
percept sequence
percept sequence “
“2+2=
2+2= ”
”,
, but such an
but such an
analysis would hardly aid our understanding
analysis would hardly aid our understanding
of the calculator
of the calculator.
.”
”(p. 34, emphasis mine)
(p. 34, emphasis mine)
Examples of agents
Examples of agents
Taxi driver
Taxi driver
Internet shopper
Internet shopper
Backgammon player
Backgammon player
Chemical plant controller
Chemical plant controller
Spam detector
Spam detector
Agents
Agents
Environment
?
?
sensors
Actuators
(my redrawing of Figure 2.1 in your text)
Actions
Percepts1
1) This is a poor choice of words on Russell & Norvig’s part. It would be more consistent with the
psychology & philosophy literature to say that the environment provided stimuli, and perceptsare the
agent’s interpretations of the stimuli. But we will use R&N’sterminology.
The agent and the environment
The agent and the environment
An agent:
An agent:
Works in a particular environment
Works in a particular environment
Has goals
Has goals
Perceives the environment
Perceives the environment
Performs actions to achieve its goals.
Performs actions to achieve its goals.
pf3
pf4
pf5

Partial preview of the text

Download Agents - Introduction to Artificial Intelligence | CS 440 and more Study notes Computer Science in PDF only on Docsity!

AgentsAgents

Lecture #2Lecture

What is an agent?What is an agent?

According to your text: According to your text:

““AnAn agentagent is anything that can be viewed asis anything that can be viewed as
perceiving itsperceiving its environmentenvironment throughthrough sensorssensors
and acting on that environment throughand acting on that environment through
actuatorsactuators ..”” (p. 32)(p. 32)

CaveatCaveat

Your book also says:Your book also says:

““the notion of an agent is meant to be a tool forthe notion of an agent is meant to be a tool for
analyzing systems, not an absoluteanalyzing systems, not an absolute
characterization that divides the world intocharacterization that divides the world into
agents and nonagents and non--agents. One could view aagents. One could view a
handhand--held calculator as an agent that choosesheld calculator as an agent that chooses
the action of displayingthe action of displaying ““44”” when given thewhen given the
percept sequencepercept sequence ““2+2=2+2= ””,,^ but such anbut such an
analysis would hardly aid our understandinganalysis would hardly aid our understanding
of the calculatorof the calculator ..”” (p. 34, emphasis mine)(p. 34, emphasis mine)

Examples of agentsExamples of agents

Taxi driver Taxi driver

Internet shopper Internet shopper

Backgammon player Backgammon player

Chemical plant controller Chemical plant controller

Spam detector Spam detector

AgentsAgents

Environment
sensors
Actuators
(my redrawing of Figure 2.1 in your text)

Actions

Percepts 1

  1. This is a poor choice of words on Russell & Norvig’s part. It would be more consistent with the psychology & philosophy literature to say that the environment provided stimuli , and percepts are the agent’s interpretations of the stimuli. But we will use R&N’s terminology.

The agent and the environmentThe agent and the environment

An agent:An agent:

Works in a particular environment Works in a particular environment

Has goals Has goals

Perceives the environment Perceives the environment

Performs actions to achieve its goals. Performs actions to achieve its goals.

Formalizing Task EnvironmentsFormalizing Task Environments

(PEAS)(PEAS)

P: PerformanceP: Performance
This is all important: it defines the goal This is all important: it defines the goal
E: EnvironmentE: Environment
This defines the world the agent lives in This defines the world the agent lives in
A: ActuatorsA: Actuators
This defines how the agent can change the world This defines how the agent can change the world
S: SensorsS: Sensors
This defines how the agent sees the world (and how much This defines how the agent sees the world (and how much
of the word the agent can see)of the word the agent can see)

Example: the automated taxiExample: the automated taxi

driverdriver

Environment: Environment:
  • – Roads, other traffic, pedestrians, other impedimentsRoads, other traffic, pedestrians, other impediments
Sensors: Sensors:
  • – Cameras, engine sensors, laser range finders, GPS,Cameras, engine sensors, laser range finders, GPS,
keyboard, microphonekeyboard, microphone
Actuators: Actuators:
  • – Steering, accelerator, brake, turn signal, horn.Steering, accelerator, brake, turn signal, horn.
Possible Performance Measures: Possible Performance Measures:
  • – Safety, speed, legality, comfort, profit.Safety, speed, legality, comfort, profit.

Formalizing AgentsFormalizing Agents

Agent functions map sequences ofAgent functions map sequences of
percepts onto actionspercepts onto actions

f P → A

Formalizing Agents (II) Formalizing Agents (II)

Really? Do you believe the last slide? Really? Do you believe the last slide?

How about… How about…

f ( P A ) → A

EnvironmentsEnvironments

DiscreteDiscrete

StaticStatic

AgentsAgents

EpisodicEpisodic

DeterministicDeterministic

ObservableObservable fullyfully fullyfully ?? partiallypartially

InternetInternet TaxiTaxi shoppingshopping

CrosswordCrossword BackgammonBackgammon puzzlepuzzle

Fully vs. partially observable : can the sensors detect all aspects that are relevant to the choice of action.

Environments Environments

DiscreteDiscrete

StaticStatic

AgentsAgents

EpisodicEpisodic

DeterministicDeterministic deterministicdeterministic stochasticstochastic ?? stochasticstochastic

ObservableObservable fullyfully fullyfully ?? partiallypartially

InternetInternet TaxiTaxi shoppingshopping

CrosswordCrossword BackgammonBackgammon puzzlepuzzle

Deterministic vs. stochastic : is the next environment state completely determined by the current state?

A simple agent functionA simple agent function

def REFLEX-VACUUM-AGENT ( location, status ) : if status == Dirty : return Suck else if location == A : return Right else if location == B : return Left

Is this the best agent for the job?

Rational agents Rational agents

A A (^) rational agentrational agent is one that does the right thing.is one that does the right thing. What is the right thing? What is the right thing?

  • –^ Approximation: the mostApproximation: the most^ succesfullsuccesfull^ agent.agent.
  • –^ Measure of success?Measure of success?

Performance measure according to what is wanted in the Performance measure according to what is wanted in the environment (goal).environment (goal). Performance measures for the vacuum world: Performance measures for the vacuum world:

  • – The amount of dirt cleaned per unit time.The amount of dirt cleaned per unit time.
  • – How much energy was spent on moving and cleaning.How much energy was spent on moving and cleaning.

RationalityRationality

What is rational at a given time depends on:What is rational at a given time depends on:
  • – Performance measure.Performance measure.
  • – The available actions.The available actions.
  • – The builtThe built--in knowledge about the environment.in knowledge about the environment.
  • – Percept sequence to date (sensors).Percept sequence to date (sensors).
A rational agent chooses an action which maximizes theA rational agent chooses an action which maximizes the
expected value of the performance measure given theexpected value of the performance measure given the
percept sequence and its builtpercept sequence and its built--in knowledge.in knowledge.

The Structure of AgentsThe Structure of Agents

A sequence of progressively moreA sequence of progressively more

sophisticated agentssophisticated agents……

1.1. Reflex agentsReflex agents
2.2.^ ModelModel--based reflex agentsbased reflex agents
3.3. GoalGoal--based agentsbased agents
4.4. UtilityUtility--based agentsbased agents
5.5. Learning agentsLearning agents

Reflex AgentReflex Agent

Selects action only on theSelects action only on the

basis of the currentbasis of the current perceptpercept

Large reduction inLarge reduction in

possible percept/actionpossible percept/action combinationscombinations

function REFLEX-VACUUM-AGENT ([ location, status ]) if status == Dirty then return Suck else if location == A then return Right else if location == B then return Left

Simple reflex agentSimple reflex agent

functionfunction^ SIMPLE-SIMPLE-REFLEXREFLEX--AGENT(AGENT( perceptpercept ))^ returnsreturns^ an actionan action

static static :: (^) rulesrules , a set of condition, a set of condition--action rulesaction rules

state state (^) ←← (^) INTERPRETINTERPRET--INPUT(INPUT( perceptpercept )) rule rule (^) ←← (^) RULERULE--MATCH(MATCH( statestate ,, rulerule )) action action ←← RULERULE--ACTION[ACTION[ rulerule ]] returnreturn actionaction

Will only work if the environment isWill only work if the environment is fully observablefully observable
Our taxiOur taxi--driver agent would not work as a simple reflexdriver agent would not work as a simple reflex
agent!agent!

ModelModel--based reflex agentbased reflex agent

Maintain an internalMaintain an internal
statestate
Update the state usingUpdate the state using
information oninformation on ““how thehow the
world worksworld works”” (the model(the model
of the world)of the world)
TaxiTaxi--driver agent: needsdriver agent: needs
to keep track of cars into keep track of cars in
his blind spothis blind spot

Goal- Goal-based agentsbased agents

Our taxi- Our taxi-driver agentdriver agent
needs to get somewhere:needs to get somewhere:
it has ait has a goalgoal. Chooses. Chooses
actions to achieve goal.actions to achieve goal.
Search Search andand planningplanning
are subfields of AI are subfields of AI
devoted to finding adevoted to finding a
sequence of actions thatsequence of actions that
achive the agentachivethe agent’’s goals.s goals.

UtilityUtility--based agentsbased agents

Utility function maps aUtility function maps a
(sequence of) state(s) onto a(sequence of) state(s) onto a
real number.real number.
Certain goals can be reachedCertain goals can be reached
in different ways.in different ways.
  • – Some are better, have a higherSome are better, have a higher utility.utility.
Improves on goals:Improves on goals:
  • – Selecting between conflictingSelecting between conflicting goalsgoals
  • – Select appropriately betweenSelect appropriately between several goals that have varyingseveral goals that have varying probability of success.probability of success.

Learning agentsLearning agents

All previous agent- All previous agent-programsprograms
describe methods fordescribe methods for
selectingselecting actionsactions ..
  • – Yet it does not explain theYet it does not explain the
origin of these programs.origin of these programs.
  • – Learning mechanisms canLearning mechanisms can
be used to perform this task.be used to perform this task.
  • – Teach them instead ofTeach them instead of
instructing them.instructing them.
  • – Advantage is the robustnessAdvantage is the robustness
of the program towardof the program toward
initially unknowninitially unknown
environments.environments.

Learning agentsLearning agents

Performance elementPerformance element : selecting: selecting actions based on percepts.actions based on percepts.

  • – Corresponds to the previous agentCorresponds to the previous agent programsprograms Learning elementLearning element : introduce: introduce improvements in performanceimprovements in performance element.element.
  • – Critic provides feedback on agentsCritic provides feedback on agents performance based on fixedperformance based on fixed performance standard.performance standard. Problem generatorProblem generator : suggests: suggests actions that will lead to new andactions that will lead to new and informative experiences.informative experiences.
  • – Exploration vs. exploitationExploration vs. exploitation

For TuesdayFor Tuesday

On Tuesday we start talking about search. On Tuesday we start talking about search.

Please read Sections 3-Please read Sections 3-3.5 in your text.3.5 in your text.