2. 2
What is AI?
Many definitions, most fit into one of four categories:
Systems that act humanly
Systems that think humanly
Systems that act rationally
Systems that think rationally
3. 3
Intelligent Agents and Artificial Intelligence
⢠Human mind as network of thousands or millions of
agents all working in parallel. To produce real artificial
intelligence, we should build computer systems that also
contain many agents and systems.
⢠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;
4. 4
Intelligent agents: their environment and actions
environment
percepts
actions
?
agent
sensors
effectors
An agent perceives its environment via sensors and acts in
that environment with its effectors. Hence, an agent gets
percepts one at a time, and maps this percept sequence to
actions (one action at a time)
5. 5
Agents Properties:
1-Autonomy
⢠A system is autonomous to the extent that its own behavior is
determined by its own experience and knowledge.
⢠Therefore, a system is not autonomous if it is guided by its
designer according to a priori decisions.
⢠To survive agents must have:
â Enough built- in knowledge to survive.
â Ability to learn.
6. 6
2-Reactivity
⢠The real world is not like that: things change, information
is incomplete. Many (most?) interesting environments are
dynamic
⢠Software is hard to build for dynamic domains: program
must take into account possibility of failure â ask itself
whether it is worth executing!
⢠A reactive system is one that maintains an ongoing
interaction with its environment, and responds to changes
that occur in it (in time for the response to be useful)
7. 7
3-Proactiveness
⢠Reacting to an environment is easy (e.g.,
stimulus ďŽ response rules)
⢠But we generally want agents to do things
for us
⢠Hence goal directed behavior
⢠Pro-activeness = generating and attempting
to achieve goals; not driven solely by
events; taking the initiative
⢠Recognizing opportunities
8. 8
4-Balancing Reactive and Goal-
Oriented Behavior
⢠We want our agents to be reactive, responding
to changing conditions in an appropriate
(timely) fashion
⢠We want our agents to systematically work
towards long-term goals
⢠These two considerations can be at odds with
one another
⢠Designing an agent that can balance the two
remains an open research problem
9. 9
5-Social Ability
⢠The real world is a multi-agent environment: we
cannot go around attempting to achieve goals
without taking others into account
⢠Some goals can only be achieved with the
cooperation of others
⢠Similarly for many computer environments:
witness the Internet
⢠Social ability in agents is the ability to interact
with other agents (and possibly humans) via
some kind of agent-communication language,
and perhaps cooperate with others
10. 10
Other Properties
⢠Other properties, sometimes discussed in the context of
agency:
⢠mobility: the ability of an agent to move around an electronic
network.
⢠benevolence: agents do not have conflicting goals, and that
every agent will therefore always try to do what is asked of it.
⢠rationality: agent will act in order to achieve its goals.
⢠learning/adaption: agents improve performance over time
12. 12
Structure of intelligent agents
⢠Agent program: a program that implements
the mapping from percepts to actions
⢠Architecture: the platform to run the
program.
⢠Agent = architecture + program
⢠Before designing an agent program, we need to know -
⢠a) the percepts (P)
⢠b) the actions (A)
⢠c) the goals (or performance measure of the agent) (G)
⢠d) its environment (E)
14. 14
Interacting Agents
Collision Avoidance Agent (CAA)
⢠Percepts: Obstacle distance, velocity, trajectory
⢠Actions: Steer, speed up, brake, blow horn, signal (headlights)
⢠Goals: Avoid running into obstacles
⢠Environment: Highway
Lane Keeping Agent (LKA)
⢠Percepts: Lane center, lane boundaries
⢠Actions: Steer, speed up, brake
⢠Goals: Stay in current lane
⢠Environment: Freeway
15. 15
Examples of agent types (using their PAGE descriptions)
1-Agent Type : Medical diagnosis system
Percepts : Symptoms, findings patientâs answers
Actions : Questions, tests, treatments
Goals : Healthy patient, minimize costs
Environment : Patient, hospital.
2-Agent Type : Satellite image analysis system
Percepts : Pixels of varying intensity, color
Actions : Print a categorization of scene
Goals : Correct categorization
Environment : Images from orbiting satellite
16. 16
Agent Programs
The early version of agent programs will have a simple form, e.g.
function SKELETON-AGENT(percept) returns action
static: memory // the agentâs memory of the world
memory <= UPDATE-MEMORY(memory, percept)
action <= CHOOSE-BEST-ACTION(memory)
memory <= UPDATE-MEMORY(memory, action)
return action
Each time this function is called (invoked), the agentâs memory
is updated with the new percept, the best action is chosen, and
the fact the action was taken in also stored in memory.
17. 17
Each agent program uses some internal data structures that are
updated as new percepts arrive.
These data structures are modified by the agentâs decision making
procedures, to generate an action choice. This choice is passed on
to the architecture to be executed.
Note that:
a) The agent program receives only one percept as input. It is the job
of the agent to build up a percept sequence in memory, if it needs to. In
some environments, no percept sequence needs be stored. In complex
environments, the complete sequence cant be stored!
b) The goal (or performance measure) is NOT part of the program.
18. 18
The simplest way to write the agent program is â
a LUT (look up table), e.g. see the following agent program:
function TABLE-DRIVEN-AGENT(percept) returns action
static: percepts // a sequence, initially empty
table // a table indexed by percept sequences,
initially fully specified
append percept to the end of percepts
action <= LOOKUP(percepts, table)
return action
The above lookup table agent keeps track of the (entire) percept
sequence and just looks up the best action by using the sequence
as the index into the table. The LUT (table) contains the appropriate
action for all possible percept sequences.
This proposal is doomed (for certain types of agents) e.g. Chess
playing agent (would need about 35100 entries in the LUT)
This could not be built.
19. 19
Some Agent Types
⢠1-Simple reflex agents
â are based on condition-action rules, implemented with an
appropriate production system. They are stateless devices
which do not have memory of past world states.
⢠2-Reflex agent with internal state
⢠which is used to keep track of past states of the world.
⢠3-Agents with goals
â are agents that, in addition to state information, have goal
information that describes desirable situations. Agents of this
kind take future events into consideration.
⢠4-Utility-based agents
An agent that has an explicit utility function can make rational
decisions.
20. 20
1- Simple Reflex Agent
⢠Decisions based on current percept only
â No memory
â Has problems if environment is not fully
observable.
Simple Reflex Agent
sensors
What the world
is like now
What action I
should do now
Condition - action rules
effectors
Environment
21. 21
function SIMPLE-REFLEX-AGENT(percept) returns action
static: rules // a set of condition-action rules
state <= INTERPRET-INPUT(percept)
rule <= RULE-MATCH(state, rules)
action <= RULE-ACTION[rule]
return action
The simple reflex agent works by finding a rule whose condition
(i.e. the LHS) matches the current situation (defined by the percept)
and then performing the action associated with that rule.
The INTERPRET-INPUT function generates an abstracted
description of the current state from the percept (this can be difficult).
The RULE-MATCH function returns the first rule in the set of rules
that matches the given state description (i.e. LHS = state description).
22. 22
2-Reflex agent with internal state
function REFLEX-AGENT-WITH-STATE (percept) returns action
static: state, a description of the current world state
rules, a set of condition-action rules
state ď UPDATE-STATE (state, percept)
rule ď RULE-MATCH (state, rules)
action ď RULE-ACTION [rule]
state ď UPDATE-STATE (state, action)
return action
A reflex agent with internal state works by finding a rule whose
condition matches the current situation (as defined by the percept and
the stored internal state) and then doing the action associated with
that rule.
23. 23
Reflex agent with internal state
sensors
What the world
is like now
What action I
should do now
Condition - action rules
effectors
Environment
State
How the world evolves
What my actions do
24. 24
3-Agents with goals
⢠Knowing the state of the environment is not enough sometimes to
be able to decide what to do, e.g. an agent comes to a cross roads -
which way to turn, L?, R?, straight ahead? The decision depends on
Where the agent wants to go, i.e. it needs GOAL information.
Goal information describes which situations are desirable.
The agentâs program can combine this goal information with
information about the results of its possible actions in order to
choose actions that achieve the goal.
This can be easy or difficult. Search (Chs 3 to 5) and Planning
(Chs. 11 to 13) deal with the topic of finding action sequences to
achieve the agentâs goals.
25. 25
Agent with goals
sensors
What the world
is like now
What action I
should do now
Goals
effectors
Environment
State
How the world evolves
What my actions do
What it will be like
if I do action A
26. 26
4- Utility-based Agents
Goals are not enough to generate high quality behavior, e.g.
there are many ways to arrive at a destination, but some routes are
quicker, safer, cheaper.
Goals provide only a crude distinction between âhappyâ and
âunhappyâ states.
A more general performance measure would allow comparisons
between different world states depending upon how happy they
would make the agent if achieved.
happiness = utility (i.e. satisfaction derived from)
If one world state is preferred by an agent over another, then
the first state has higher utility to the agent.
27. 27
Utility-based agent
sensors
What the world
is like now
What action I
should do now
Utility
effectors
Environment
State
How the world evolves
What my actions do
What it will be like
if I do action A
How happy I will
be in such as a state
28. 28
Utility is a function that maps a state to a real number.
This number measures the âdegree of happinessâ of the agent.
A utility function allows rational decisions in 2 cases where goals
have trouble -
a) When there are conflicting goals (e.g. speed vs. safety),
(the utility function will supply the needed tradeoff).
b) When there are several goals (none of which can be achieved
with certainty). The utility function can weigh up the probability
of success with the importance of the goals.
Ch. 16 shows that any rational agent can be described as having
a utility function.
29. 29
Properties of environments
Actions are done by the agents on the environment, which in turn
provides percepts to the agent.
Different kinds of environments affect the design of agents.
Environment programs can be used as testbeds for agent programs.
Kinds of Environments (5 examples)
a) Accessible vs. Inaccessible
b) Deterministic vs. Nondeterministic
c) Episodic vs. Nonepisodic
d) Static vs. Dynamic
e) Discrete vs. Continuous
30. 30
a) Accessible vs. Inaccessible
An environment is accessible if the agentâs sensors can detect the
environmentâs complete state. (An environment is effectively
accessible if the sensors detect all aspects of the environment
needed to choose the action).
b) Deterministic vs. Nondeterministic
An environment is deterministic if its next state is completely
determined by its current state and the actions performed by
the agent.
31. 31
c) Episodic vs. Nonepisodic
An environment is episodic if the agentâs experience is divided into
âepisodesâ, i.e. percept-action cycles, where the quality of the action
does not depend on previous cycles (episodes), i.e. the cycles are
âhistory independentâ. The episodes do not depend on previous
actions.
d) Static vs. Dynamic
If the environment can change while the agent is deciding its action,
the environment is said to be dynamic. Static environments are
easier to deal with for agents. They donât have to keep looking.
32. 32
e) Discrete vs. Continuous
An environment is discrete if there are a finite number of distinct,
clearly defined percepts and actions, e.g. chess (there are a finite
number of moves at each turn).Taxi driving is continuous - there
are a continuous range of taxi and other vehicle speeds and
positions etc.
Different environments require different kinds of agent programs.
The most difficult environments are inaccessible, nondeterministic,
nonepisodic, dynamic and continuous.
33. 33
Environment Programs
To simulate an agent, you will need an environment simulator too.
These environment simulators have the broad structure of the
pseudo code as shown in the next slide.
The environment simulator (program) does the following -
a) Takes an agent as input
b) Gives each agent the right percept and receive back an action
c) Updates the environment based on the action
The environment is defined by -
a) its initial state
b) its update function
34. 34
procedure RUN-ENVIRONMENT(state, UPDATE-FN,
agents, termination)
inputs: state // the initial state of the environment
UPDATE-FN // to modify the environment
agents // a set of agents
termination // a predicate to test when finished
repeat
for each agent in agents do
PERCEPT[agent] <= GET-PERCEPT(agent, state)
end
for each agent in agents do
ACTION[agent] <= PROGRAM[agent]
(PERCEPT[agent])
end
state <= UPDATE-FN(actions, agents, state)
until termination(state)
35. 35
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
â Asynchronous computing (when you are not connected)
⢠Two types:
â One-hop mobile agents (migrate to one other place)
â Multi-hop mobile agents (roam the network from place to
place)
⢠Applications:
â Distributed information retrieval.
â Telecommunication network routing.
36. 36
Summary
⢠An agent perceives and acts in an environment, has an architecture
and is implemented by an agent program.
⢠An ideal agent always chooses the action which maximizes its
expected performance, given percept sequence received so far.
⢠An autonomous agent uses its own experience rather than built-in
knowledge of the environment by the designer.
⢠An agent program maps from percept to action & updates its
internal state.
â Reflex agents respond immediately to percpets.
â Goal-based agents act in order to achieve their goal(s).
â Utility-based agents maximize their own utility function.
⢠Representing knowledge is important for successful agent design.
⢠Some environments are more difficult for agents than others. The
most challenging environments are inaccessible, nondeterministic,
nonepisodic, dynamic, and continuous.