AI Module1
AI Module1
1.1 INTRODUCTION
OR
Building AI Systems:
1) Perception
Intelligent biological systems are physically embodied in the world and experience the world
through their sensors (senses). For an autonomous vehicle, input might be images from a
camera and range information from a rangefinder. For a medical diagnosis system, perception
is the set of symptoms and test results that have been obtained and input to the system
manually.
2) Reasoning
Inference, decision-making, classification from what is sensed and what the internal "model"
is of the world. Might be a neural network, logical deduction system, Hidden Markov Model
induction, heuristic searching a problem space, Bayes Network inference, genetic algorithms,
etc. Includes areas of knowledge representation, problem solving, decision theory, planning,
game theory, machine learning, uncertainty reasoning, etc.
3) Action
Biological systems interact within their environment by actuation, speech, etc. All behavior is
centered around actions in the world. Examples include controlling the steering of a Mars
rover or autonomous vehicle, or suggesting tests and making diagnoses for a medical
diagnosis system. Includes areas of robot actuation, natural language generation, and speech
synthesis.
Intelligent Systems:
In order to design intelligent systems, it is important to categorize them into four categories
(Luger and Stubberfield 1993), (Russell and Norvig, 2003)
1. Systems that think like humans
2. Systems that think rationally
3. Systems that behave like humans
4. Systems that behave rationally
a. The art of creating machines that performs functions requiring intelligence when
performed by people; that it is the study of, how to make computers do things which, at the
moment, people do better.
b. Focus is on action, and not intelligent behaviour cantered around the representation of the
world
c. Example: Turing Test
3 rooms contain: a person, a computer and an interrogator.
The interrogator can communicate with the other 2 by teletype (to avoid the Machine
imitate the appearance of voice of the person)
The interrogator tries to determine which the person is and which the machine is.
The machine tries to fool the interrogator to believe that it is the human, and the
person also tries to convince the interrogator that it is the human.
If the machine succeeds in fooling the interrogator, then conclude that the machine is
intelligent.
Thinking humanly: The cognitive modelling approach
If we are going to say that a given program thinks like a human, we must have some way
of determining how humans think. We need to get inside the actual workings of human
minds. There are three ways to do this: through introspection—trying to catch our own
thoughts as they go by; through psychological experiments—observing a person in action;
and through brain imaging—observing the brain in action.
a. Requires a model for human cognition. Precise enough models allow simulation by
computers.
b. Focus is not just on behaviour and I/O, but looks like reasoning process.
c. Goal is not just to produce human-like behaviour but to produce a sequence of steps of the
reasoning process, similar to the steps followed by a human in solving the same task.
Richard Bellman (1957) formalized a class of sequential decision problems called Markov
decision processes, satisficing—making decisions that are “good enough,”
areas in astronomical images into either stars or galaxies with very high accuracy by learning
from human experts' classifications.
5) Mathematical Theorem Proving
Use inference methods to prove new theorems.
6) Natural Language Understanding
AltaVista's translation of web pages. Translation of Catepillar Truck manuals into 20
languages.
7) Scheduling and Planning
Automatic scheduling for manufacturing. DARPA's DART system used in Desert Storm and
Desert Shield operations to plan logistics of people and supplies. American Airlines rerouting
contingency planner. European space agency planning and scheduling of spacecraft
assembly, integration and verification.
8) Artificial Neural Networks:
How do brains process information?
Neuroscience is the study of the nervous system, particularly the brain. Although the exact
NEUROSCIENCE
way in which the brain enables thought is one of the great mysteries of science, the fact that it
does enable thought has been appreciated for thousands of years because of the evidence that
strong blows to the head can lead to mental incapacitation. It has also long been known that
human brains are somehow different.
The truly amazing conclusion is that a collection of simple cells can lead to thought,
action, and consciousness or, in the pithy words of John Searle (1992), brains cause minds.
9) Machine Learning
Machine learning is an application of AI. It's the process of using mathematical models of
data to help a computer learn without direct instruction. This enables a computer system to
continue learning and improving on its own, based on experience.
Control theory and cybernetics
How can artifacts operate under their own control?
Ktesibios of Alexandria (c. 250 B.C.) built the first self-controlling machine: a water clock
with a regulator that maintained a constant flow rate. This invention changed the definition
of what an artifact could do. Wiener was a brilliant mathematician who worked with Bertrand
Rus-sell,, among others, before developing an interest in biological and mechanical control
systems and their connection to cognition. The idea that intelligence could be created by the
use of homeostatic devices containing appropriate feedback loops to achieve stable adaptive
behavior. Modern control theory, especially the branch known as stochastic optimal control,
has as its goal the design of systems that maximize an objective function over time.
Linguistics
This was a comprehensive, detailed account of the behaviorist approach to language learning,
written by the foremost expert in the field. But curiously, a review of the book became as
well known as the book itself, and served to almost kill off interest in behaviorism. Modern
linguistics and AI, then, were “born” at about the same time, and grew up together,
intersecting in a hybrid field called computational linguistics or natural language
processing. Much of the early work in knowledge representation (the study of how to put
knowledge into a form that a computer can reason with) was tied to language and informed
by research in linguistics, which was connected in turn to decades of work on the
philosophical analysis of language.
program to control the scheduling of operations for a spacecraft (Jonsson et al., 2000).
REMOTE AGENT generated plans from high-level goals specified from the ground
and monitored the execution of those plans—detecting, diagnosing, and recovering
from problems as they occurred.
Game playing: IBM’s DEEP BLUE became the first computer program to defeat the
world champion in a chess match when it bested Garry Kasparov by a score of 3.5 to
2.5 in an exhibition match (Goodman and Keene, 1997). Kasparov said that he felt a
“new kind of intelligence” across the board from him. Newsweek magazine described
the match as “The brain’s last stand.” The value of IBM’s stock increased by $18
billion. Human champions studied Kasparov’s loss and were able to draw a few
matches in subsequent years, but the most recent human-computer matches have been
won convincingly by the computer.
Spam fighting: Each day, learning algorithms classify over a billion messages as
spam, saving the recipient from having to waste time deleting what, for many users,
could comprise 80% or 90% of all messages, if not classified away by algorithms.
Because the spammers are continually updating their tactics, it is difficult for a static
programmed approach to keep up, and learning algorithms work best (Sahami et al.,
1998; Goodman and Heckerman, 2004).
Logistics planning: During the Persian Gulf crisis of 1991, U.S. forces deployed a
Dynamic Analysis and Replanning Tool, DART (Cross and Walker, 1994), to do
automated logistics planning and scheduling for transportation. This involved up to
50,000 vehicles, cargo, and people at a time, and had to account for starting points,
destinations, routes, and conflict resolution among all parameters. The AI planning
techniques generated in hours a plan that would have taken weeks with older methods.
The Defense Advanced Research Project Agency (DARPA) stated that this single
application more than paid back DARPA’s 30-year investment in AI.
Robotics: The iRobot Corporation has sold over two million Roomba robotic vacuum
cleaners for home use. The company also deploys the more rugged PackBot to Iraq
and Afghanistan, where it is used to handle hazardous materials, clear explosives, and
identify the location of snipers.
Machine Translation: A computer program automatically translates from Arabic to
English, allowing an English speaker to see the headline “Ardogan Confirms That
Turkey Would Not Accept Any Pressure, Urging Them to Recognize Cyprus.” The
systems have been able to achieve to date, we see that their achievements include performing
sophisticated tasks like medical diagnosis, performing symbolic integration, proving
theorems and playing chess.
INTELLIGENT AGENTS
2.1 AGENTS AND ENVIRONMENTS
Agent:
An Agent is anything that can be viewed as perceiving its environment through sensors and
acting upon that environment through actuators.
A human agent has eyes, ears, and other organs for sensors and hands, legs, mouth,
and other body parts for actuators.
A robotic agent might have cameras and infrared range finders for sensors and
various motors for actuators.
A software agent receives keystrokes, file contents, and network packets as sensory
inputs and acts on the environment by displaying on the screen, writing files, and
sending network packets.
Percept:
We use the term percept to refer to the agent's perceptual inputs at any given instant.
Percept Sequence:
An agent's percept sequence is the complete history of everything the agent has ever
perceived.
Agent function:
Mathematically speaking, we say that an agent's behavior is described by the agent function
that maps any given percept sequence to an action.
Agent program
Internally, the agent function for an artificial agent will be implemented by an agent program.
It is important to keep these two ideas distinct. The agent function is an abstract mathematical
Description, the agent program is a concrete implementation, running on the agent
architecture. To illustrate these ideas, we will use a very simple example-the vacuum-cleaner
world shown in Fig 2.2. This particular world has just two locations: squares A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. It can
choose to move left, move right, suck up the dirt, or do nothing. One very simple agent
function is the following: if the current square is dirty, then suck, otherwise move to the other
square. A partial tabulation of this agent function is shown in Fig 2.3.
2.2.1 Rationality
What is rational at any given time depends on four things:
• The performance measure that defines the criterion of success.
• The agent’s prior knowledge of the environment.
• The actions that the agent can perform.
• The agent’s percept sequence to date.
rational agent:
For each possible percept sequence, a rational agent should select an action that is expected to
maximize its performance measure, given the evidence provided by the percept sequence and
whatever built-in knowledge the agent has.
Consider the simple vacuum-cleaner agent that cleans a square if it is dirty and moves to the
other square if not; this is the agent function tabulated in Figure 2.3.
Let us assume the following:
• The performance measure awards one point for each clean square at each time step,
over a “lifetime” of 1000 time steps.
• The “geography” of the environment is known a priori (Figure 2.2) but the dirt distribution
and the initial location of the agent are not. Clean squares stay clean and sucking cleans the
current square. 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.
• The only available actions are Left, Right, and Suck.
• The agent correctly perceives its location and whether that location contains dirt.
2.2.2 Omniscience, learning, and autonomy
We need to be careful to distinguish between rationality and omniscience. An omniscient
agent knows the actual outcome of its actions and can act accordingly; but omniscience is
impossible in reality.
Consider the following example: I am walking along the Champs Elyse’s one day and I see
an old friend across the street. There is no traffic nearby and I’m 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,2 and before I make it to the other side of the street I am flattened. Was I
irrational to cross the street? It is unlikely that my obituary would read “Idiot attempts to
cross street.” This example shows that 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 fulfil this specification—unless we improve the
performance of crystal balls or time machines.
Doing actions in order to modify future percents—sometimes called information
gathering—is an important part of rationality. A second example of information gathering is
provided by the exploration that must be undertaken by a vacuum-cleaning agent in an
initially unknown environment.
To the extent that an agent relies on the prior knowledge of its designer rather than on its own
percepts, 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. For example, a vacuum-
cleaning agent that learns to foresee where and when additional dirt will appear will do better than one
that does not. 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. So, just as evolution provides animals with enough built-in reflexes to survive long enough
to learn for themselves, it would be reasonable to provide an artificial intelligent agent with some
initial knowledge as well as an ability to learn. After sufficient experience of its environment, the
behaviour of a rational agent can become effectively independent of its prior knowledge. Hence, the
incorporation of learning allows one to design a single rational agent that will succeed in a vast
variety of environments.
Now that we have a definition of rationality, we are almost ready to think about
building rational agents. First, however, we must think about task environments, which are
essentially the “problems” to which rational agents are the “solutions.” We begin by showing
how to specify a task environment, illustrating the process with a number of examples. We
then show that task environments come in a variety of flavours. The flavour of the task
environment directly affects the appropriate design for the agent program.
the heading of the task environment. For the acronymically minded, we call this the PEAS
(Performance, Environment, Actuators, Sensors) description. In designing an agent, the first
step must always be to specify the task environment as fully as possible. Figure 2.4 summarizes
the PEAS description for the taxi’s task environment. We discuss each element in more detail in the
following paragraphs.
We need to describe the PEAS for the “bidding on an item at an auction” activity. PEAS
stands for Performance measures, Environment, Actuators, and Sensors. We shall see
what these terms mean individually.
Performance measures: These are the parameters used to measure the performance of
the agent. How well the agent is carrying out a particular assigned task.
Environment: It is the task environment of the agent. The agent interacts with its
environment. It takes perceptual input from the environment and acts on the
environment using actuators.
Actuators: These are the means of performing calculated actions on the environment.
For a human agent; hands and legs are the actuators.
Sensors: These are the means of taking the input from the environment. For a human
agent; ears, eyes, and nose are the sensors.
2.3.2 Properties of task environments
The range of task environments that might arise in AI is obviously vast. We can, however,
identify a fairly small number of dimensions along which task environments can be categorized.
These dimensions determine, to a large extent, the appropriate agent design and the applicability
of each of the principal families of techniques for agent implementation.
Features of Environment
As per Russell and Norvig, an environment can have various features from the point of view
of an agent:
1. Fully observable vs Partially Observable
2. Static vs Dynamic
3. Discrete vs Continuous
4. Deterministic vs Stochastic
5. Single-agent vs Multi-agent
6. Episodic vs sequential
7. Known vs Unknown
o If an agent sensor can sense or access the complete state of an environment at each
point of time then it is a fully observable environment, else it is partially
observable.
o A fully observable environment is easy as there is no need to maintain the internal
state to keep track history of the world.
o An agent with no sensors in all environments then such an environment is called
as unobservable.
2. Deterministic vs Stochastic:
o If an agent's current state and selected action can completely determine the next state
of the environment, then such environment is called a deterministic environment.
o A stochastic environment is random in nature and cannot be determined completely
by an agent.
o In a deterministic, fully observable environment, agent does not need to worry about
uncertainty.
3. Episodic vs Sequential:
o In an episodic environment, there is a series of one-shot actions, and only the current
percept is required for the action.
o However, in Sequential environment, an agent requires memory of past actions to
determine the next best actions.
4. Single-agent vs Multi-agent
o If only one agent is involved in an environment, and operating by itself then such an
environment is called single agent environment.
o However, if multiple agents are operating in an environment, then such an
environment is called a multi-agent environment.
o The agent design problems in the multi-agent environment are different from single
agent environment.
5. Static vs Dynamic:
o If the environment can change itself while an agent is deliberating then such
environment is called a dynamic environment else it is called a static environment.
o Static environments are easy to deal because an agent does not need to continue
looking at the world while deciding for an action.
o However for dynamic environment, agents need to keep looking at the world at each
action.
of defective parts, the robot should learn from several observations that the distribution of
defects has changed, and should modify its behaviour for subsequent parts. We have not
included a “known/unknown” column because, as explained earlier, this is not strictly a
property of the environment. For some environments, such as chess and poker, it is quite easy
to supply the agent with full knowledge of the rules, but it is nonetheless interesting to
consider how an agent might learn to play these games without such knowledge.
Several of the answers in the table depend on how the task environment is defined.
We have listed the medical-diagnosis task as single-agent because the disease process in a
patient is not profitably modeled as an agent; but a medical-diagnosis system might also have
to deal with recalcitrant patients and skeptical staff, so the environment could have a
multiagent aspect. Furthermore, medical diagnosis is episodic if one conceives of the task as
selecting a diagnosis given a list of symptoms; the problem is sequential if the task can
include proposing a series of tests, evaluating progress over the course of treatment, and so
on. Also, many environments are episodic at higher levels than the agent’s individual actions.
For example, a chess tournament consists of a sequence of games; each game is an episode
because (by and large) the contribution of the moves in one game to the agent’s overall
performance is not affected by the moves in its previous game. On the other hand, decision
making within a single game is certainly sequential.
A general-purpose environment simulator that places one or more agents in a
simulated environment, observes their behavior over time, and evaluates them according to a
given performance measure. Such experiments are often carried out not for a single
environment but for many environments drawn from an environment class. For example, to
evaluate a taxi driver in simulated traffic, we would want to run many simulations with
different traffic, lighting, and weather conditions. If we designed the agent for a single
scenario, we might be able to take advantage of specific properties of the particular case but
might not identify a good design for driving in general.
The code repository also includes an environment generator for each environment class that
selects particular environments (with certain likelihoods) in which to run the agent. For
example, the vacuum environment generator initializes the dirt pattern and agent location
randomly. We are then interested in the agent’s average performance over the environment
class. A rational agent for a given environment class maximizes this average performance.
We describe the agent programs in the simple pseudo code language that is defined for
example, Figure 2.7 shows a rather trivial agent program that keeps track of the percept
sequence and then uses it to index into a table of actions to decide what to do. The table—an
example of which is given for the vacuum world in Figure 2.3—represents explicitly the
agent function that the agent program embodies. To build a rational agent in
number of percepts it will receive). The lookup table will contain T entries.
Consider the automated taxi: the visual input from a single camera comes in at the ate of
roughly 27 megabytes per second (30 frames per second, 640 × 480 pixels with 24 bits of
color information). This gives a lookup table with over 10250,000,000,000 entries for an
hour’s driving. Even the lookup table for chess—a tiny, well-behaved fragment of the real
world—would have at least 10150 entries. The daunting size of these tables (the number of
atoms in the observable universe is less than 1080) means that (a) no physical agent in this
universe will have the space to store the table, (b) the designer would not have time to create
the table, (c) no agent could ever learn all the right table entries from its experience, and (d)
even if the environment is simple enough to yield a feasible table size, the designer still has
no guidance about how to fill in the table entries.
at most all intelligent systems:
• Simple reflex agents;
• Model-based reflex agents;
• Goal-based agents; and
• Utility-based agents
Each kind of agent program combines particular components in particular ways to generate
actions. Section 2.4.6 explains in general terms how to convert all these agents into learning
The simplest kind of agent is the simple reflex agent. These agents select actions on the
basis of the current percept, ignoring the rest of the percept history. For example, the vacuum
agent whose agent function is tabulated in Figure 2.3 is a simple reflex agent, because its
decision is based only on the current location and on whether that location contains dirt. An
agent program for this agent is shown in Figure 2.8.
Simple reflex behaviors occur even in more complex environments. Imagine yourself as the
driver of the automated taxi. If the car in front brakes and its brake lights come on, then you
should notice this and initiate braking. In other words, some processing is done on the visual
input to establish the condition we call “The car in front is braking.” Then, this triggers some
established connection in the agent program to the action “initiate braking.” We call such a
connection a condition–action rule, 5 written as if car-in-front-is-braking then initiate-
braking.
Humans also have many such connections, some of which are learned responses (as for
driving) and some of which are innate reflexes (such as blinking when something approaches
the eye). In the course of the book, we show several different ways in which such connections
can be learned and implemented.
The program in Figure 2.8 is specific to one particular vacuum environment. A more general
and flexible approach is first to build a general-purpose interpreter for condition– action rules
and then to create rule sets for specific task environments. Figure 2.9 gives the structure of
this general program in schematic form, showing how the condition–action rules allow the
agent to make the connection from percept to action. (Do not worry if this seems trivial; it gets
more interesting shortly.) We use rectangles to denote the current internal state of the agent’s
decision process, and ovals to represent the background information used in the process. The
agent program, which is also very simple, is shown in Figure 2.10. The INTERPRET-INPUT
function generates an abstracted description of the current state from the percept, and 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 implementations can be as simple as a collection of logic gates implementing a
Boolean circuit.
Simple reflex agents have the admirable property of being simple, but they turn out to be of
limited intelligence. The agent in Figure 2.10 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 un-observability can cause serious trouble. For example, the
braking rule given earlier assumes that the condition car-in-front-is-braking can be
determined from the current percept—a single frame of video. This works if the car in front
has a centrally mounted brake light. Unfortunately, older models have different
configurations 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 reflex agent driving behind such
a car would either brake continuously and unnecessarily, or, worse, never brake at all.
2.4.3 Model-based reflex agents
The most effective way to handle partial observability is for the agent to keep track of the
part of the world it can’t 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
INTERNAL STATE aspects of the current state. For the braking problem, the internal state is
not too extensive— just the previous frame from 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 needs to keep track of where the other cars are if it
can’t see them all at once. And for any driving to be possible at all, the agent needs to keep
track of where its keys are. This knowledge about “how the world works”—whether
implemented in simple Boolean circuits or in complete scientific theories—is called a model
of the world. An agent that uses such a model is called a model-based agent.
MODEL-BASED AGENT Figure 2.11 gives the structure of the model-based reflex agent
with internal state, showing how the current percept is combined with the old internal state to
generate the updated description of the current state, based on the agent’s model of how the
world works. The agent program is shown in Figure 2.12. The interesting part is the function
UPDATE-STATE, which
is responsible for creating the new internal state description. The details of how models and
states are represented vary widely depending on the type of environment and the particular
technology used in the agent design.
example, the taxi may be driving back home, and it may have a rule telling it to fill up with
gas on the way home unless it has at least half a tank. Although “driving back home” may
seem to an aspect of the world state, the fact of the taxi’s destination is actually an aspect of
the agent’s internal state. If you find this puzzling, consider that the taxi could be in exactly
the same place at the same time, but intending to reach a different destination.
2.4.4 Goal-based agents
Knowing something 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 situations that are desirable—for example, , being at the passenger’s destination.
The agent program can combine this with the model (the same information as was used in the
model based reflex agent) to choose actions that achieve the goal. Figure 2.13 shows the
goal-based agent’s structure. Sometimes goal-based action selection is straightforward—for
example, when goal state Is faction results immediately from a single action. Sometimes it
will be more tricky—for example, when the agent has to consider long sequences of twists
and turns in order to find a way to achieve the goal.
Although the goal-based agent appears less efficient, it is more flexible because the
knowledge that supports its decisions is represented explicitly and can be modified. 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 behaviours to be altered to suit the new conditions. For
the reflex agent, on the other hand, we would have to rewrite many condition–action rules.
2.4.5 Utility-based agents
Goals alone are not enough to generate high-quality behavior in most environments. For example,
many action sequences will get the taxi to its destination (thereby achieving the goal) but some are
quicker, safer, more reliable, or cheaper than others. Goals just provide a crude binary distinction
between “happy” and “unhappy” states. A more general performance measure should allow a
comparison of different world states according to exactly how happy they would make the agent.
Because “happy” does not sound very scientific, economists and computer scientists use the term
utility An agent’s utility function is essentially an internalization of the performance measure. If the
internal utility function and the external performance measure are in agreement, then an agent that
chooses actions to maximize its utility will be rational according to the external performance measure.
Let us emphasize again that this is not the only way to be rational—we have already seen a
rational agent program for the vacuum world (Figure 2.8) that has no idea what its utility
function is—but, like goal-based agents, a utility-based agent has many advantages in terms
of flexibility and learning. Furthermore, in two kinds of cases, goals are inadequate but a
utility-based agent can still make rational decisions. First, when there are conflicting goals,
only some of which can be achieved (for example, speed and safety), the utility function
specifies the appropriate tradeoff. Second, when there are several goals that the agent can aim
for, none of which can be achieved with certainty, utility provides a way in which the
likelihood of success can be weighed against the importance of the goals.
Partial observability and stochasticity are ubiquitous in the real world, and so, therefore, is
decision making under uncertainty. Technically speaking, a rational utility-based agent
chooses the action that maximizes the expected utility of the action outcomes—that is, the
EXPECTED UTILITY utility the agent expects to derive, on average, given the probabilities
and utilities of each.
An agent that possesses an explicit utility function can make rational decisions with a
general-purpose algorithm that does not depend on the specific utility function being
maximized. In this way, the “global” definition of rationality—designating as rational those
agent functions that have the highest performance—is turned into a “local” constraint on
rational-agent designs that can be expressed in a simple program. The utility-based agent
structure appears in Figure 2.14. Utility-based agent programs appear in Part IV, where we
design decision-making agents that must handle the uncertainty inherent in stochastic or
partially observable environments.
2.4.6 Learning agents
We have described agent programs with various methods for selecting actions. We have not,
so far, explained how the agent programs come into being. In his famous early paper, 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-the-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 allow. In this section, we briefly introduce the main ideas of learning agents.
Throughout the book, we comment on opportunities and methods for learning in particular
kinds of agents. Part V goes into much more depth on the learning algorithms themselves. A
learning agent can be divided into four conceptual components, as shown in Figure 2.15. The
most important distinction is between the learning element, which is responsible for making
improvements, and the performance element, which is responsible for selecting external
actions. The performance element is what we have previously considered to be the entire
agent: it takes in precepts and decides on actions. The learning element uses feedback from
the critic on how the agent is doing and determines how the performance element should be
modified to do better in the future.
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 precepts themselves provide no
indication of the agent’s success. For example, a chess program could receive a percept
indicating that it has checkmated its opponent, but it needs a performance standard to know
that this is a good thing.
The last component of the learning agent is the 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 suboptimal 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 is 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.
To make the overall design more concrete, let us return to the automated taxi example. The
performance element consists of whatever collection of knowledge and procedures the taxi
has for selecting its driving actions. The taxi goes out on the road and drives, using this
performance element. The critic observes the world and passes information along to the
learning element. For example, after the taxi makes a quick left turn across three lanes of
traffic, the critic observes the shocking language used by other drivers. From this experience,
the learning element is able to formulate a rule saying this was a bad action, and the
performance element is modified by installation of the new rule. The problem generator
might identify certain areas of behaviour in need of improvement and suggest experiments,
such as trying out the brakes on different road surfaces under different conditions.
2.4.7 How the components of agent programs work
We have described agent programs (in very high-level terms) as consisting of various
components, whose function it is to answer questions such as: “What is the world like now?”
“What action should I do now?” “What do my actions do?” The next question for a student of
AI is, “How on earth do these components work?” It takes about a thousand pages to begin to
answer that question properly, but here we want to draw the reader’s attention to some basic
distinctions among the various ways that the components can represent the environment that
the agent inhabits. Roughly speaking, we can place the representations along an axis of
increasing complexity and expressive power—atomic, factored, and structured. To
illustrate these ideas, it helps to consider a particular agent component, such as the one that
deals with “What my actions do.” This component describes the changes that might occur in
the environment as the result of taking an action, and Figure 2.16 provides schematic
depictions of how those transitions might be represented.
uncertainty—for example, ignorance about the amount of gas in the tank can be represented
by leaving that attribute blank.
For many purposes, we need to understand the world as having things in it that are
related to each other, not just variables with values. For example, we might notice that a large
truck ahead of us is reversing into the driveway of a dairy farm but a cow has got loose and is
blocking the truck’s path. A factored representation is unlikely to be pre-equipped with the
attribute Truck Ahead Backing Into Dairy Farm Drive way Blocked By Loose Cow with
value true or false. Instead, we would need a structured representation, in which objects
such as cows and trucks and their various and varying relationships can be described
explicitly. (See Figure 2.16(c).)
As we mentioned earlier, the axis along which atomic, factored, and structured
representations lie is the axis of increasing expressiveness. Roughly speaking, a more
expressive representation can capture, at least as concisely, everything a less expressive one
can capture, plus some more. Often, the more expressive language is much more concise; for
example, the rules of chess can be written in a page or two of a structured-representation
language such as first-order logic but requires thousands of pages when written in a factored-
representation language such as propositional logic. On the other hand, reasoning and
learning become more complex as the expressive power of the representation increases. To
gain the benefits of expressive representations while avoiding their drawbacks, intelligent
systems for the real world may need to operate at all points along the axis simultaneously.
Summary:
This chapter has been something of a whirlwind tour of AI, which we have conceived of as
the science of agent design. The major points to recall are as follows:
• An agent is something that perceives and acts in an environment. The agent function
for an agent specifies the action taken by the agent in response to any percept sequence.
• The performance measure evaluates the behaviour of the agent in an environment. A
rational agent acts so as to maximize the expected value of the performance measure,
given the percept sequence it has seen so far.
• A task environment specification includes the performance measure, the external
environment, the actuators, and the sensors. In designing an agent, the first step must always
be to specify the task environment as fully as possible.
• Task environments vary along several significant dimensions. They can be fully or partially
observable, single-agent or multi agent, deterministic or stochastic, episodic or sequential,
static or dynamic, discrete or continuous, and known or unknown.
• The agent program implements the agent function. There exists a variety of basic agent-
program designs reflecting the kind of information made explicit and used in the decision
process. The designs vary in efficiency, compactness, and flexibility. The appropriate design
of the agent program depends on the nature of the environment.
• Simple reflex agents respond directly to precepts, whereas model-based reflex agents
maintain internal state to track aspects of the world that are not evident in the current percept.
Goal-based agents act to achieve their goals, and utility-based agents try to maximize their
own expected “happiness.”
• All agents can improve their performance through learning.
1. Automation: AI can automate repetitive tasks, increasing efficiency and reducing human
error.
2. Decision Making: AI systems can analyze vast amounts of data to aid in decision-making
processes, often leading to more informed and accurate decisions.
3. Personalization: AI algorithms can tailor experiences and recommendations to individual
preferences, enhancing user satisfaction.
4. Predictive Analytics: AI can forecast trends and behaviors, enabling organizations to
anticipate future needs and plan accordingly.
5. Improved Healthcare: AI applications in healthcare can lead to early disease detection,
personalized treatment plans, and better patient outcomes.
6. Enhanced Safety: AI-powered systems can improve safety in various settings, such as
autonomous vehicles reducing road accidents or AI-based surveillance systems identifying
potential threats.
7. Efficient Resource Utilization: AI can optimize resource allocation in sectors like energy,
agriculture, and manufacturing, leading to cost savings and reduced waste.
8. Innovation: AI fosters innovation by enabling the development of new products, services,
and solutions that were previously impossible or impractical.
1. Job Displacement: Automation driven by AI technologies may lead to job losses in certain
sectors, requiring retraining and adaptation for the workforce.
2. Bias and Fairness: AI systems can inherit biases present in training data, leading to unfair
or discriminatory outcomes, particularly in areas like hiring or lending.
3. Privacy Concerns: AI applications often require access to vast amounts of personal data,
raising concerns about privacy and data security.
4. Ethical Dilemmas: AI raises complex ethical questions, such as the use of autonomous
weapons, algorithmic decision-making in critical areas, and the impact on human autonomy.
5. Lack of Transparency: Some AI algorithms operate as "black boxes," making it difficult to
understand how they reach their conclusions, which can undermine trust and accountability.
6. Dependency on Data: AI systems heavily rely on data for training and operation, and the
quality of outcomes depends on the quality and relevance of this data.
7. Regulatory Challenges: The rapid advancement of AI technology often outpaces regulatory
frameworks, leading to uncertainties regarding legal and ethical responsibilities.
8. Security Risks: AI systems can be vulnerable to attacks and manipulation, posing risks
such as data breaches, algorithmic manipulation, and adversarial attacks.
Probable Questions
Q1.Explainthefourcategoriesofdefinitionofartificialintelligence.(Ans.Hint:defineThinking
Humanly,ThinkingRationally,ActingHumanly,ActingRationally).
Q.4. Explain the following terms: Agent, Agent Functions , Agent Program, Rationality,
Autonomy, Performance Measure.
1. Read Turing’s original paper on AI (Turing, 1950). In the paper, he discusses several
objections to his proposed enterprise and his test for intelligence. Which objections still carry
weight? Are his refutations valid? Can you think of new objections arising from developments
since he wrote the paper? In the paper, he predicts that, by the year 2000, a computer will have
a 30% chance of passing a five-minute Turing Test with an unskilled interrogator. What chance
do you think a computer would have today? In another 50 years?
Future Speculation:
Predicting the chance of passing the Turing Test in the future is speculative. With ongoing
advancements in AI, including natural language processing, machine learning, and cognitive
modelling, it's conceivable that AI systems may achieve higher levels of conversational
sophistication. However, achieving genuine understanding and human-like intelligence
remains a formidable challenge.
In another 50 years, the chance of passing the Turing Test could increase significantly,
especially with potential breakthroughs in AI research, computational power, and
understanding of cognition. Nevertheless, it's uncertain whether passing the Turing Test alone
would signify true human-like intelligence or merely sophisticated mimicry
b. Driving in the center of Cairo, Egypt: Autonomous driving technology has made
considerable progress, but driving in highly complex and unpredictable urban environments
like Cairo still presents challenges due to factors such as dense traffic, erratic driving
behavior, and lack of standardized road infrastructure. Current autonomous vehicles are
generally better suited for controlled environments like highways or well-mapped urban
areas.
d. Buying a week’s worth of groceries at the market: AI-powered systems can assist with
shopping tasks, including generating shopping lists, recommending products, and even
automating grocery delivery. However, the actual act of physically selecting groceries from a
market shelf may still require human intervention due to the variability and complexity of
products.
e. Buying a week’s worth of groceries on the Web: Online shopping platforms already
utilize AI algorithms for product recommendations, personalized offers, and efficient order
processing. AI can assist users in selecting groceries online, suggesting items based on
preferences, dietary restrictions, and past purchases.
g. Discovering and proving new mathematical theorems: AI has been used to assist
mathematicians in exploring mathematical conjectures and generating hypotheses. However,
the process of discovering and proving new theorems often requires deep mathematical
insight and creativity, areas where current AI systems may struggle.
h. Writing an intentionally funny story: AI has demonstrated the ability to generate text,
including narratives and jokes, but intentionally crafting a genuinely funny story involves
understanding humor, context, and cultural nuances, which remains a significant challenge
for AI.
i. Giving competent legal advice in a specialized area of law: AI-powered legal research
tools can assist lawyers in retrieving relevant case law, statutes, and legal documents.
However, providing competent legal advice involves analyzing complex legal issues,
applying legal principles to specific contexts, and considering ethical considerations, areas
where human expertise and judgment are still indispensable.
j. Translating spoken English into spoken Swedish in real time: AI-powered speech
recognition and machine translation systems can translate spoken languages in real time,
albeit with varying degrees of accuracy and fluency. Achieving high-quality real-time
translation requires advanced algorithms, training data, and computational resources.
4. Suppose that the performance measure is concerned with just the first T time steps of
the environment and ignores everything thereafter. Show that a rational agent’s action
may depend not just on the state of the environment but also on the time step it has
reached.
Ssolution:
Suppose we have a robot tasked with collecting objects in a grid environment within a time
limit of T steps. Each object collected yields a reward, and the robot's objective is to
maximize the total reward collected within the first T steps.
Now, imagine the robot encounters two scenarios:
1. In the early time steps (e.g., T/2), the robot finds itself in a region of the grid where
valuable objects are plentiful and easily accessible. In this scenario, the rational action for the
robot would be to prioritize collecting as many objects as possible in the current time steps,
maximizing its reward given the abundance of valuable objects.
2. Later in the time steps (e.g., 3T/4), the robot finds itself in a region of the grid where
valuable objects are scarce and scattered. In this scenario, the rational action for the robot
might be to conserve its remaining time and prioritize reaching a different area of the grid
where more valuable objects are likely to be found, even if it means sacrificing immediate
rewards.
In both scenarios, the rational action taken by the robot depends not only on the current state
of the environment (availability and distribution of objects) but also on the time step it has
reached (remaining time horizon). This is because the agent's objective is to maximize its
cumulative reward within the given time limit of T steps.
Therefore, in environments where the performance measure is constrained to the first T time
steps, rational agents may need to consider both the current state of the environment and the
time step they have reached to make optimal decisions and maximize their performance
within the limited time horizon.
5. For each of the following activities, give a PEAS description of the task environment
and characterize it in terms of the properties listed
• Playing soccer.
• Exploring the subsurface oceans of Titan.
• Shopping for used AI books on the Internet.
• Playing a tennis match.
• Practicing tennis against a wall.
• Performing a high jump.
• Knitting a sweater.
• Bidding on an item at an auction.
Solution:
PEAS description and characterize the task environment for each activity:
1. Playing soccer:
Performance Measure: Score goals while preventing the opponent from scoring.
Environment: Soccer field with boundaries, goalposts, teammates, opponents, and a soccer
ball.
Actuators: Running, kicking, passing, dribbling, and goalkeeping actions.
Sensors: Vision to perceive the positions of players and the ball, auditory cues for
communication with teammates and opponents.
Properties:
Multi-agent: Interaction with teammates and opponents influences the game.
Dynamic: Players move rapidly, and the ball changes position frequently.
Continuous: Actions like running and kicking are continuous variables.
Partially Observable: Players cannot directly observe the entire field simultaneously.
Uncertain: Factors like the opponent's strategy, ball trajectory, and weather conditions
introduce uncertainty.
Dynamic: Players move rapidly, and the ball changes direction frequently.
Continuous: Actions like running and hitting are continuous variables.
Partially Observable: Players cannot directly observe the entire court simultaneously.
Uncertain: Factors like the opponent's strategy, ball trajectory, and weather conditions
introduce uncertainty.
7. Knitting a sweater:
Performance Measure: Complete the sweater with desired size, style, and quality.
Environment: Knitting area with knitting needles, yarn, pattern instructions, and possibly a
knitting machine.