Transcript session02
Artificial Intelligence
Chapter 2 Agents
AI chapter 2
What is an (Intelligent) Agent?
• An over-used, over-loaded, and misused term.
Anything that can be viewed as perceiving its environment
through sensors and acting upon that environment through its
effectors to maximize progress towards its goals.
• Perception
• Sensors receive input from environment
• Keyboard clicks
• Camera data
• Action
• Actuators impact the environment
• Move a robotic arm
• Generate output for computer display
AI chapter 2
Perception
• Percept
• Perceptual inputs at an instant
• May include perception of internal state
• Percept Sequence
• Complete history of all prior percepts
• Do you need a percept sequence to play
Chess?
AI chapter 2
What is an (Intelligent) Agent?
• PAGE (Percepts, Actions, Goals, Environment)
• Task-specific & specialized: well-defined goals
and environment
• The notion of an agent is meant to be a tool for
analyzing systems,
• It is not a different hardware or new programming
languages
AI chapter 2
Intelligent Agents and Artificial
Intelligence
• Distributed decision-making
and control
AI chapter 2
effectors
sensors
• Example: Human mind as network of
thousands or millions of agents working in
parallel. To produce real artificial
intelligence, this school holds, we should
build computer systems that also Agency
contain
many agents and systems for arbitrating
among the agents' competing results.
Agent Types
We can split agent research into two main
strands:
• Distributed Artificial Intelligence (DAI) –
Multi-Agent Systems (MAS)
(1980 –
1990)
• Much broader notion of "agent" (1990’s
– present)
AI chapter 2
Intelligent Agents
Chapter 2
Outline
• Agents and environments
• Rationality
• PEAS (Performance measure, Environment,
Actuators, Sensors)
• Environment types
• Agent types
AI chapter 2
Agents
• An agent is anything that 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
•
AI chapter 2
Agents and environments
• The agent function maps from percept histories to
actions:
•
[f: P* A]
• The agent program runs on the physical architecture to
produce f
•
• agent = architecture + program
AI chapter 2
•
Vacuum-cleaner world
• Percepts: location and contents, e.g., [A,Dirty]
•
• Actions: Left, Right, Suck, NoOp
•
AI chapter 2
A vacuum-cleaner agent
• \input{tables/vacuum-agent-function-table}
•
AI chapter 2
Rational agents
• 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.
•
AI chapter 2
Rational agents
• 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.
•
AI chapter 2
Rational agents
• Rationality is distinct from omniscience (allknowing 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)
•
AI chapter 2
PEAS
• PEAS: Performance measure, Environment, Actuators,
Sensors
• Must first specify the setting for intelligent agent design
•
• Consider, e.g., the task of designing an automated taxi
driver:
•
•
•
•
•
•
•
Performance measure
Environment
Actuators
Sensors
AI chapter 2
PEAS
• Must first specify the setting for intelligent agent design
•
• 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
•
AI chapter 2
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)
AI chapter 2
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
AI chapter 2
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
AI chapter 2
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.
•
AI chapter 2
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.
•
AI chapter 2
Environment types
Fully observable Yes
Deterministic
Episodic
Static
Discrete
Yes
Single agent
•
•
•
•
Chess with
Chess without
a clock
a clock
Yes
No
Strategic Strategic No
No
No
Semi
Yes
Yes
No
No
No
Taxi driving
No
No
No
The environment type largely determines the agent design
The real world is (of course) partially observable, stochastic, sequential,
dynamic, continuous, multi-agent
AI chapter 2
Agent functions and programs
• An agent is completely specified by the agent
function mapping percept sequences to actions
• One agent function (or a small equivalence
class) is rational
•
• Aim: find a way to implement the rational agent
function concisely
•
AI chapter 2
Table-lookup agent
• \input{algorithms/table-agent-algorithm}
•
• Drawbacks:
•
•
•
•
Huge table
Take a long time to build the table
No autonomy
Even with learning, need a long time to learn the
table entries
AI chapter 2
Agent program for a vacuum-cleaner
agent
• \input{algorithms/reflex-vacuum-agentalgorithm}
•
AI chapter 2
Agent types
• Four basic types in order of increasing
generality:
•
• Simple reflex agents
• Model-based reflex agents
• Goal-based agents
• Utility-based agents
AI chapter 2
Simple reflex agents
AI chapter 2
Simple reflex agents
• \input{algorithms/d-agent-algorithm}
•
AI chapter 2
Model-based reflex agents
AI chapter 2
Model-based reflex agents
• \input{algorithms/d+-agent-algorithm}
•
AI chapter 2
Goal-based agents
AI chapter 2
Utility-based agents
AI chapter 2
Learning agents
AI chapter 2
Rational Agents
How to design this?
Sensors
percepts
?
Agent
Environment
actions
Effectors
AI chapter 2
Interacting Agents
Collision Avoidance Agent (CAA)
• Goals:
Avoid running into obstacles
• Percepts ?
• Sensors?
• Effectors ?
•Lane
Actions
Keeping ?
Agent (LKA)
•• Goals:
Stay inFreeway
current lane
Environment:
•
•
•
•
•
Percepts ?
Sensors?
Effectors ?
Actions ?
Environment: Freeway
AI chapter 2
Interacting Agents
Collision Avoidance Agent (CAA)
• Goals:
Avoid running into obstacles
• Percepts: Obstacle distance, velocity, trajectory
• Sensors: Vision, proximity sensing
• Effectors:
Steering Wheel, Accelerator,
Brakes,
Horn,(LKA)
Headlights
Lane
Keeping Agent
•• Goals:
in current
laneup, brake, blow horn,
Actions: Stay
Steer,
speed
• Percepts:
Lane center, lane boundaries
signal (headlights)
• Sensors:
Vision
•• Environment:
Freeway
Effectors:
Steering Wheel, Accelerator, Brakes
• Actions:
Steer, speed up, brake
• Environment: Freeway
AI chapter 2
Conflict Resolution by Action Selection
Agents
• Override:
CAA overrides LKA
• Arbitrate:
if Obstacle is Close then CAA
else LKA
• Compromise:
Choose action that satisfies both
agents
• Any combination of the above
• Challenges:
Doing the right thing
AI chapter 2
The Right Thing = The Rational Action
• Rational Action: The action that
maximizes the expected value of the
performance measure given the percept
sequence to date
•
•
•
•
•
Rational
Rational
Rational
Rational
Rational
=
=
=
=
=
Best ?
Optimal ?
Omniscience ?
Clairvoyant ?
Successful ?
AI chapter 2
The Right Thing = The Rational Action
• Rational Action: The action that maximizes the
expected value of the performance measure given
the percept sequence to date
• Rational = Best
Yes, to the best of its
knowledge
• Rational = Optimal
Yes, to the best of its abilities
(incl.
• Rational Omniscience(全知)
its constraints)
• Rational Clairvoyant(有超人力)
• Rational Successful
AI chapter 2
Behavior and performance of IAs
• Perception (sequence) to Action
Mapping: f : P* A
• Ideal mapping: specifies which actions an
agent ought to take at any point in time
• Description: Look-Up-Table, Closed Form, etc.
• Performance measure: a subjective
measure to characterize how successful an
agent is (e.g., speed, power usage,
accuracy, money, etc.)
AI chapter 2
Look up table
Distanc
Action
e
10
5
2
No action
Turn left
30
degrees
Stop
AI chapter 2
obstacle
sensor
agent
Closed form
• Output (degree of rotation) = F(distance)
• E.g., F(d) = 10/d
less than 1/10)
(distance cannot be
AI chapter 2
How is an Agent different from other
software?
• Agents are autonomous, that is, they
act on behalf of the user
• Agents contain some level of
intelligence, from fixed rules to learning
engines that allow them to adapt to
changes in the environment
chapter
2
• Agents don't only AIact
reactively,
but
How is an Agent different from other
software?
• Agents have social ability, that is, they
communicate with the user, the system,
and other agents as required
• Agents may also cooperate with other
agents to carry out more complex tasks
than they themselves can handle
AI chapterfrom
2
• Agents may migrate
one system to
Environment Types
• Characteristics
• Accessible vs. inaccessible
• Deterministic vs. nondeterministic
• Episodic vs. nonepisodic
• Hostile vs. friendly
• Static vs. dynamic
• Discrete vs. continuous
AI chapter 2
Environment Types
• Characteristics
• Accessible vs. inaccessible
• Sensors give access to complete state
of the environment.
• Deterministic vs. nondeterministic
• The next state can be determined based
on the current state and the action.
AI chapter 2
• Episodic vs. nonepisodic
(Sequential)
Environment Types
• Characteristics
• Hostile vs. friendly
• Static vs. dynamic
• Dynamic if the environment changes
during deliberation
• Discrete vs. continuous
• Chess vs. driving
AI chapter 2
Environment types
Environme Accessi Determin Episodi Static Discrete
nt
ble
istic
c
Operating
System
Virtual
Reality
Office
Environme
nt
AI chapter 2
Mars
Environment types
Environme Accessi Determin Episodi Static Discrete
nt
ble
istic
c
Operating Yes
Yes
No
No
Yes
System
Virtual
Reality
Office
Environme
nt
AI chapter 2
Mars
Environment types
Environme
nt
Operating
System
Virtual
Reality
Office
Environme
nt
Mars
Accessi Determin Episodi Static Discrete
ble
istic
c
Yes
Yes
No
No
Yes
Yes
Yes
Yes/no No
AI chapter 2
Yes/no
Environment types
Environme
nt
Operating
System
Virtual
Reality
Office
Environme
nt
Mars
Accessi Determin Episodi Static Discrete
ble
istic
c
Yes
Yes
No
No
Yes
Yes
Yes
Yes/no No
Yes/no
No
No
No
No
AI chapter 2
No
Environment types
Environme Accessi Determin Episodi Static Discrete
nt
ble
istic
c
Operating Yes
Yes
No
No
Yes
System
Virtual
Yes
Yes
Yes/no No
Yes/no
Reality
Office
No
No
No
No
No
Environme
ntThe environment types largely determine the agent design.
Mars
No
SemiAI chapter 2 No
Semi No
Structure of Intelligent Agents
• Agent = architecture + program
• Agent program: the implementation of f
: P* A, the agent’s perception-action
mapping
function Skeleton-Agent(Percept)
returns Action
memory
UpdateMemory(memory, Percept)
Action
AI chapter 2
Using a look-up-table to encode f : P*
A
• Example: Collision Avoidance
• Sensors:
• Effectors:
3 proximity sensors
Steering Wheel, sensors
Brakes
• How to generate?
• How large?
• How to select action?
AI chapter 2
obstacle
agent
Using a look-up-table to encode f : P*
A
• Example: Collision Avoidance
• Sensors:
• Effectors:
sensors
3 proximity sensors
Steering Wheel, Brakes
obstacle
agent
• How to generate: for each p Pl Pm
Pr
generate an appropriate action, a S
B
• How large: size of table = #possible
percepts times # possible
actions = |Pl |
AI chapter 2
Agent types
• Reflex agents
• Reflex agents with internal states
• Goal-based agents
• Utility-based agents
AI chapter 2
Agent types
• Reflex agents
• Reactive: No memory
• Reflex agents with internal states
• W/o previous state, may not be able to
make decision
• E.g. brake lights at night.
• Goal-based agents
AI chapter 2
Agent types
• Utility-based agents
• How well can the goal be achieved
(degree of happiness)
• What to do if there are conflicting
goals?
• Speed and safety
• Which goal should be selected if
AI chapter 2
Reflex agents
AI chapter 2
Reactive agents
• Reactive agents do not have internal symbolic
models.
• Act by stimulus-response to the current state of
the environment.
• Each reactive agent is simple and interacts with
others in a basic way.
• Complex patterns of behavior emerge from their
interaction.
AI chapter 2
Reflex agents w/ state
AI chapter 2
Goal-based agents
AI chapter 2
Utility-based agents
AI chapter 2
Mobile agents
• Programs that can migrate from one machine to
another.
• Execute in a platform-independent execution
environment.
• Require agent execution environment (places).
• Mobility not necessary or sufficient condition for
agenthood.
• Practical but non-functional advantages:
• Reduced communication cost (eg, from PDA)
• Asynchronous computing (when you are not
connected)
• Two types:
AI chapter 2
Mobile agents
• Programs that can
migrate from one
machine to another.
• Execute in a platformindependent execution
environment.
• Require agent
execution environment
(places).
AI chapter 2
A mail agent
Mobile agents
• Practical but non-functional
advantages:
• Reduced communication cost (e.g. from
PDA)
• Asynchronous computing (when you are
not connected)
• Two types:
AI chapter 2
Mobile agents
• Applications:
• Distributed information retrieval.
• Telecommunication network routing.
AI chapter 2
Information agents
• Manage the explosive growth of information.
• Manipulate or collate information from many
distributed sources.
• Information agents can be mobile or static.
• Examples:
• BargainFinder comparison shops among Internet
stores for CDs
• FIDO the Shopping Doggie (out of service)
• Internet Softbot infers which internet facilities (finger,
ftp, gopher) to use and when from high-level search
requests.
AI chapter 2
Summary
• Intelligent Agents:
• Anything that can be viewed as perceiving its
environment through sensors and acting upon
that environment through its effectors to
maximize progress towards its goals.
• PAGE (Percepts, Actions, Goals, Environment)
• Described as a Perception (sequence) to Action
Mapping: f : P* A
• Using look-up-table, closed form, etc.
• Agent Types: Reflex,
state-based, goalAI chapter 2