1b_Agents.dvi
COMP9414 Agents 1
This Lecture
� Agents
� Agent Architectures and Programs
� Layered Architectures and Programs
◮ Example – Delivery Robot
� Rational Agents
UNSW ©W. Wobcke et al. 2019–2021
COMP9414: Artificial Intelligence
Lecture 1b: Agents
Wayne Wobcke
e-mail:w. .au
UNSW ©W. Wobcke et al. 2019–2021
COMP9414 Agents 3
Agent – Intuitive Definition
� An entity that perceives its environment through sensors and acts on
its environment through effectors
� Example — human agent
sensors – eyes, ears, touch, etc.
effectors – hands, legs, etc.
� Example — robotic agent
sensors – ultrasonic, infrared range finder, video input, etc.
effectors – motors, manipulators, etc.
Agents according to Poole and Mackworth: person, robot, dog, worm,
lamp, computer program that buys and sells, corporation?
UNSW ©W. Wobcke et al. 2019–2021
COMP9414 Agents 2
Three Definitions of Agent
� Agent as actor
◮ Acts autonomously in the world to achieve goals
◮ Rational – may have beliefs, desires and intentions
� Agent as helper, representative
◮ Performs some task on behalf of another agent
◮ Collaborates with some “user” on a (complex) task
◮ May or may not be an “agent as actor”
� Agent as catalyst
◮ Cause of a chemical reaction
Textbooks combine the first two types, then say AI is about “agents”
UNSW ©W. Wobcke et al. 2019–2021
COMP9414 Agents 5
Situatedness
What does the frog know?
What are the implications for agent design?
UNSW ©W. Wobcke et al. 2019–2021
COMP9414 Agents 4
What is an Agent?
An entity
� situated: operates in a dynamically changing environment
� reactive: responds to changes in a timely manner
� autonomous: can control its own behaviour
� proactive: exhibits goal-oriented behaviour
� communicating: coordinate with other agents??
Examples: humans, dogs, …, insects, sea creatures, …, thermostats?
Where do current robots sit on the scale?
UNSW ©W. Wobcke et al. 2019–2021
COMP9414 Agents 7
Specifying Agents
� percepts: inputs to the agent via sensors
� actions: outputs available to the agent via effectors
� goals: objectives or performance measure of the agent
� environment: world in which the agent operates
Most generally, a function from percept sequences to actions
Ideally rational agent does whatever action is expected to maximize some
performance measure – the agent may not know the performance measure
(Russell and Norvig 2010)
Resource bounded agent must make “good enough” decisions based on its
perceptual, computational and memory limitations (design tradeoffs)
UNSW ©W. Wobcke et al. 2019–2021
COMP9414 Agents 6
Robocup Soccer
UNSW ©W. Wobcke et al. 2019–2021
COMP9414 Agents 9
Agent Programs and Architectures
� Program — function implementing mapping from percept sequence
to actions, using an internal representation of the percept history
� Architecture — hardware and software components, and their organi-
zation, on which agent program executes
Agent = Architecture + Program
UNSW ©W. Wobcke et al. 2019–2021
COMP9414 Agents 8
Example Agents
Agent Type Percepts Actions Goals Environment
Medical
diagnosis
system
Symptoms,
findings, pa-
tient responses
Questions,
tests, treat-
ments
Healthy patient,
minimise costs
Patient, hospital
Satellite im-
age system
Pixels of vary-
ing intensity,
colour
Print cate-
gorisation of
scene
Correct cate-
gorisation
Images from or-
biting satellite
Automated
taxi driver
Cameras,
speedometer,
GPS, sonar,
microphone
Steer, acceler-
ate, brake, talk
to passenger
Safe, fast, legal,
comfortable
trip, maximise
profits
Roads, other
traffic, pedestri-
ans, customers
Robocup
robot
Camera im-
ages, laser
range finder
readings, sonar
readings
Move motors,
“kick” ball
Score goals
Playing field
with ball and
other robots
Based on Russell and Norvig (2010) Figure 2.5.
UNSW ©W. Wobcke et al. 2019–2021
COMP9414 Agents 11
Representation
� Rich enough to express knowledge needed (to solve the problem)
� As close to the problem as possible: compact, natural, maintainable
� Amenable to efficient computation
◮ Able to express features of the problem that can be exploited for
computational gain
◮ Able to trade off accuracy and computation time and/or space
� Able to be acquired from people, data and past experiences
UNSW ©W. Wobcke et al. 2019–2021
COMP9414 Agents 10
Representation
Example – Chess
� States – one way the world could be
◮ e.g. 243 distinct states
� Features – state with basic information
◮ e.g. State has feature f if there is a passed pawn
� Propositions – state with logical structure
◮ e.g. State divided into positions, pieces and relations
More complex representations need more complex inference procedures,
but are more expressive – another tradeoff
UNSW ©W. Wobcke et al. 2019–2021
COMP9414 Agents 13
A Taxonomy of Agent Programs
Agent with internal state — keeps track of world
Agent
E
n
v
iro
n
m
e
n
t
Sensors
State
How the world evolves
What my actions do
Condition-action rules
Actuators
What the world
is like now
What action I
should do now
UNSW ©W. Wobcke et al. 2019–2021
COMP9414 Agents 12
A Taxonomy of Agent Programs
Reflex (reactive) agent — applies condition-action rules to each percept
Agent
E
n
v
iro
n
m
e
n
t
Sensors
What action I
should do now
Condition-action rules
Actuators
What the world
is like now
UNSW ©W. Wobcke et al. 2019–2021
COMP9414 Agents 15
A Taxonomy of Agent Programs
Utility-based agent — considers preference for certain world states over
others
Agent
E
n
v
iro
n
m
e
n
t
Sensors
How happy I will be
in such a state
State
How the world evolves
What my actions do
Utility
Actuators
What action I
should do now
What it will be like
if I do action A
What the world
is like now
UNSW ©W. Wobcke et al. 2019–2021
COMP9414 Agents 14
A Taxonomy of Agent Programs
Goal-based (teleological) agent — state description often not sufficient for
agent to decide what to do so it needs to consider its goals (may involve
searching and planning)
Agent
E
n
v
iro
n
m
e
n
t
Sensors
What action I
should do now
State
How the world evolves
What my actions do
Actuators
What the world
is like now
What it will be like
if I do action A
Goals
UNSW ©W. Wobcke et al. 2019–2021
COMP9414 Agents 17
Layered Architecture
Hierarchy of controllers
� Controller gets percepts from and sends commands to the lower layer
◮ Abstracts low level features into higher level (perception)
◮ Translates high level commands into actuator instructions (action)
� The controllers have different representations, programs
� The controllers operate at different time scales
� A lower-level controller can override its commands
UNSW ©W. Wobcke et al. 2019–2021
COMP9414 Agents 16
Environment Types
Fully Observable vs Partially Observable
Agent’s sensors give access to complete (relevant) state of
environment (no internal state required)
Deterministic vs Stochastic
Next state of environment determined only by current state and
agent’s choice of action
Episodic vs Sequential
Agent’s experience divided into “episodes”; agent doesn’t need
to think ahead in episodic environment
Static vs Dynamic
Environment changes while agent deliberates
Discrete vs Continuous
Limited number of distinct, clearly defined percepts and actions
UNSW ©W. Wobcke et al. 2019–2021
COMP9414 Agents 19
Delivery Robot – Middle Layer
UNSW ©W. Wobcke et al. 2019–2021
COMP9414 Agents 18
Example – Delivery Robot
UNSW ©W. Wobcke et al. 2019–2021
COMP9414 Agents 21
Delivery Robot – Top Layer
UNSW ©W. Wobcke et al. 2019–2021
COMP9414 Agents 20
Middle Layer Code
given timeout and target pos:
remaining := timeout
while not arrived() and remaining 6= 0
if whisker sensor = on
then steer := left
else if straight ahead(rob pos; robot dir; target pos)
then steer := straight
else if left of (rob pos; robot dir; target pos)
then steer := left
else steer := right
do(steer)
remaining := remaining – 1
tell upper layer arrived()
UNSW ©W. Wobcke et al. 2019–2021
COMP9414 Agents 23
Delivery Robot – Simulation
UNSW ©W. Wobcke et al. 2019–2021
COMP9414 Agents 22
Top Layer Code
given plan:
to do := plan
timeout := 200
while not empty(to do)
target pos := coordinates(first(to do))
do(timeout; target pos)
to do := rest(to do)
UNSW ©W. Wobcke et al. 2019–2021
COMP9414 Agents 25
BDI Agent Interpreter
UNSW ©W. Wobcke et al. 2019–2021
COMP9414 Agents 24
BDI Agents
� Beliefs: Explicit representation of the world
� Desires: Preferred states of the environment
� Goals: Desires the agent has chosen to pursue (must be consistent)
� Intentions: Actions the agent has chosen and committed to
◮ Pose problems for deliberation (how to fulfil them)
◮ Constrain further choices (must be compatible)
◮ Control conduct (lead to future action)
All defined functionally – no X factor
“Intentions, Plans, and Practical Reason” (Bratman 1987)
UNSW ©W. Wobcke et al. 2019–2021
COMP9414 Agents 27
PRS (Procedural Reasoning System)
� Useful in dynamic environments where
◮ Reasonable plans can be formed in advance
◮ Agent needs continuity of commitment
◮ Agent needs to respond rapidly to situation
◮ Agent’s computational resources are limited
◮ Agent can keep up with changes in the world
UNSW ©W. Wobcke et al. 2019–2021
COMP9414 Agents 26
PRS (Procedural Reasoning System)
Abstract PRS Interpreter:
initialize-state()
do
options := option-generator(event-queue, B, G, I)
selected-options := deliberate(options, B, G, I)
update-intentions(selected-options, I)
execute(I)
get-new-external-events()
drop-successful-attitudes(B, G, I)
drop-impossible-attitudes(B, G, I)
until quit
UNSW ©W. Wobcke et al. 2019–2021
COMP9414 Agents 28
Summary
� Assumptions made about environment dictate nature of agent
◮ Capabilities those needed to survive in the environment
◮ Need not be “over-engineered” to handle more complexity
◮ Agent + Environment can be thought of as a coupled system
� Specific architectures constrain agent’s computational power and
limit behaviour: more efficient than general architectures
UNSW ©W. Wobcke et al. 2019–2021