Title: Intelligent Agent
1Chapter 2
2Agents
- 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 - any given instant can depend on the entire
percept sequence observed to date, but not on
anything it hasn't perceived.
3Agents 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
- The agent function is an abstract mathematical
description the agent program is a specify
implementation, running within some physical
system.
4Vacuum-cleaner world
- Percepts location and state of the environment,
e.g., A,Dirty, A,Clean, B,Dirty - Actions Left, Right, Suck, NoOp
- Simple agent function
- if the current square is dirty, then suck
otherwise, move to the other square.
5what makes an agent good or bad, intelligent or
stupid?
6Rational agents
- Rational agent is one that does the right thing
- Performance measure
- that evaluates any given sequence of environment
states. - An objective criterion for success of an agent's
behavior, e.g., - Robot driver?
- Chess-playing program?
- Spam email classifier?
- Rational Agent selects actions that is
expected to maximize its performance measure, - given percept sequence
- given agents built-in knowledge
- sidepoint how to maximize expected future
performance, given only historical data
7- Rationality
- What is rational at any given time depends on
four things - The performance measure that defines the
criterion of success. - The agent's prior knowledge of the environment.
- The actions that the agent can perform.
- The agent's percept sequence to date.
- 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.
8Rational agents
- Performance measure An objective criterion for
success of an agent's behavior, e.g., - Robot driver?
- Chess-playing program?
- Spam email classifier?
- Rational Agent selects actions that is
expected to maximize its performance measure, - given percept sequence
- given agents built-in knowledge
- sidepoint how to maximize expected future
performance, given only historical data
9Rational agents
- Rationality is distinct from omniscience
(all-knowing 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 percepts experience (with
ability to learn and adapt) without depending
solely on built-in knowledge99
10Task Environment
- Before we design an intelligent agent, we must
specify its task environment -
- PEAS
- Performance measure
- Environment
- Actuators
- Sensors
11PEAS
- Example Agent robot driver in DARPA Challenge
- Performance measure
- Time to complete course
- Environment
- Roads, other traffic, obstacles
- Actuators
- Steering wheel, accelerator, brake, signal, horn
- Sensors
- Optical cameras, lasers, sonar, accelerometer,
speedometer, GPS, odometer, engine sensors,
12PEAS
- Example 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)
13PEAS
14Environment 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. - Fully observable environments are convenient
because the agent need not maintain any internal
state to keep track of the world. - E.g. Playing soccer Partial observable,
- Perform high jump Full observable.
- Single agent (vs. multi-agent)
- An agent operating by itself in an environment.
Does the other agent interfere with my
performance measure? - e,.g crossword puzzle Single agent
- Playing chess mult-iagent
- (agent may be competitive or cooperation)
15Environment types
- 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 - Deterministic environments can appear stochastic
to an agent (e.g., when only partially
observable) - E.g shopping for IT book online deterministic,
- Stochastic generally implies that uncertainty
about outcomes is quantified in terms of
probabilities - E.g performing a high Jump Stochastic
16- Episodic (vs. sequential)
- An agents action is divided into atomic
episodes. Decisions do not depend on previous
decisions/actions. - Episodic the next episode does not depend on
the actions taken in previous episodes. - E.g. an agent that has to spot defective parts
on an assembly line bases each decision on the
current part, regardless of previous decisions - sequential the current decision could affect all
future decisions e.g. Chess and taxi driving are
sequential
17Environment types
- Static (vs. dynamic)
- Static The environment is unchanged while an
agent is deliberating. - E.g. crossword puzzle static
- Dynamic agent need to keep looking at the world
while it is deciding on an action and The
environment is changed while an agent is
deliberating. Dynamic environment continuously
asking agent what want to do. - E.g. Taxi driving Dynamic
- 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 discrete set of distinct, clearly defined
percepts and actions. - How we represent or abstract or model the world
18task environm. observable deterministic/ stochastic episodic/ sequential static/ dynamic discrete/ continuous agents
crossword puzzle fully determ. sequential static discrete single
chess with clock fully strategic sequential semi discrete multi
poker
taxi driving partial stochastic sequential dynamic continuous multi
medical diagnosis
image analysis fully determ. episodic semi continuous single
partpicking robot partial stochastic episodic dynamic continuous single
refinery controller partial stochastic sequential dynamic continuous single
interact. tutor partial stochastic sequential dynamic discrete multi
19What is the environment for the DARPA Challenge?
- Agent robotic vehicle
- Environment 130-mile route through desert
- Observable?
- Deterministic?
- Episodic?
- Static?
- Discrete?
- Agents?
20Agent 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 - Difference between agent program and agent
function - Agent program takes the current percept as input
because nothing more is available from the
environment - Agent function, which takes the entire percept
history. - Aim find a way to implement the rational agent
function concisely
21Examples of how the agent function can be
implemented
- Table-driven agent
- Simple reflex agent
- Reflex agent with internal state
- Agent with explicit goals
- Utility-based agent
More sophisticated
22Table-lookup agent
- 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 - Agent programs type
- Simple reflex agents
- Model-based reflex agents
- Goal-based agents
- Utility-based agents
23Table-driven agent
24Simple reflex agents
25Simple reflex agent
- Table lookup of condition-action pairs defining
all possible condition-action rules necessary to
interact in an environment - e.g. if car-in-front-is-breaking then initiate
breaking - select precepts based on the current percept
- ignoring the rest of the precept history
- The rules are like the form if then
- efficient but have narrow range of applicability
Because knowledge sometimes cannot be stated
explicitly - Work only
- if the environment is fully observable
- Problems
- Table is still too big to generate and to store
(e.g. taxi) - Takes long time to build the table
- No knowledge of non-perceptual parts of the
current state - Not adaptive to changes in the environment
requires entire table to be updated if changes
occur - Looping Cant make actions conditional
26A Simple Reflex Agent in Nature
percepts (size, motion)
RULES (1) If small moving object,
then activate SNAP (2) If large moving object,
then activate AVOID and inhibit
SNAP ELSE (not moving) then NOOP
needed for completeness
Action SNAP or AVOID or NOOP
27Model-based reflex agents
28- Model-Based Reflex Agents
- Most effective way to keep track of the part of
the world it cant see now. - Maintain some internal state that depends on
percept history and thereby reflects at least
some of the unobserved aspects of the current
state (e.g. using some type of variable). - For the world that is partially observable
- the agent has to keep track of an internal state
- That depends on the percept history
- Reflecting some of the unobserved aspects
- E.g., driving a car and changing lane
- Requiring two types of knowledge
- How the world evolves independently of the agent
- How the agents actions affect the world
29Goal-based agents
30- 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
- Conclusion
- Goal-based agents are less efficient
- but more flexible
- Agent ? Different goals ? different tasks
- Search and planning
- two other sub-fields in AI
- to find out the action sequences to achieve its
goal
31Utility-based agents
32- Goals alone are not enough
- to generate high-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) - 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
- 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 certainly
- utility provides a way for the decision-making
33Learning Agents
- After an agent is programmed, can it work
immediately? - No, it still need teaching
- In AI,
- Once an agent is done
- We teach it by giving it a set of examples
- Test it by using another set of examples
- We then say the agent learns
- A learning agent
- Four conceptual components
- Learning element
- Making improvement
- Performance element
- Selecting external actions
- Critic
- Tells the Learning element how well the agent is
doing with respect to fixed performance standard. - (Feedback from user or examples, good or not?)
- Problem generator
- Suggest actions that will lead to new and
informative experiences.
34Learning agents
35Agent types
- Five basic types in order of increasing
generality - Table Driven agent
- Simple reflex agents
- Model-based reflex agents
- Goal-based agents
- Problem-solving agents
- Utility-based agents
- Can distinguish between different goals
- Learning agents
36Problem-Solving Agents
- Intelligent agents can solve problems by
searching a state-space - State-space Model
- the agents model of the world
- usually a set of discrete states
- e.g., in driving, the states in the model could
be towns/cities - Goal State(s)
- a goal is defined as a desirable state for an
agent - there may be many states which satisfy the goal
test - e.g., drive to a town with a ski-resort
- or just one state which satisfies the goal
- e.g., drive to Mammoth
- Operators (actions, successor function)
- operators are legal actions which the agent can
take to move from one state to another
37Initial Simplifying Assumptions
- Environment is static
- no changes in environment while problem is being
solved - Environment is observable
- Environment and actions are discrete
- (typically assumed, but we will see some
exceptions) - Environment is deterministic
38Example Traveling in Romania
- On holiday in Romania currently in Arad
- Flight leaves tomorrow from Bucharest
- Formulate goal
- be in Bucharest
- Formulate problem
- states various cities
- actions/operators drive between cities
- Find solution
- By searching through states to find a goal
- sequence of cities, e.g., Arad, Sibiu, Fagaras,
Bucharest - Execute states that lead to a solution
39Example Traveling in Romania
40State-Space Problem Formulation
- A problem is defined by four items
- initial state e.g., "at Arad
- actions or successor function
- S(x) set of actionstate pairs e.g.,
S(Arad) ltArad ? Zerind, Zerindgt, - 3. goal test (or set of goal states)
- e.g., x "at Bucharest, Checkmate(x)
- 4. path cost (additive)
- e.g., sum of distances, number of actions
executed, etc. - c(x,a,y) is the step cost, assumed to be 0
- A solution is a sequence of actions leading from
the initial state to a goal state
41Example Formulating the Navigation Problem
- Set of States
- individual cities
- e.g., Irvine, SF, Las Vegas, Reno, Boise,
Phoenix, Denver - Operators
- freeway routes from one city to another
- e.g., Irvine to SF via 5, SF to Seattle, etc
- Start State
- current city where we are, Irvine
- Goal States
- set of cities we would like to be in
- e.g., cities which are closer than Irvine
- Solution
- a specific goal city, e.g., Boise
- a sequence of operators which get us there,
- e.g., Irvine to SF via 5, SF to Reno via 80,
etc
42Abstraction
- Definition of Abstraction
- Process of removing irrelevant detail to create
an abstract representation high-level,
ignores irrelevant details - Navigation Example how do we define states and
operators? - First step is to abstract the big picture
- i.e., solve a map problem
- nodes cities, links freeways/roads (a
high-level description) - this description is an abstraction of the real
problem - Can later worry about details like freeway
onramps, refueling, etc - Abstraction is critical for automated problem
solving - must create an approximate, simplified, model of
the world for the computer to deal with
real-world is too detailed to model exactly - good abstractions retain all important details
43The State-Space Graph
- Graphs
- nodes, arcs, directed arcs, paths
- Search graphs
- States are nodes
- operators are directed arcs
- solution is a path from start S to goal G
- Problem formulation
- Give an abstract description of states,
operators, initial state and goal state. - Problem solving
- Generate a part of the search space that contains
a solution
44The Traveling Salesperson Problem
- Find the shortest tour that visits all cities
without visiting any city twice and return to
starting point. - State sequence of cities visited
- S0 A
45Example 8-queens problem
46State-Space problem formulation
- states? -any arrangement of nlt8 queens
- -or arrangements of nlt8 queens
in leftmost n - columns, 1 per column, such
that no queen - attacks any other.
- initial state? no queens on the board
- actions? -add queen to any empty square
- -or add queen to leftmost empty
square such that it is not attacked by other
queens. - goal test? 8 queens on the board, none attacked.
- path cost? 1 per move
47Example Robot Assembly
- States
- Initial state
- Actions
- Goal test
- Path Cost
48Example Robot Assembly
- States configuration of robot (angles,
positions) and object parts - Initial state any configuration of robot and
object parts - Actions continuous motion of robot joints
- Goal test object assembled?
- Path Cost time-taken or number of actions
49Learning a spam email classifier
- States
- Initial state
- Actions
- Goal test
- Path Cost
50Learning a spam email classifier
- States settings of the parameters in our model
- Initial state random parameter settings
- Actions moving in parameter space
- Goal test optimal accuracy on the training data
- Path Cost time taken to find optimal parameters
- (Note this is an optimization problem many
machine learning problems can be cast as
optimization)