You are on page 1of 131

Agent

Course Code: CSC4226 Course Title: Artificial Intelligence and Expert System

Dept. of Computer Science


Faculty of Science and Technology

Lecture No: Two (2) Week No: Two (2) Semester:


Lecturer: Dr. A F M Saifuddin Saif saif@aiub.edu
This lecture contains additional assignmenst
(optional) for bonus marks.. Grab It!!!!!!!!
Submit by 12th of November, 2020
Request to Email: saif20.aiub@gmail.com.

Dr. A. F. M. Saifuddin Saif 2


Instructions for Submission of Assignment for Bonus (1)

 Submit by 12 th of November, 2020

 Request to Email: saif20.aiub@gmail.com.

 Subject of the Email: Email Subject: Assignment 2 (Optional) – Fall 2020

 There is no page limit to answer any question.

 Submission of bonus assignments is optional.

 Follow either submission procedure 1 or submission procedure 2

Submission Procedure 1:

i) Prepare your answers in Microsoft Word

ii) Mention your name, id and section in each page of MS Word document in the top right portion of every page .

iii) Mention your name, id and section in the email body

iv) Make sure, your document does not bear the characteristics of “Copy and Paste”. More than 5% similarity may harm to overall
performance.
4

Instructions for Submission of Assignment for Bonus (2)

Submission Procedure 2:

i) Prepare your answers in Hard Copy, then scan the hard copy
(Take picture by mobile or scanner). Email the scanned the copy
only.

ii) Mention your name, id and section in each page in the top right
portion of every page .

iii) Mention your name, id and section in the email body

iv) Make sure, your document does not bear the characteristics of
“Copy and Paste”. More than 5% similarity may harm to overall
performance.
Dr. A F M Saifuddin Saif
4
Initialization
 Identified concept of rational agent as central to our approach to artificial intelligence
– making the notion more concrete.

 Concept of rationality can be applied to a wide variety of agents operating in any


imaginable environment.

 Purpose is to use this concept to develop a small set of design principles for
building successful agents – systems that can reasonably be called intelligent.

 Will begin by examining agents, environments and the coupling between them.

 The observations that some agents behave better than others lead naturally to the idea
of a rational agents – one that behaves as well as possible.

 How well an agent can behave depends on the nature of the environment; some
environments are more difficult than others.

Dr. A. F. M. Saifuddin Saif 5


6
Outlines
Agents
 Agents function and program
 Mapping (Percept seq to actions)
 Autonomy
 Vacuum cleaner agents
 Table look up agents
 Agent program for vacuum cleaner
 Rational agents
 Rational and Omniscience agent
 Omniscience, Learning and Autonomy
 Task Environment or PEAS
 Environment Properties
 Subtle Issues
 Types of agents
 Summary agent types

Dr. A. F. M. Saifuddin Saif


Agents
 An agent is anything that can be viewed as perceiving its environment through
sensors and acting upon that environment through actuators
 Human agent:
• Sensors: eyes, ears, and other organs
• Actuators: hands, legs, mouth, and other body parts
 Robotic agent:
• Sensors: cameras and infrared range finders
• Actuators: various motors
 We use the term percept to refer to the agent’s perceptual inputs at any given
instant.
 An agent’s percept sequence is the complete history of everything the agent
has ever perceived
 An agent’s choice of action at any given instant can depend on the entire percept
sequence observed to date.
 Mathematically speaking, we say that an agent’s behavior is described by
the agent function that maps any given percept sequence to an action.
Dr. A. F. M. Saifuddin Saif 7
Common Terms
 Percept
√ Agent’s perceptual inputs at any given instant

 Percept sequence
√ Complete history of everything that the agent has ever
perceived.

Dr. A. F. M. Saifuddin Saif 8


Dr. A. F. M. Saifuddin Saif 9
Diagram of an agent

What AI should fill


Dr. A. F. M. Saifuddin Saif 10
Agents as Computer Vision Architecture

Dr. A. F. M. Saifuddin Saif 11


Architectural view of computer vision implication (5)

Dr. A. F. M. Saifuddin Saif 12


The agent view is really quite generic
 In a sense, all areas of engineering can be seen as designing artifacts that interact with the world. AI operates
that end of the spectrum, where the artifacts use significant computational resources and the task and
environment requires non-trivial decision making.

 But, the definition of “agents” does technically also include, e.g., calculators or cars, artifacts with very limited
to no intelligence. (Self-driving cars come closer to what we view as intelligent agents.)

 Next: definition of rational agents. Sufficiently complex rational agents can be viewed as “intelligent .”

 We like to remark that the notion of an agent is meant to be a tool for analyzing machines,
not an absolute characterization that divides the world in to agents and non-agents.

 For example: One could view a hand-held calculator as an agent that chooses the action of
displaying “4” when given the percept sequence “2+2=,” but such an analysis would hardly
aid our understanding of the calculator.

Dr. A. F. M. Saifuddin Saif 13


Agents topology

Dr. A. F. M. Saifuddin Saif 14


Outlines
 Agents
Agents function and program
 Mapping (Percept seq to actions)
 Autonomy
 Vacuum cleaner agents
 Table look up agents
 Agent program for vacuum cleaner
 Rational agents
 Rational and Omniscience agent
 Omniscience, Learning and Autonomy
 Task Environment or PEAS
 Environment Properties
 Subtle Issues
 Types of agents
 Summary agent types

Dr. A. F. M. Saifuddin Saif 15


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

 Internally, the agent function for an artificial agent will be implemented by an agent program.

 It is important to keep those two ideas distinct.

 The agent function is an abstract mathematical description; the agent program is a


concrete implementation, running on the agent architecture.

 Example: Given an agent to experiment with, we can, in principle, construct this table by
trying out all percept sequences and recording which actions the agent does in response. The
table is, of course, an external characterization of the agent which can be referred as agent
function. Internally, the agent function for an artificial agent will be implemented by an agent
program.

Dr. A. F. M. Saifuddin Saif 16


17
Outlines
 Agents
 Agents function and program
Mapping (Percept seq to actions)
 Autonomy
 Vacuum cleaner agents
 Table look up agents
 Agent program for vacuum cleaner
 Rational agents
 Rational and Omniscience agent
 Omniscience, Learning and Autonomy
 Task Environment or PEAS
 Environment Properties
 Subtle Issues
 Types of agents
 Summary agent types

Dr. A. F. M. Saifuddin Saif


Vacuum-cleaner agent

Percepts: location and contents, e.g., [A, Dirty]

Actions: Left, Right, Suck, NoOp


A vacuum-cleaner agent

Dr. A. F. M. Saifuddin Saif 18


19
Outlines
 Agents
 Agents function and program
 Mapping (Percept seq to actions)
 Autonomy
 Vacuum cleaner agents
Agent Program for Vacuum Agent
 Agent program for vacuum cleaner
 Rational agents
 Rational and Omniscience agent
 Omniscience, Learning and Autonomy
 Task Environment or PEAS
 Environment Properties
 Subtle Issues
 Types of agents
 Summary agent types

Dr. A. F. M. Saifuddin Saif


20

Agent program for a vacuum-cleaner agent

Dr. A. F. M. Saifuddin Saif


Outlines
 Agents
 Agents function and program
 Mapping (Percept seq to actions)
 Autonomy
 Vacuum cleaner agents
 Agent program for vacuum cleaner
 Agent Programme Table look up agents
 Rational agents
 Rational and Omniscience agent
 Omniscience, Learning and Autonomy
 Task Environment or PEAS
 Environment Properties
 Subtle Issues
 Types of agents
 Summary agent types

Dr. A. F. M. Saifuddin Saif 21


Table-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

Dr. A. F. M. Saifuddin Saif 22


Outlines
 Agents
 Agents function and program
 Mapping (Percept seq to actions)
 Autonomy
 Vacuum cleaner agents
 Agent program for vacuum cleaner
 Agent ProgrameTable look up agents
Rational agents
 Rational and Omniscience agent
 Omniscience, Learning and Autonomy
 Task Environment or PEAS
 Environment Properties
 Subtle Issues
 Types of agents
 Summary agent types

Dr. A. F. M. Saifuddin Saif 23


Rational Agents (1)
An agent should strive to "do the right thing not to do the wrong
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
Rational Agent:
Given:
Possible percept sequence,
The evidence provided by the percept sequence and
Whatever built-in knowledge the agent has.
Aim: For each possible percept sequence a rational agent should select an action
Subject to: maximize its performance measure.

Dr. A. F. M. Saifuddin Saif 24


Rational Agents (2)
Definition of Rational Agent:

For each possible percept sequence, a rational agent should


select an action that maximizes its performance measure (in
expectation) given the evidence provided by the percept
sequence and whatever built-in knowledge the agent has.
Why “in expectation”?
Captures actions with stochastic / uncertain effects or
actions performed in stochastic environments.
We can then look at the expected value of an action.

In high-risk settings, we may also want to limit the


worst-case behavior.

Dr. A. F. M. Saifuddin Saif 25


Rational agents (3)
 Performance measure: criteria that determine how successful an
agent is.
 E.g.,

1. 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.

2. Performance measures self-driving car:


 time to reach destination (minimize),
 safety,
 predictability of behavior for other agents, reliability, etc.

Dr. A. F. M. Saifuddin Saif 26


Rational agents (4)
3. Performance measure of game-playing agent:
 win/loss percentage (maximize),
 robustness,
 unpredictability (to “confuse” opponent), etc.

Dr. A. F. M. Saifuddin Saif 27


Condition to be rational agents
1. What the performance measure is!

2. What is known about the environment ?

3. What sensor and actuator the agent has?

Dr. A. F. M. Saifuddin Saif 28


29
Outlines
 Agents
 Agents function and program
 Mapping (Percept seq to actions)
 Autonomy
 Vacuum cleaner agents
 Agent program for vacuum cleaner
 Agent ProgrameTable look up agents
 Rational agents
Rational and Omniscience agent
 Omniscience, Learning and Autonomy
 Task Environment or PEAS
 Environment Properties
 Subtle Issues
 Types of agents
 Summary agent types

Dr. A. F. M. Saifuddin Saif


Assumptions for Vacuum cleaner To be rational agents

 The followings assumptions need to be true to prove that:

1. The performance measure awards one point for each clean square at each time step,
over a “lifetime” of 1000 time steps.

2. The “Geography” of the environment is known a priori but their dirt distribution and
the initial location of the agents are not. The Left and Right actions move the agent left
and right except when this would take the agent outside the environment, in which case
the agent remains where it is.

3. The only available actions are Left, Right, Suck and No Op (Do nothing)

4. The agent currently perceives its location and whether that location contains dirt.

We can claim that under these circumstances the agent is indeed rational; its expected
performance is at least as high as any other agents.

Dr. A. F. M. Saifuddin Saif 30


Omniscience Agents (1)
Omniscience agent knows the actual outcome of its actions, and can act accordingly.

Omniscience agent is impossible.


Example (working on road): Agent equipped with Radar

Dr. A. F. M. Saifuddin Saif 31


Omniscience Agent and Rational Agents (1)
In summary, rationality at any time depends on 4 issues
The performance measure (degree of success)
Percept sequence (perception history)
Knowledge about the environment
The performed actions

Notes:

Rationality is distinct from omniscience (“all knowing”). We can behave rationally even
when faced with incomplete information.

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).
Dr. A. F. M. Saifuddin Saif 32
Learning
 Does a rational agent depend on only current percept?
 No, the past percept sequence should also be used
 This is called learning
 After experiencing an episode, the agent
 should adjust its behaviors to perform better for the same job
next time.

Dr. A. F. M. Saifuddin Saif 33


Autonomy

 If an agent just relies on the prior knowledge of its


designer rather than its own percepts then the agent
lacks autonomy
A rational agent should be autonomous- it should
learn what it can to compensate for partial or
incorrect prior knowledge.
 E.g., a clock
√ No input (percepts)
√ Run only but its own algorithm (prior knowledge)
√ No learning, no experience, etc.

Dr. A. F. M. Saifuddin Saif 34


35
Outlines
 Agents
 Agents function and program
 Mapping (Percept seq to actions)
 Autonomy
 Vacuum cleaner agents
 Agent program for vacuum cleaner
 Agent ProgrameTable look up agents
 Rational agents
 Rational and Omniscience agent
 Omniscience, Learning and Autonomy
 Task Environment or PEAS
 Environment Properties
 Subtle Issues
 Types of agents
 Summary agent types

Dr. A. F. M. Saifuddin Saif


Omniscience, Learning and Autonomy: Agents to be Rational,
Scenario 1: Crossing the Road (Omniscience)

 I am walking along the champs Elyees one day and I see an old friend across
the street. There is no traffic nearby and I am not otherwise engaged, so
being rational, I start to cross the street. Meanwhile, at 33,000 feet , a cargo
door falls off a passing airliner, and before I make it to the other side of the
street I am flattened.

Question: Was I irrational to cross the street ? It is unlikely that my obituary


would read “Idiot attempts to cross street”. Define rationality for this
example.

1(BONUS)

Dr. A. F. M. Saifuddin Saif 36


RATIONALITY AND OMNISCIENCE ARE DIFFERENT:
 Omniscience is knowing the outcome of an action beforehand. It therefore allows taking the
perfect action, which is impossible to achieve in reality.

 Rationality is doing the right thing based on known facts to date. It allows a human to take
the best action without knowing the future. Here, information gathering is also an action.

CASE STUDY:

 The probability of getting hit without checking for running cars is high. Thus, the rational action for an attempting
person is looking around to gather information about state of road.

 In this case, the person has done so. What, however, he hasn’t done is check for overhead obstacles (the falling cargo
door). He is still not considered irrational because:

Under natural circumstances, the relevant information needed while crossing a road only includes the vehicles on the road.
What happened with the cargo door is simply a highly unlikely occurrence. Thus, it is not considered while evaluating the
person’s rationalism. The dead person is not irrational/”an idiot” for not checking overhead.
Dr. A. F. M. Saifuddin Saif 37
Observation: Crossing the Road (1)

 Rationality is not the same as perfection.

 Rationality maximizes expected performance, while perfection maximizes actual


performance.

 Retreating from a requirement of perfection is not just a question of being fair to


agents. The point is that if we expect an agent to do what turns out to be the best
action after the fact, it will be impossible to design an agent to fulfill this
specification – unless we improve the performance of time machines.

 Our definition of rationality, does not require omniscience, then because the
rational choice depends only on the percept sequence to date.

 We must need to ensure that we have not inadvertently allowed the agent to
engage in decidedly under intelligent activities.

Dr. A. F. M. Saifuddin Saif 38


Observation: Crossing the Road (2)

 Example: if an agent does not look both ways before crossing a busy
road, then its percept sequence will not tell it there is large truck
approaching at high speed. Does our definition of rationality say that
it’s now OKEY to cross the road? Far from it!!!

 First, it would be rational to cross the road given this uninformative


percept sequence : the risk of accident from crossing without looking
is too great.

 Second, a rational agent should choose the ‘Looking’ action before


stepping into the street, because looking helps maximize the expected
performance. Doing actions in order to modify future percepts –
called information gathering – is an important part of rationality.

Dr. A. F. M. Saifuddin Saif 39


Omniscience, Learning and Autonomy: Agents to be Rational

 Our definition requires a rational agent not only to gather


information, but also to learn as much as possible from what
it perceives.

 The agent initial configuration could reflect some prior


knowledge of the environment , but as the agent gains
experience this may be modified and augmented.

 There are extreme cases in which the environment is


completely known as a “Priori”. In such cases the agent need
not perceive or learn; it simply acts correctly; of course such
agents are very fragile.

Dr. A. F. M. Saifuddin Saif 40


Omniscience, Learning and Autonomy: Agents to be Rational,
Scenario 2: Dung Beetle (Learning)

 Consider the lowly dung beetle. After digging its nest and
laying its legs, it fetches a ball of dung from a nearby heap to
plug the entrance. If the ball of dung is removed from its grasp
en route, the beetle continues on and pantomimes plugging the
nest with the nonexistent dung ball, never noticing that it is
missing. Evolution has built an assumption into beetle’s
behavior, and when it is violated, unsuccessful behavior results.

Question: What irrationality does the dung beetle contains? How


you design an rational agent to overcome the constraint of
beetle’s behavior.

1(BONUS)

Dr. A. F. M. Saifuddin Saif 41


Omniscience, Learning and Autonomy: Agents to be Rational,
Scenario 2: Dung Beetle (Learning)

https://www.youtube.com/watch?v=I1RHmSm36aE

Dr. A. F. M. Saifuddin Saif 42


Omniscience, Learning and Autonomy: Agents to be Rational,
Scenario 3: Sphex Wasp (Learning)

 Slightly more intelligent is the Sphex wasp than beetle. The female Sphex
will dig a burrow, go out and sting a caterpillar and drag it to the burrow,
enter the burrow again to check all is well , drag the caterpillar inside
and lay its eggs. The caterpillar serves as a food source when the eggs
hatch. So far so good, but if a entomologist moves the caterpillar a few
inch away while the Sphex is doing the check, it will revert back to the
‘drag’ step of it’s plan and will continue the plan without modification,
even after dozens of caterpillar moving interventions. The Sphex is
unable to learn that it’s initial plan is failing and thus will not change it.

Question: What features of agent functionalities can be introduced here? And


How to measure agent function here to introduce Sphex Wasp as rational
agent.

1(BONUS)

Dr. A. F. M. Saifuddin Saif 43


Omniscience, Learning and Autonomy: Agents to be Rational,
Scenario 3: Sphex Wasp (Learning)

 Clinton Richard Dawkins FRS FRSL is an English ethologist,


evolutionary biologist and author. He is an emeritus fellow of
New College, Oxford, and was the University of Oxford's
Professor for Public Understanding of Science from 1995 until
2008. 

Dr. A. F. M. Saifuddin Saif 44


Omniscience, Learning and Autonomy: Agents to be Rational,
Scenario 3: Sphex Wasp (Learning)

https://www.youtube.com/watch?v=CFn4hCZ3g9w

Dr. A. F. M. Saifuddin Saif 45


Observation: Sphex Wasp (Learning)

 Successful agents splits the tasks of computing the agent


function into three different periods:

 When the agent is being designed, some of the computation is


done by it’s designers;

 When it is deliberating on it’s next action, the agent does


more computation;

 Successful agents need to learn from experience, it does more


computation to decide how to modify its behavior.

Dr. A. F. M. Saifuddin Saif 46


Omniscience, Learning and Autonomy: Agents to be Rational

 To the extent that agent relies on the prior knowledge of its designer rather that
its own percept, we say that the agent lacks autonomy.

 A rational agent should be autonomous – it should learn what it can to


compensate for partial or incorrect prior knowledge.

 An autonomous intelligent should avoid unsuccessful results.

 As a practical matter, one seldom requires complete autonomy from the start;
when the agent has had little or no experience, it would have to act randomly
unless the designer gave some assistance.

 Incorporation of learning allows one to design a single rational agent that will
succeed in a vast variety of environment.

Dr. A. F. M. Saifuddin Saif 47


Omniscience, Learning and Autonomy: Agents to be Rational,
Vacuum agents and animal (Autonomy)

 Vacuum agent learns to foresee where and when additional dirt will
appear will do better than one that does not.

 Just as evolution provides animals with enough built in reflexes so that


they can survive long enough to learn for themselves, it would be
reasonable to provide an artificial intelligence agent with some initial
knowledge as well as an ability to learn.

Question: What is your opinion to deploy ‘learn’ in scenario 1-3? And how
you plan to do that? 1(BONUS)

Dr. A. F. M. Saifuddin Saif 48


Outlines
 Agents
 Agents function and program
 Mapping (Percept seq to actions)
 Autonomy
 Vacuum cleaner agents
 Agent program for vacuum cleaner
 Agent ProgrameTable look up agents
 Rational agents
 Rational and Omniscience agent
 Omniscience, Learning and Autonomy
Task Environment or PEAS
 Environment Properties
 Subtle Issues
 Types of agents
 Summary agent types

Dr. A. F. M. Saifuddin Saif 49


Nature of Environments / Task Environments
 Task environments are essentially the “problems” to which rational agents are the
“solutions”.

 To define task environment, the following specifications are needed and group all
these together under the heading of the task environment.

 Performance measure

 Environment

 Agent’s actuators

 Sensors

 For acronymically minded, we call this PEAS

Dr. A. F. M. Saifuddin Saif 50


PEAS
 Performance measure
 Environment
 Actuators
 Sensors
 Must first specify the setting for intelligent agent design

Dr. A. F. M. Saifuddin Saif 51


PEAS: Example 1
 Agent: 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

Dr. A. F. M. Saifuddin Saif 52


PEAS : Example 2
 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)

Dr. A. F. M. Saifuddin Saif 53


PEAS : Example 3

 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

Dr. A. F. M. Saifuddin Saif 54


PEAS : Example 4
 Agent: Interactive English tutor

 Performance measure: Maximize student's score on test

 Environment: Set of students

 Actuators: Screen display (exercises, suggestions,


corrections)

 Sensors: Keyboard

Dr. A. F. M. Saifuddin Saif 55


56

PEAS : Example 5
 Agent: Satellite Image Analysis System

 Performance measure: Correct image categorization

 Environment: Downlink from orbiting satellite

 Actuators: Display categorization of scene

 Sensors: Color pixel arrays

Dr. A. F. M. Saifuddin Saif


PEAS : Example 6
 Agent: Refinery Controller

 Performance measure: maximize purity, yield,


safety

 Environment: Refinery, operators

 Actuators: Valves, pumps, heaters, displays

 Sensors: Temperature, pressure, chemical sensors

Dr. A. F. M. Saifuddin Saif 57


Outlines
 Agents
 Agents function and program
 Mapping (Percept seq to actions)
 Autonomy
 Vacuum cleaner agents
 Agent program for vacuum cleaner
 Agent ProgrameTable look up agents
 Rational agents
 Rational and Omniscience agent
 Omniscience, Learning and Autonomy
 Task Environment or PEAS
Environment Properties
 Subtle Issues
 Types of agents
 Summary agent types

Dr. A. F. M. Saifuddin Saif 58


Environment Properties
 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.)
 Nondeterministic may appear (high %) in Inaccessible environment.

 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.
 It is simpler because the agent does not need to think a head.

Dr. A. F. M. Saifuddin Saif 59


Environment types
 Static (vs. dynamic): The environment is unchanged while an
agent is deliberating.
 Easy to deal
 The environment is semi dynamic 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.

Dr. A. F. M. Saifuddin Saif 60


More Details on Task Environment’s Properties

1) Fully observable vs Partially observable

Characteristic 1: If an agent’s sensors give it access to the complete state of the environment needed to choose

an action, the environment is fully observable.

Alternative 1:A task environment is effectively fully observable if the sensors detect all aspects that are

relevant to the choice of action; relevance, in turn, depends on the performance measure.

Characteristic 2:Fully observable environments is convenient because the agent need not maintain any internal
state to keep track of the world.

Characteristic 3: An environment might be partially observable because of noisy and inaccurate sensors or

because parts of the state are simply missing from the sensor data.

Example: Vacuum agent with only a local dirt sensor cannot tell whether there is dirt in other

squares and an automated taxi cannot see what other drivers are thinking.

Dr. A. F. M. Saifuddin Saif 61


2) Deterministic vs Stochastic vs strategic

 An environment is deterministic if the next state of the environment is completely determined by the
current state of the environment and the action of the agent;

 In a stochastic environment, there are multiple, unpredictable outcomes. (If the environment is
deterministic except for the actions of other agents, then the environment is strategic).

 In a fully observable, deterministic environment, the agent need not deal with uncertainty.

 Note: Uncertainty can also arise because of computational limitations. E.g., we may be playing an
omniscient (“all knowing”) opponent but we may not be able to compute his/her moves.

 Example: Vacuum cleaner is deterministic, but variance can include stochastic elements such as randomly
appearing dirt and unreliable suction mechanism

Dr. A. F. M. Saifuddin Saif 62


2) Deterministic vs Stochastic

Characteristic 1: In principle, an agent need not worry about uncertainty in

fully observable, deterministic environment.

Characteristic 2: If the environment is partially observable , however, then it

could appear to be stochastic. This is particularly true if the environment is

complex, making it hard to keep track of all unobserved objects.

Characteristic 3:Thus its often better to think of an environment as

deterministic or stochastic from the point of view of the agent.


Dr. A. F. M. Saifuddin Saif 63
3) Episodic vs Sequential

Characteristic 1: In an episodic environment, the agent’s experience is divided into atomic episodes. Each episode consists of
the agent perceiving and then performing a single action.

Characteristic 2: Subsequent episodes do not depend on what actions occurred in previous episodes. Choice of action in each
episode depends only on the episode itself. (E.g., classifying images.)

Characteristic 3: In episodic environment, the choice of action in each episode depends only on episode itself.

For example: An agent that has sport defective parts on an assembly line base each decision on current part; regardless of the
previous decision; moreover, the current decision does not effect whether the next part is defective.

Characteristic 4: In a sequential environment, the agent engages in a series of connected episodes. Current decision can affect
future decisions. (E.g., chess and driving, in both cases, short term actions can have long term consequences.)

Characteristic 5: Episodic environments are much simpler than sequential environments because the agent does not
need to think ahead.

Dr. A. F. M. Saifuddin Saif 64


Static vs Dynamic

Characteristic 1: If the environment can change while an agent is deliberating or


thinking, then we say the environment is dynamic for that agent; otherwise it is static.
Characteristic 2: Static environments are easy to deal with because the agent need not
keep looking at the world while it is deciding on an action, nor need it worry about the
passage of time.
Characteristic 3: Dynamic environments, on the other hand are continuously asking the
agent what it wants to do; if it has not decided other hand, are continuously asking the
agent what it wants to do; if it has not decided, that counts as deciding to do nothing.
Example: Taxi driving clearly dynamic; the other cars and the taxi itself keep moving
while the driving algorithm dithers about what to do next. Chess when played within a
clock, is semi dynamic. Crossword puzzles are static.
Characteristic 2: The passage of time as an agent deliberates is irrelevant
Characteristic 3: The environment is semi dynamic if the environment itself does not
change with the passage of time but the agent's performance score does.

Dr. A. F. M. Saifuddin Saif 65


5) Discrete vs Continuous

Characteristic 1: If the number of distinct percepts and actions is limited, the environment is discrete, otherwise it is continuous.

Characteristic 2: The discrete/continuous distinction can be applied to the state of the environment, to the way time is handled,
and to the percepts and actions of the agents.

Example:

Example 1: Chess game has a finite number of distinct states. Chess also has a discrete set of percepts and actions.

Example 2: Taxi driving is a continuous state and continuous- time problem: the speed and location of the taxi and of the other
vehicles sweep through a range of continuous values and do so smoothly over time. Taxi driving actions are also continuous
(Steering, angles, etc).

Example 3: Input from digital cameras is discrete, strictly speaking, but is typically treated as representing continuously varying
intensities and locations.

Dr. A. F. M. Saifuddin Saif 66


Single agent vs Multi-agent

Characteristic 1: If the environment contains other intelligent agents,


the agent needs to be concerned about strategic, game-theoretic
aspects of the environment (for either cooperative or competitive
agents).

Characteristic 1: The distinction between single agents and


multiagents environments may seem simple enough.

Example:

Example 1: An agent solving a crossword puzzle by itself is clearly in a


single agent environment.

Example 2: An agent playing chess is in a two-agent environment call


multi agent.

Dr. A. F. M. Saifuddin Saif 67


Outlines
 Agents
 Agents function and program
 Mapping (Percept seq to actions)
 Autonomy
 Vacuum cleaner agents
 Agent program for vacuum cleaner
 Agent ProgrameTable look up agents
 Rational agents
 Rational and Omniscience agent
 Omniscience, Learning and Autonomy
 Task Environment or PEAS
 Environment Properties
Subtle Issues
 Types of agents
 Summary agent types

Dr. A. F. M. Saifuddin Saif 68


Subtle issues (1)

 The are however, some subtle issues.

Issue 1: First, we have described how an entity may be viewed as an agent, but we have
not explained which entities must be viewed as agents.

Scenario 1: Does an agents A (the taxi driver for example) have to treat an object B
(another vehicle) as an agents, or can it be treated merely as a stochastically
behaving object, analogous to waves at the beach or leaves blowing in the wind? The
key distinction is whether B’s behavior is best described as maximizing a
performance measure whose value depends on agent A’s behavior. For example, in
chess, the opponent entity B is trying to maximize its performance measure, which
by the rules of chess, which by the rules of chess, minimizes agent A’s performance
measure. Thus chess is a competitive multiagents environment .
Dr. A. F. M. Saifuddin Saif 69
Subtle issues (2)

Scenario 2 In the taxi-driving environment, on the other hand, avoiding


collisions maximizes the performance measure of all agents, so it is a
partially cooperative multiagents environment. It is also partially
competitive because, for example, only one car can occupy a parking
space.

Issue 3: The agent – design problems arising in multiagents environment


are often quite different from those in single-agents environments; for
example, communication often emerges as a rational behavior in
multi agents environments; in some partially observable competitive
environments, stochastic behavior is rational because its avoid s the
pitfalls of predictability

Dr. A. F. M. Saifuddin Saif 70


Choice under (Un)certainty
Fully
Observable
yes

no
Deterministic no

yes

Certainty: Uncertainty
Search

Dr. A. F. M. Saifuddin Saif 71


Task Environment of Crossword Puzzle

 Fully/ Partially Observable : Fully Observable

 Deterministic/Strategic/Sequential: Strategic

 Episodic / Sequential : Sequential

 Static/ Semi/ Dynamic: Static

 Discrete / Continuous : Discrete

 Agents: Single

Dr. A. F. M. Saifuddin Saif 72


Explanation for the Task Environment of Crossword Puzzle
 Crossword puzzles are static.

 An agent solving a crossword puzzle by itself is clearly in a


single agent environment.

Dr. A. F. M. Saifuddin Saif 73


Task Environment of Chess with a Clock
 Fully/ Partially Observable : Fully

 Deterministic/Strategic/Sequential: Strategic

 Episodic / Sequential : Sequential

 Static/ Semi/ Dynamic: Semi dynamic

 Discrete / Continuous : Discrete

 Agents: Multi

Dr. A. F. M. Saifuddin Saif 74


Explanation for Task Environment of Chess with a Clock

 Chess when played within a clock, is semi


dynamic.
 Chess game has a finite number of distinct states.
Chess also has a discrete set of percepts and
actions.
 An agent playing chess is in a two-agent
environment call multi agent.

Dr. A. F. M. Saifuddin Saif 75


Task Environment of Poker
 Fully/ Partially Observable : Partially

 Deterministic/Strategic: Strategic

 Episodic / Sequential : Sequential

 Static/ Semi/ Dynamic: Static

 Discrete / Continuous : Discrete

 Agents: Multi

Dr. A. F. M. Saifuddin Saif 76


Task Environment of Backgammon
 Fully/ Partially Observable : Fully

 Deterministic/Strategic: Stochastic

 Episodic / Sequential : Sequential

 Static/ Semi/ Dynamic: Static

 Discrete / Continuous : Discrete

 Agents: Multi

Dr. A. F. M. Saifuddin Saif 77


Task Environment of Taxi Driving
 Fully/ Partially Observable : Fully

 Deterministic/Strategic: Stochastic

 Episodic / Sequential : Sequential

 Static/ Semi/ Dynamic: Dynamic

 Discrete / Continuous : Continuous

 Agents: Multi

Dr. A. F. M. Saifuddin Saif 78


Explanation of Task Environment of Taxi Driving

 Taxi driving is clearly stochastic because one can never predict


the behavior of the traffic exactly, moreover one’s tries to blow
out and one’s engine seizes up without warning.
 Taxi driving clearly dynamic; the other cars and the taxi itself
keep moving while the driving algorithm dithers about what to do
next.
 Taxi driving is a continuous state and continuous- time problem:
the speed and location of the taxi and of the other vehicles sweep
through a range of continuous values and do so smoothly over
time. Taxi driving actions are also continuous (Steering, angles,
etc).

Dr. A. F. M. Saifuddin Saif 79


Task Environment of Medical Diagnosis
 Fully/ Partially Observable : Partially

 Deterministic/Strategic: Stochastic

 Episodic / Sequential : Sequential

 Static/ Semi/ Dynamic: Dynamic

 Discrete / Continuous : Continuous

 Agents: Single

Dr. A. F. M. Saifuddin Saif 80


Task Environment of Image Analysis
 Fully/ Partially Observable : Fully

 Deterministic/Strategic: Deterministic

 Episodic / Sequential : Episodic

 Static/ Semi/ Dynamic: Semi Dynamic

 Discrete / Continuous : Continuous

 Agents: Single

Dr. A. F. M. Saifuddin Saif 81


Task Environment of Part Picking Robot
 Fully/ Partially Observable : Partially

 Deterministic/Strategic/Stohastic: Stohastic

 Episodic / Sequential : Episodic

 Static/ Semi/ Dynamic: Dynamic

 Discrete / Continuous : Continuous

 Agents: Single

Dr. A. F. M. Saifuddin Saif 82


Task Environment of Refinary Controller
 Fully/ Partially Observable : Partially

 Deterministic/Strategic/ Stochastic : Stochastic

 Episodic / Sequential : Sequential

 Static/ Semi/ Dynamic: Dynamic

 Discrete / Continuous : Continuous

 Agents: Single

Dr. A. F. M. Saifuddin Saif 83


Task Environment of Interactive English Tutor

 Fully/ Partially Observable : Partially

 Deterministic/Strategic/ Stochastic : Stochastic

 Episodic / Sequential : Sequential

 Static/ Semi/ Dynamic: Dynamic

 Discrete / Continuous : Discrete

 Agents: Multi

Dr. A. F. M. Saifuddin Saif 84


Outlines
 Agents
 Agents function and program
 Mapping (Percept seq to actions)
 Autonomy
 Vacuum cleaner agents
 Agent program for vacuum cleaner
 Agent ProgrameTable look up agents
 Rational agents
 Rational and Omniscience agent
 Omniscience, Learning and Autonomy
 Task Environment or PEAS
 Environment Properties
 Subtle Issues
Types of agents
 Summary agent types

Dr. A. F. M. Saifuddin Saif 85


Agent Types

Table-lookup driven agents

Simple reflex agents

Model-based reflex agents

Goal-based agents

Utility-based agents

Learning agents

Dr. A. F. M. Saifuddin Saif 86


Table lookup

 Action sequence of length K, gives 4^K different possible sequences.

 At least many entries are needed in the table. So, even in this very toy
world, with K = 20, you need a table with over 4^20 > 10^12 entries.
 In more real-world scenarios, one would have many more different
percepts (eg many more locations), e.g., >=100. There will therefore be
100^K different possible sequences of length K. For K = 20, this would
require a table with over 100^20 = 10^40 entries. Infeasible to even
store.
 So, table lookup formulation is mainly of theoretical interest. For
practical agent systems, we need to find much more compact
representations. For example, logic-based representations, Bayesian net
representations or neural net style representations, or use a different
agent architecture, e.g., “ignore the past” --- Reflex agents.
Dr. A. F. M. Saifuddin Saif 87
Simple reflex agents (1)

Agents do not have memory of past world states or percepts.


 So, actions depend solely on current percept.
 Action becomes a “reflex.”
 Uses condition-action rules.
 Example,
 vacuum agent whose agent function is a simplex agent, because its decision is
based on only on the current location and on whether that contains dirt. Vacuum
agent program is very small indeed compared to the corresponding table. The most
obvious reductions come from ignoring the percept history, which cuts down the
number of possibilities from situation action-rules or if –then rules. A further small
reduction comes from the fact, when current square is dirty, the action does not
depend on the location.
 Automated taxi driver: If the car in front brakes and it’s brake light come on, then
you should notice this and initiate breaking. In other words, some processing is
done on the visual input to establish the condition we call
Dr. A. F. M. Saifuddin Saif 88
Simple reflex agents (2)

“The car in front is braking”. This triggers some


establish connection in the agent program to the
action “initiate braking”. We call such a
condition-action rule written as:
If car-in-front-is-braking then initiate-braking.
3. Human also have such connects, some of which are
learned responses and some of which are innate
reflexes (such as blinking when something
approaches the eye.)

Dr. A. F. M. Saifuddin Saif 89


Agent Program for Simple reflex agents (3)

 We use rectangles to denote the current internal state of the agent’s decision process.

 The INTERPRET-INPUT function generates an abstract description of the current


state from the percept.

 The RULE-MATCH function returns the first rule in the set of rules that matches the
given state description.

 Note that the description in terms of “rules” and “matching” is purely conceptual;
actual implementation can be as simple as a collection of logic gates implementing a
Boolean circuit.

Dr. A. F. M. Saifuddin Saif 90


Schematic Diagram for Simple reflex agents (4)

If tail-light of car in front is red, then brake.

91
Dr. A. F. M. Saifuddin Saif
Problems of Simple reflex agents (5)

 Simple reflex agents have the admirable property of being simple, but they turn out
to be very limited intelligence.

 It can be seen from the schematic diagram that, they will work only “if the correct
decision can be made on the basis of only the current percept- that is , only if
the environment is fully observable”.

 Even a little bit of unobservability can cause serious trouble.

 Example: The braking rule given earlier assumes that the condition car-in-front-
is-braking can be determined form the current percept – the current video image- if
the car in front has a centrally mounted brake light. Unfortunately, older models
have different configuration of taillights, brake lights and turn-signal lights and it is
not always possible to tell from a single image whether the car is braking. A simple
agent driving behind such a car would either brake continuously and unnecessarily
or worse, never brake at all.

Dr. A. F. M. Saifuddin Saif 92


Problems of Simple reflex agents (6)
 Example: Similar problem arises in vacuum world. Suppose
that a simple reflex vacuum agent is deprived of its location
sensor, and has only dirt sensor. Such an agent has just two
possible percepts: [Dirty] and [Clean]. It can suck in response
to [Dirty]; However, what should do in response to [Clean]?
Moving Left fails (for ever) if it happens to start in square A,
and moving Right fails (for ever) if it happens to start in
square B.

 Infinite loop are often unavoidable for simple reflex agents


operating in partially observable environments

Dr. A. F. M. Saifuddin Saif 93


Solution for Simple reflex agents (7)
 Escape from infinite loops is possible if the agent can randomize its
actions. For example, if the vacuum agents perceives [Clean], it might
flip a coin to choose between Left and Right. It is easy to show that
agent will reach the other square in an average of two steps. Hence, a
randomized simple agent might outperform a deterministic simple reflex
agent.

 However, randomized behavior of the right kind can be rational in some


multiagents environments. In single- agent environments, randomization
is usually not rational. It is a useful trick that helps a simple reflex agent
in some situations, but in most cases we can do much better with more
sophisticated deterministic agents.

Dr. A. F. M. Saifuddin Saif 94


Model Based Reflex Agents (1)
 The most effective way to handle partial observability is for the agent to
keep track of the part of the world it can not see now.
That is, the agent should maintain some sort of internal state that depends
on the percept history and thereby reflects at least some of the unobserved
aspects of the current state.
Example: for the braking problem, the internal state is not too extensive- just
the previous of the camera, allowing the agent to detect when two red lights at
the edge of the vehicle go on or off simultaneously. For other driving tasks
such as changing lanes, the agent need to keep track of where the other cars are
if it can not see them all at once.
Key difference with simple reflex agents:
Agents have internal state, which is used to keep track of past states of the
world.
Agents have the ability to represent change in the World.
Dr. A. F. M. Saifuddin Saif 95
Why Model Based Reflex Agents (2)
Updating internal state information as time goes by requires two kinds of
knowledge to be encoded in the agent program.
1. First, we need some information about how the world evolves independently
of the agent – for example, that an overtaking car generally will be closer
behind that it was a moment ago.
2. Second, we need some information about how the agent’s own actions
affect the world – for example, that when the agent turns the steering wheel
clockwise, the car turns to the right or that after driving for five minutes
northbound on the freeway one is usually about five miles north of where
one was five minutes ago. This knowledge about the how the world works –
whether implemented in simple Boolean circuits or in complete scientific
theories – is called model of the world. An agent that uses such a model is
called a model – based agent.
Dr. A. F. M. Saifuddin Saif 96
Schematic Diagram for Model Based Reflex Agents (3)

“Infers potentially
dangerous driver
in front.”

If “dangerous driver in front,”


then “keep distance.”

97
Dr. A. F. M. Saifuddin Saif
Agent Program for Model Based Reflex Agents (4)

 The interesting part is the function UPDATE-SATE which is responsible for creating the
new internal state description. As well as interpreting the new percept in the light of existing
knowledge about the state, it uses information about how the world evolves to keep track of
the unseen part of the world and also must know about what the agent’s actions do to the
state of the world.

Dr. A. F. M. Saifuddin Saif 98


Brooks’ Subsumption Architecture, Model Based Reflex Agents (5)

 Subsumption architecture is a reactive robotic architecture heavily


associated with behavior based robotics which was very popular in the
 Rodneyand
1980's Allen
90's.Brooks (born
The term 30 wasDecember
introduced by Rodney Brooks and
1954) is an Australian roboticist.
colleagues in 1986. Subsumption architecture has been widely influential
inFellow
 autonomous robotics and elsewhere in real time AI.
of Australian academy of science
author, and robotics entrepreneur, most known
for popularizing the actionist approach to
robotics.
 Professor of Robotics at the Massachusetts
Institute of Technology and former director of
the  MIT Computer Science and Artificial
Intelligence Laboratory.

Dr. A. F. M. Saifuddin Saif 99


Brooks’ Subsumption Architecture, Model Based Reflex Agents (6)

Dr. A. F. M. Saifuddin Saif 100


An example: Brooks’ Subsumption Architecture, Model Based
Reflex Agents (7)
 Main idea: build complex, intelligent robots by decomposing
behaviors into a hierarchy of skills, each defining a percept-
action cycle for one very specific task.
 Examples: collision avoidance, wandering, exploring,
recognizing doorways, etc.
 Each behavior is modeled by a finite-state machine with a
few states (though each state may correspond to a complex
function or module; provides internal state to the agent).
 Behaviors are loosely coupled via asynchronous interactions.
 Note: minimal internal state representation.
Dr. A. F. M. Saifuddin Saif 101
Brooks’ Subsumption Architecture, Model Based Reflex Agents (8)

In subsumption architecture, increasingly complex behaviors


arise from the combination of simple behaviors.

The most basic simple behaviors are on the level of reflexes: •


avoid an object; • go toward food if hungry, • move randomly.

A more complex behavior that sits on top of simple behaviors


may be “go across the room.”

The more complex behaviors subsume the less complex ones to


accomplish their goal.

Dr. A. F. M. Saifuddin Saif 102


Brooks’ Subsumption Architecture, How much of an internal model of the world?
(9)

 Planning in and reasoning about our surroundings appears to require some kind of internal
representation of our world. We can “try” things out in this representation. Much like an
running a “simulation” of the effect of actions or a sequence of actions in our head.

 General assumption for many years: The more detailed internal model, the better.

 Brooks (mid 80s and 90s) challenged this view:

 The philosophy behind Subsumption Architecture is that the world should be used as its
own model. According to Brooks, storing models of the world is dangerous in dynamic,
unpredictable environments because representations might be incorrect or outdated. What
is needed is the ability to react quickly to the present. So, use minimal internal state
representation, complement at each time step with sensor input.

 Debate continues to this day: How much of our world do we (should we) represent
explicitly? Subsumption architecture worked well in robotics.

Dr. A. F. M. Saifuddin Saif 103


Task: From Collision avoidance
resources write down internal states

1(BONUS)

Dr. A. F. M. Saifuddin Saif 104


Goal Based Agents: Situation to Arise (1)
 Knowing about the current state of the environment is not always
enough to decide what to do. For example, at a road junction, the taxi
can turn left, turn right, or go straight on. The correct decision depends
on where the taxi is trying to get to.
 In other words, as well as a current state description, the agent needs
some sort of goal information that describes situation that are desirable-
for example, being at the passengers destination (taxi).
The agent program can combine this with information about the
results of possible actions (the same information as was used to update
internal state in the reflex agent) in order to choose actions that achieve
the goal.
In addition to state information, have goal information that describes
desirable situations to be achieved.
Dr. A. F. M. Saifuddin Saif 105
Goal Based Agents: Difference from simple reflex agents(2)

 Notice that decision making of this kind is fundamentally different from to


condition- action rules described earlier, in that it involves consideration of the
future – both
1. What will happen if I do such – and – such
2. Will that make me happy?

 In the reflex agent design, this information is not explicitly represented,


because the built in-rules map directly from percepts to actions.
 The reflex agent brakes when it sees brake lights. A goal – based agent, in
principle, could reason tat if the car in front has its brake light on, it will
slow down. Given the way the world usually evolves, the only action that
will achieve the goal of not hitting other cars is to brake.

Dr. A. F. M. Saifuddin Saif 106


Goal Based Agents: Challenge and Advantage(3)

 Sometimes goal-based agent is straight forward, when satisfaction results


immediately from a single action.
Sometimes it will be tricky, when the agent has to consider long sequences
of twists and turns to find a way to achieve the goal.
Although the goal based agents appears less efficient, it is more flexible
because the knowledge that supports its decision is represented explicitly and
can be modified.
 For example: If it starts to rain, the agent can update its knowledge of how
effectively its brakes will operate; this will automatically cause all of the
relevant behaviors to be altered to suit the new conditions. For the reflex
agents, on the hand, we could have to rewrite many condition – action rules.
The goal based agent’s behavior can easily be changed to go to a different
location. The reflex agent’s rules for when to turn and when to go straight will
work only for a single destination; they must be replaced to go somewhere n
Dr. A. F. M. Saifuddin Saif 107
Schematic Diagram for Goal Based Agents (4)

Considers “future”
“Clean kitchen”

Agent keeps track of the world state as well as set of goals it’s trying to achieve: chooses actions
that will (eventually) lead to the goal(s).
108
More flexible than reflex agents  may involve search
Dr. A. F. M. and
Saifuddin Saifplanning
Utility Based Agents: Situation to Arise (1)
 Goals are not really enough to generate high-quality behavior in most
environments. For example, there are many action sequences that will get the
taxi to its destination (thereby achieving the goal ), but some are quicker, safer,
more reliable, or cheaper than others.
Goal just provide a crude binary distinction between “happy” and
“unhappy” states, whereas a moral general performance measure should allow
a comparison of different world states according o exactly how happy they
would make the agent if they could be achieved.
Because, the word “happy” does not sound very scientific, the customary
terminology is to say that if one world state is preferred to another, it has
higher utility for the agent.

Dr. A. F. M. Saifuddin Saif 109


Utility-based agents: Specification (2)

 When there are multiple possible alternatives, how to decide which one is
best?
 Goals are qualitative: A goal specifies a crude distinction between a happy
and unhappy state, but often need a more general performance measure that
describes “degree of happiness.”
 Utility function U: State  R indicating a measure of success or happiness
when at a given state.
 Important for making tradeoffs: Allows decisions comparing choice
between conflicting goals, and choice between likelihood of success and
importance of goal (if achievement is uncertain).
Use decision theoretic models: e.g., faster vs. safer.

Dr. A. F. M. Saifuddin Saif 110


Utility-based agents: Specification (3)

 A utility function maps a state (or a sequence of states) onto a real number,
which describes the associated degree of happiness.
 A complete specification of the utility function allows rational decisions in
two kinds of cases where goals are inadequate.

1. First, when there are conflicting goals, only some of which can be achieve
(For example, speed and safety), the utility function specifies the appropriate
tradeoff.

2. Second, when there are several goals that the agent can for, none of which
can be achieved with certainty utility provides a way in which the likelihood
of success can be weighted up against the importance of the goals.

Dr. A. F. M. Saifuddin Saif 111


Schematic Diagram for Utility Based Agents (4)

Decision theoretic actions:


e.g. faster vs. safer

Dr. A. F. M. Saifuddin Saif 112


Learning Agents: Situation to Arise (1)
 We have not so far, explained how the agent programs come
into being. For example, Turing (1950) considers the idea of
actually programming his intelligent machines by hand. He
estimates how much work this might take and concludes “Some
more expeditious method seems desirable”. The method he
proposes is to build learning machines and then to teach them.
In many areas of AI, this is now the preferred method for
creating state-of-art systems.
 Learning has another advantage, as we noted earlier: it allows
the agent to operate in initially unknown environments and to
become more competent than its initial knowledge alone might
now.
Dr. A. F. M. Saifuddin Saif 113
Components of Learning Agents(2)

 Learning element: The most important distinction is between learning element,


which is responsible for making improvements.
Performance element: Responsible for selecting external actions. The performance
element is what we have previously considered to be the entire agent; it takes in
percepts and decides on actions. The learning element use feedback from the critic on
how the agent is doing and determines how the performance element should be
modified to do better future.
Critic: The critic tells the learning element how well the agent is doing with respect
to a fixed performance standard. The critic is necessary because the percepts themselves
provide no indication of the agent’s success. For example, a chess program could
receive a percept indicating that it has checkmated it opponent, but it needs a
performance standard to know that this a good thing; the percept itself does not say so.
It is important that the performance standard be fixed. Conceptually, one should think of
it as being outside the agent altogether, because the agent must not modify it to fit its
own behavior.

Dr. A. F. M. Saifuddin Saif 114


Components of Learning Agents(2)
 Problem Generator: It is responsible for suggesting actions that will lead
to new and informative experiences. The point is that if the performance
element had its way, it would keep doing the actions that are best, given what it
knows. But if the agent is willing to explore a little and do some perhaps
suboptional actions in the short run, it might discover much better actions for
the long run. The problem generator’s job is to suggest these exploratory
actions. This what scientists do when they carry out experiments. Galileo did
not think that dropping rocks from the top of a tower in Pisa was valuable in
itself. He was not trying to break the rocks, nor to modify the brains of
unfortunate passers- by. His aim was to modify his own brain, by identifying a
better theory of the motion of objects.

Dr. A. F. M. Saifuddin Saif 115


Design of Learning Elements : Learning Agents(3)
The design of learning elements depends very much
on the design of the performance element. When trying
to design an agent that learns a certain capability, the
first question is not “ How I am going to get it to learn
this” but “What kind of performance element will my
agent need to do this once it has learned how?”
Given an agent design, learning mechanisms can be
constructed to improve every part of the agent.

Dr. A. F. M. Saifuddin Saif 116


Automate Taxi as Learning Agents(3)
The performance element consists of whatever collection of
knowledge and procedures the taxi has for selection its driving actions.
The taxi goes out of the road and drives using this performance element.
 The critic observes the world and passes information along to the
learning elements. For example, after the taxi makes a quick left turn
across three lanes of the traffic, the critic observes the shocking
language used by other drivers. From this experience, the learning
elements is able to formulate a rule saying this was a bad actions and the
performance element is modified by installing the new rule.
The problem generator might identify certain areas of behavior in
need of improvement and suggest experiments, such as trying out the
brakes on different road surfaces under different conditions.

Dr. A. F. M. Saifuddin Saif 117


More complicated when agent needs to learn utility Learning agents
information: Reinforcement learning (based on Adapt and improve over time
action payoff)

Module:
Learning

“Quick turn is not safe”

No quick turn

Road conditions, etc


Takes percepts
and selects actions

Try out the brakes on


different road surfaces
118
Dr. A. F. M. Saifuddin Saif
Outlines
 Agents
 Agents function and program
 Mapping (Percept seq to actions)
 Autonomy
 Vacuum cleaner agents
 Agent program for vacuum cleaner
 Agent ProgrameTable look up agents
 Rational agents
 Rational and Omniscience agent
 Omniscience, Learning and Autonomy
 Task Environment or PEAS
 Environment Properties
 Subtle Issues
 Types of agents
Summary agent types

Dr. A. F. M. Saifuddin Saif 119


Summary: agent types

(1) Table-driven agents


 use a percept sequence/action table in memory to find the next action. They are implemented by a
(large) lookup table.

(2) 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.

(3) Agents with memory - Model-based reflex agents


 have internal state, which is used to keep track of past states of the world.

(4) Agents with goals – Goal-based agents


 are agents that, in addition to state information, have goal information that describes desirable
situations. Agents of this kind take future events into consideration.

(5) Utility-based agents


 base their decisions on classic axiomatic utility theory in order to act rationally.

(6) Learning agents


 they have the ability to improve performance through learning.

Dr. A. F. M. Saifuddin Saif 120


Summary

An agent perceives and acts in an environment, has an architecture, and is implemented by an agent
program.

A rational agent always chooses the action which maximizes its expected performance, given its percept
sequence 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 and updates its internal state.
 Reflex agents (simple / model-based) respond immediately to percepts.
 Goal-based agents act in order to achieve their goal(s), possible sequence of steps.
 Utility-based agents maximize their own utility function.
 Learning agents improve their performance through learning.

Representing knowledge is important for successful agent design.

The most challenging environments are partially observable, stochastic, sequential, dynamic, and
continuous, and contain multiple intelligent agents.

Dr. A. F. M. Saifuddin Saif 121


122

BONUS MARKS

More additional assignments (Optional) in the


next 6 slides.
(6x1 Marks)

Dr. A. F. M. Saifuddin Saif


Explore the differences between agent functions and agent programme.
(Bonus Mark =1)

 Can there be more than one agent program that implements a given

agent functions? Given an example, or show why one is not possible.

 Are there agent functions that cannot be implemented by any agent

program?

 Given a fixed machine architecture, does each agent program

implement exactly one agent function?

Dr. A. F. M. Saifuddin Saif 123


Examine the rationality of various vacuum- cleaner agents
function. (Bonus Mark =1)

 Show that, simple vacuum cleaner agent function described

previously is indeed rational under the some assumptions. Write


down the assumptions in your opinion.

 Describe a rational agent function for the modified performance

measures that deducts one point for each of the movement. Does
the corresponding agent program require internal state?

Dr. A. F. M. Saifuddin Saif 124


A. For each of the following agents, develop a PEAS description of the task
environment; (Bonus Mark =1)
 Robot soccer player

 Internet book-shopping agent;

 Autonomous Mars rover;

 Mathematician’s theorem-proving assistant;

B. For each of the agents types list above in “A” characterize the environment
according to the properties and select a suitable agent design.

Dr. A. F. M. Saifuddin Saif 125


 Can a simplex agent be perfectly rational for any specific
environment? Explain.
 Can a simple reflex agent with a randomized agent function
outperforms a simple reflex agent? Design such an agent and
measure its performance on several environment.
 Can you design an environment in which your randomized agent
will perform very poorly? Justify your answers.

(Bonus Mark =1)

Dr. A. F. M. Saifuddin Saif 126


The vacuum environments in the preceding exercises have all been
deterministic. Discuss possible agent programs for each of the
following stochastic versions: (Bonus Mark = 1)

 Murphy’s law: twenty- five percent of the time, the suck fails to
clean the floor if it dirty and deposits dirt onto the floor if the
floor is clean. How is your agent program affected if the dirt
sensor gives the wrong answer 10% of the time.
 Small children: At each time step, each clean square has a 10%
chance of becoming dirty. Can you come up with a rational
agent design for this case.
Dr. A. F. M. Saifuddin Saif 127
 What kind of agents would be appropriate to design human
liver function. Explain. For easy explanation one video for
human liver model is shown in the next slide.
(Bonus Marks=1)

Dr. A. F. M. Saifuddin Saif 128


Liver Modeling

https://www.youtube.com/watch?v=tat0QYxlCbo

Dr. A. F. M. Saifuddin Saif 129


References

1. Chapter 2: Intelligent Agents , Pages 34-58


“Artificial Intelligence: A Modern Approach,” by Stuart J. Russell and Peter Norvig,
Books

1. “Artificial Intelligence: A Modern Approach,” by Stuart J. Russell and Peter Norvig.


2. "Artificial Intelligence: Structures and Strategies for Complex Problem Solving", by
George F. Luger, (2002)
3. "Artificial Intelligence: Theory and Practice", by Thomas Dean.
4. "AI: A New Synthesis", by Nils J. Nilsson.
5. “Programming for machine learning,” by J. Ross Quinlan,
6. “Neural Computing Theory and Practice,” by Philip D. Wasserman, .
7. “Neural Network Design,” by Martin T. Hagan, Howard B. Demuth, Mark H.
Beale, .
8. “Practical Genetic Algorithms,” by Randy L. Haupt and Sue Ellen Haupt.
9. “Genetic Algorithms in Search, optimization and Machine learning,” by David E.
Goldberg.
10."Computational Intelligence: A Logical Approach", by David Poole, Alan
Mackworth, and Randy Goebel.
11.“Introduction to Turbo Prolog”, by Carl Townsend.

You might also like