Professional Documents
Culture Documents
Course Code: CSC4226 Course Title: Artificial Intelligence and Expert System
Submission Procedure 1:
ii) Mention your name, id and section in each page of MS Word document in the top right portion of every page .
iv) Make sure, your document does not bear the characteristics of “Copy and Paste”. More than 5% similarity may harm to overall
performance.
4
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 .
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.
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.
Percept sequence
√ Complete history of everything that the agent has ever
perceived.
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.
Internally, the agent function for an artificial agent will be implemented by an agent program.
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.
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
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.
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.
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.
1(BONUS)
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)
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.
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!!!
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.
1(BONUS)
https://www.youtube.com/watch?v=I1RHmSm36aE
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.
1(BONUS)
https://www.youtube.com/watch?v=CFn4hCZ3g9w
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.
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.
Vacuum agent learns to foresee where and when additional dirt will
appear will do better than one that does not.
Question: What is your opinion to deploy ‘learn’ in scenario 1-3? And how
you plan to do that? 1(BONUS)
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
Sensors: Keyboard
PEAS : Example 5
Agent: Satellite Image Analysis System
Characteristic 1: If an agent’s sensors give it access to the complete state of the environment needed to choose
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.
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
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.
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.
Example:
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)
no
Deterministic no
yes
Certainty: Uncertainty
Search
Deterministic/Strategic/Sequential: Strategic
Agents: Single
Deterministic/Strategic/Sequential: Strategic
Agents: Multi
Deterministic/Strategic: Strategic
Agents: Multi
Deterministic/Strategic: Stochastic
Agents: Multi
Deterministic/Strategic: Stochastic
Agents: Multi
Deterministic/Strategic: Stochastic
Agents: Single
Deterministic/Strategic: Deterministic
Agents: Single
Deterministic/Strategic/Stohastic: Stohastic
Agents: Single
Agents: Single
Agents: Multi
Goal-based agents
Utility-based agents
Learning agents
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)
We use rectangles to denote the current internal state of the agent’s decision process.
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.
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”.
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.
“Infers potentially
dangerous driver
in front.”
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.
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.
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.
1(BONUS)
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.
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.
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.
Module:
Learning
No quick turn
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.
The most challenging environments are partially observable, stochastic, sequential, dynamic, and
continuous, and contain multiple intelligent agents.
BONUS MARKS
Can there be more than one agent program that implements a given
program?
measures that deducts one point for each of the movement. Does
the corresponding agent program require internal state?
B. For each of the agents types list above in “A” characterize the environment
according to the properties and select a suitable agent design.
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)
https://www.youtube.com/watch?v=tat0QYxlCbo