0% found this document useful (0 votes)
1K views51 pages

OCS351 AIML Unit 1

Uploaded by

Navin Kumar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
1K views51 pages

OCS351 AIML Unit 1

Uploaded by

Navin Kumar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 51

UNIT I

INTELLIGENT AGENT AND


UNINFORMED SEARCH
Introduction - Foundations of AI - History of AI -The state of the art -Risks and
Benefits of Al - Intelligent Agents - Nature of Environment - Structure of Agent -
Problem solving agents - Formulating problems - Uninformed search - Breadth first
search - Dijkstra's algorithm or uniform - cost search Depth first search - Depth
limited search.

1.1. INTRODUCTION TO AI

Artificial intelligence, or Al, is the subfield of computer science that studies how
to give machines human-like intelligence. Artificial intelligence is defined as "the
study and design of intelligent agents," where an intelligent agent is a system that
perceives its environment and takes actions that maximize its chances of success.
Invented by John McCarthy in 1956, the term refers to "the science and engineering
of making intelligent machines, especially intelligent computer programs." Some
textbooks' AI definitions can be broken down into four distinct camps, which are
briefly described in the table below.

Systems that think like humans


"The exciting new effort to make computers think ... machines with minds, in the
full and literal sense." (Haugeland,1985).
Systems that think rationally
"The study of mental faculties through the use of computer models." (Charniak
and Mc Dermont, 1985).

Systems that act like humans


"The art of creating machines that perform functions that require intelligence
when performed by people."(Kurzweil, 1990).
Artificial Intelligence and Machine Learning Fundamentals
12
Systems that act rationally
Computational intelligence is the stucy of the desiguof intelligent agents."(Poole
et al.,1998).

12, GOALSOF ARTIFICIAL INTELLIGENCE

Following are the main goals of Artificial Intelligence:


1. Replicate human intelligence
2. Solve Knowledge-intensive tasks
3. An intelligent connection of perception and action
4. Building a machine which can perform tasks that requires human
intelligence such as:
Proving a theorem
Playing chess
Plan some surgical operation
Driving a car in traffic
5. Creatingsome system which can exhibit intelligent behavior, learn new
things by itself, demonstrate, explain, and can advise to its user.

13. ADVANTAGES OF ARTIFICIAL INTELLIGENCE

Following are some main advantages of Artificial Intelligence:

High Accuracy with Less Errors:

Al machines or systems are prone to less erors and high accuracy as it takes
decisions as per pre-experience or information.
High-Speed:
Since Al systems are capable of rapid decision making, they are capable of
defeatinga human chess champion.
High Reliability:
Al machines are highly reliable and can perform
the same action multiple times
with high accuracy.
Intelligent Agent and Uninformed Search |13

Useful for risky areas:


When using a human is too risky, artificial intelligence machines can help with
tasks like bomb disposal and occan floor exploration.

Digital Assistant:
Artificial intelligence has the potential to be a useful digital assistant, helping sites
likeAmazon and eBay better cater their offerings to individual customers.
Useful as a public utility:
Public utilities can benefit greatly from Al applications like self-driving cars that
make travel safer and more convenient, facial recognition systems for added safety,
natural language processing that allows machines to communicate with humans in
their own language, ete.

1.4. FOUNDATIONS OF AI

The foundation of AI(Artificial Intelligence) is based on the idea of developing


machines that can perform tasks that typically require human intelligence, such
reasoning, perception, learníng, decision-making, and natural language processing.
The field of AI is interdisciplinary, drawing on computer science, mathematics,
engineering, psychology, linguistics, and philosophy.

Philosophy
bsna Aristotle (384-322 B.C.)was the first to formulate a precise set of laws
8 governing the rational part of the mind. He developed an informal system
one to
of syllogisms for proper reasoning, which in principle allowed
sstle,tgenerate conclusions mechanically, given initial premises.
Much later, Ramon Lull (d. 13 15) had the idea that useful reasoning could
actually be carried out by
a mechanical
artifact-“concept wheels
Thomas Hobbes (1588-1679) proposed that reasoning was like numerical
computation that "we add and subtract in our silent thoughts." The
way.
automation of computation itself was already well under
a
Around 1500, Leonardo da Vinci (1452-1519)designed but did not build
mechanical calculator; recent reconstructions have shown the design to be
functional.
|14| Artificial Intelligene and Machine Lerning l'mdamentals

The first known caleulating machine was constructed around l623 by the
German scientist Wilhelm Schickard (1 592-1635).

The Pascaline, built in 1642 by Blaise Pascal (1623-1662). is more


famous. Pascal wote that the arithnnetical machine produces ellcets
which appear nearer to thought than all the actions of animals."
Gottfried Willhelm Leibniz (1646-1716)built a mechanical device intended
to carry out operations on conceptsrather than numtbers, but itsscope was
rather limited. Now that we have the idea of a set of rules that can describe
the formal, rational part of the mind. the next step is to consider the mind
as a physical system.
Rene Descartes (1596-1650) gave the first clear discussion of the
distinction between mind and matter and of the problems that arise

Mathematics
Philosophers staked out most of the important ideas of Al, but the leap to a
formal science required a level of mathematical formalization in three
fundamental areas: logie, computation, and probability.
The idea of formal logic can be traced back to the philosophers of ancient
Greece, but its mathematical development really began
with the work of
George Boole (1815-1864), who worked out the details propositional or
of
Boolean logic.
In 1879, Gottlob Frege (1848-1925) extended Boole's logic to
include
objects and relations, creating the first-order logic that is
used today as the
most basic knowledge representation system.
Alfred Tarski (1902-1983) introduced a theory
of reference that shows
how to relate the objects in a logic to objects
in the real world
Economics (1776-present)
The science of economics got its start
in 1776, when Scottish philosopher
Adam Smith (1723 - 1790)
published An Inquiry into
Causes of the Wealth of Nations, the Nature and
While the ancient Greeks and
made contributions to economic others had
thought, Smith was the first to treat as a
science, using the idea that it
economies can be thought
individual agents maximizing of as consisting of
their own economic well-being.
Intelligent Agent and Uninformed Search 1.5

Neuroscience (1861-present)
Neuroscience is the study of the nervous system, particularly the brain.
The exact way in which the brain enables thought is one of the great
mysteries of science. It has been appreciated for thousands of years that
the brain is somehow involved in thought, because of the evidence that
strong blows to the head can lead to mental incapacitation.
Brain is recognized as the seat of consciousness. Before then, candidate
locations included the heart,the spleen, and the pineal gland.
Paul Broca's (1824-1880) study of aphasia (speech deficit) in brain
damaged patients in 1861 reinvigorated the field and persuaded the
medical establishment of the existence of localized areas of the brain
responsible for specific cognitive functions.
Despite these advances, we are still a long way from understanding how
any of these cognitive processes actually work.
The truly amazing conclusion is that a collection of simple cells can lead
to thought, action, and consciousness or, in other words, that brains cause
t minds (Searle, 1992)

Psychology (1879-present)
The origins of scientific psychology are iually traced to the work of the
German physicist Hermann von Helmholtz (1821-1894) and his student
Wilhelm Wundt (1832-1920).
Helmholtz applied the scientific method to the study of human visiön, and
his Handbook of Physiological Optics is even now described as the single
most important treatise on the physics and physiology of human vision"
(Nalwa, 1993, p.15).
In 1879, Wundt opened the first laboratory of experimental psychology at
the University of Leipzig. Wundt insisted on carefully controlled
experiments in which his workers would perform a perceptual or
associative task while introspecting on their thought processes
Linguistics (1957-present)
In 1957, B. F.Skinner published Verbal Behávior. This was
comprehensive, detailed account of the behaviourist approach to language
learning, written by the foremost expert in the field.
|1.6| Artificial Intelligence and Machine Learning lFundamentals

as the book itsclf, and served


A
review of the book became as well known
review was
toalmost kill off interest in behaviourisms. The author of theown
a book on his theory.
Noam Chomsky, who had just published
Syntactic Structures.
Chomsky showed how the behaviourist theory did not address the notion
a
of creativity in language. It did not explain how child could understand
and make up sentences that he or she had never heard before.
Chomsky's theory, based on syntactic models going back to the Indian
linguist Panini (b.c.350), could explain this, and unlike previous theories,
it was formal enough that it could in principle be programmed.

1.5. HISTORY OFARTIFICIAL INTELLIGENCE

The gestation of artificial intelligence (1943-1955)


Warren McCulloch and Walter Pitts pioneered
They used knowledge of brain physiology and function,
Russell and
Whitehead's formal analysis of propositional logic,
and Turing's theory of
computation.
They proposed a modelof artificial neurons
"on" or "off," switching to "on"
inwhich each neuron is either
when enough neighboring neurons are
stimulated.
They showed that any computable
function could be computed
network of connected neurons by a
and that all logical connectives
etc.)could be implemented by simple (and, or, not,
net structures.
McCulloch and Pitts believed
well-defined networks could
learn.
Donald Hebb showed a simple
updating rule for neuronal
1949, known as Hebbian connections in
learning, which still influences
today.
3 In 1950, Harvard undergraduates
Marvin Minsky and Dean
the first neural network computer, Edmonds built
neuron network the SNARC, whioh simulated a 40
using 3000 vacuum tubes
automatic pilot mechanism. and a surplus B-24 bomber
Intelligent Agent and Uninformed Search 1.7
Minsky studied neural network universal computation at Princeton and
was told by Von Neumann, "If it isn't now, it will be someday."
Minsky later proved influential theorems showing neural network
research's limitations.

The birth of artificial intelligence (1956)


Al pioneer John Mc Carthy lived at Princeton.
Mc Carthy moved to Stanford and then Dartmouth College, the field's
birthplace, after receiving his PhD there in 1951 and teaching for two
years.
Mc Carthy persuaded Minsky, Shannon, and Rochester to help him gather
U.S. automata theory, neural net, and intelligence researchers.

Early enthusiasm,great expectations (1952-1969)


-Al's -early successes were limited due to primitive computers and
programming tools, and skepticism from the intellectual establishment
AI researchers responded by demonstrating capabilities that were thought
to be impossible for machines
John McCarthy coined the term "Look, Ma, no hands!" era to describe this
period
GPS was created to mimic human problem-solving and considered
subgoals and possible actions in a similar order to humans, making it
likely the first "thinking humanly" program
The success of GPS and other programs led to the physical symbol system
hypothesis, which states that any intelligent system must nmanipulate data
structures made of symbols
John McCarthy made three important contributions to AI at MIT,
including defining Lisp, inventing time sharing, and creating the Advice
Taker
The Advice Taker embodied the central principles of knowledge
representation and reasoning, using a formal, explicit representation of the
world and its workings to manipulate that representation with deductive
processes.
Artiflcial telligence and Muchine Learning Fundamentals

dose of reality (1966-1973)


A

successes that didn't pan out. Simon's


Early Al rescarchers predicted carly
a mathematical
predictions of a computer wimning at chess and proving
theorem in 10 years were accurate, but took 40
ycars to happen.

$ Early Al systems performed wcll on simple cxamples but failed miserably


on more complex problems, lcading to overconfidence.
werc
unsuccessful due to the lack of
Early machine translation cfforts
background knowledge to resolve ambiguity and establish sentence
content.

$ Many Al problems were intractable due to the limited capacity of early


hardware and the inability to scale up to larger problems.
The inability to prove resolution theorems with more than a few dozen
facts dampened researchers' optimism.
Imperfect machine translation is still used today for technical, commercial,
government, and internet documents.
Knowledge-based systems: The key to power? (1969-1979)

$ In the first decade of AI research, a general-purpose search mechanism


was used to solve problems
through combining elementary reasoning
steps.
3 Weak methods are general but do not scale to
large or difficult problem
instances.
i Stronger, domain-specific knowledge
allows larger reasoning steps and
kcan handle common cases in narrow
fields of expertise.
To solve a difficult problem, you: must
almost know the answer.
DENDRAL was an carly example
of this approach.
Ed Feigenbaum, Bruce
Buchanan, and Joshua
DENDRAL at Stanford Lederberg developed
to infer molecular
spectrometer data. strúcture from mass
The program receives
the elementary formula
mass spectrum of the molecule and the
of its fragments gencrated by electron
beam bombardment.
Intelligent Agent and Uninformed Search
1.9
The naive program generated all formula-consistent structures and
predicted their mass spectra, comparing them to the actual spectrum.
Even moderate-sized molecules cannot be solved by this method.
Al becomes an industry (1980-present)
In 1982, Digital Equipment Corporation launched R1, the first successful
commercial expert system.
Configuring new computer system orders saved RI $40 million by 1986.
By l1988, DEC AIdeployed 40 expert systems.100 expert systems and 500
development saved DuPont $10 million per year.
Most major U.S. corporations had an Al group and used or investigated
expert systems.
In 1981, Japan announced the 10-year Prolog-based "Fifth Generation"
intelligent computer project.
Tomaintain national competitiveness, the US created the Microelectronics
and Computer Technology Corporation (MCC) research consortium.
Both involved AI, chip design, and human-interface research.
Britain's Alvey report reinstated Lighthill report funding.
The AI industry grew from a few million dollars in 1980 to billions in
1988, with hundreds of companies building expert systems, vision
systems, robots, and specialized software and hardware.

The return of neural networks (1986-present)


In the mid-1980s, four groups reinvented Bryson and Ho's 1969 back
was then applied to many
propagation learning algorithm. This algorithm
saw
computer science and psychology learning problems. Some
connectionist models of intelligent systems as competitors to symbolic
models and logicist approaches.
symbol
The most ardent connectionists questioned the explanatory role of
manipulation in cognition.
suggests that humans'
Terrence Deacon's book The Symbolic Species
answer to this debate
defining characteristic is symbol manipulation, The
are
is. unknown, but connectionist and symbolic approaches
complementary.
1.10| Artificial lntelligence and Machine Learning Fundamenlas

Moden neural network research has split into two ficlds: onc focused on

effective network architectures and algorithms and their mathematical


properties, and the other on careful modeling of actual neurons and
ensembles of neurons.
Al adopts the scientificmethod (1987-present)
Artificial intelligence (A) research has shifted towards building n
existing theories, using rigorous theorems and experimental evidence, and
demonstrating relevance to real-world applications.
Alis now scientifically based, with hypotheses tested through empirical
experiments and statistically analyzed for significance.
Shared test data and code allow for replication of experiments.
* HMM-based methods have dominated the field of speech recognition due
to their rigorous mathematical theory and large corpus of real speech data.

* Speech technology and handwritten character recognition are becoming


mainstream in industry and consumer use.
$ Machine translation has returned to dominance in the late 1990s, following
an approach based on word sequences and information theory models.
Neural networks are also used.
Neural nets can be compared with techniques from statistics, pattern
recognition, and machine learning, and the most promising technique can
be applied to each application.
These advancements have created a robust new industry in data mining.
The emergence of intelligent agents (1995-present)
Researchers are reexamining the "whole agent" problem,
encouraged by
progress in AI subproblems.
The best-known complete agent architecture is SOAR
by Newell, Laird,
and Rosenbloom,
The Internet is crucial for intelligent agents,
and web-based applications
often use AI systems.
Sensory systems cannot provide perfect environmental information, and
reasoning and planning systems must handle uncertainty.
Intelligent Agent and Uninformed Search |1.11

3 Al founders John McCarthy, Marvin Minsky, Nils Nilsson, and Patrick


Winston express dissatisfaction with Al progress and advocate for human
level Al (HLAI).
o AGI seeks a universal algorithm for learning and acting.
Friendly Al is an important consideration for creating Al.
The availability of very large data sets (2001-present)
Recent Al research suggests that data should be prioritized over algorithms
for many problems.
Increasing availability of very large data sources like trillions of words of
English, billions of images from the web, or billions of base pairs of
genomic sequences makes this possible.
Yarowsky's work on word-sense disambiguation shows that labeling
examples in a large corpus of unannotated text using dictionary definitions
can achieve high accuracy.
Banko and Brill demonstrate that a mediocre algorithm with 100 mllion
words of unlabelled training data outperforms the best-known algorithm
with 1 million words.
Hays and Efos created an algorithm to match photos, which perfomed
poorly with ten thousand photos but improved when they used two million.

1.6. THE STATE OF THE ART


so many
How capable is current AI? Because there are so many activities in
subfields, providing a succinct answer is challenging. Here are just a few examples
of potential uses:
Autonomous planning and scheduling
A hundred million miles from Earth, NASA's Remote Agent Program became the
first onboard autonomous planning program. It controls the scheduling of operations
for a spacecraft Remote Agent generated plans from high-level goals specified from
were
the ground, and it monitored the operation of the spacecraft as the plans
executed-detecting, diagnosing, and recovering from problems as they occurred.
Amieal melligence and
Muclhine learing Fundamentals
112
Game Playlng world
became the first computer program to defeat the
IBM's Deep Blue a score of 3.5 to 2.5 in
it bested Garry Kasparov by
champion in a chess matelh when intelligence" across
he felt a "new kind of
an cxhibition match. Kasparov said that
described the match as "The brain's last
magazine
the board from him, News weck
stand." Tlhe valuc oflBM's stock
incrensed by $18 billion.

Autonomous Control
computer vision system was trained to steer a car to keep it
The ALVINN
to ALVINN, which then
following a lanc. Video cameras that transnit rond images
runs.
computes the best direction to stcer, based on experience from previous training

Diagnosis
to
Medical diagnosis programs based on probabilistic analysis have been able
perform at the level of an expert physician in several areas of medicine. Heckerman
(1991)describes a case where a leading expert on lymph-node pathology scoffs at a
program's diagnosis of an cspecially difficult case.
The creators of the program suggest he'ask the conmputer for an explanation of the
diagnosis. The machine points out the major factors influencing its decision and
explains the subtle interaction of several of the symptoms in this case. Eventually,
the expert agrees with the program.

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
routes, and conflict resolution among points, destinations,
all parameters.
The Al planning techniques allowed a
plan to be generated in hours
have taken weeks with older methods. that vould
The Defence Advanced Research
Agency (DARPA) stated that this Project
single application more than
paid back DARPA'S
30-year investment in AI.
Intelligent Agent and Uninformed Search 1.13

Robotics
Many surgeons now use robot assistants in microsurgery. Computer vision
techniques are used to create a three-dimensional model of a patient's internal
anatomy and then uses robotic control to guide the insertion of a hip replacement
prosthesis.

Languag understanding and problem solving


PROVERB is a computer program that solves crossword puzzles better than most
humans, using constraints on possible word fillers, a large database of past puzzles,
and a variety of information sources including dictionaries and online databases such
as a list of movies and the actors that appear in them.

1.7. RISKS AND BENEFITS OF AI

Risks and benefits of AI can be summarized as follows:y 3

Benefits:
Àl can automate repetitive tasks and free up human resources for more
creative and complex work.
a more
Al cn process and analyze large amounts of data at faster and
accurate rate than humans, leading to better decision-making.
AI can help identify patterns and insights in complex data sets that would
be difficult for humans to detect.
AI can assist in ffelds like healthcare, education, and transportation by
providing personalized services, improving efficiency, and reducing costs.

Risks:
AIcan lead to jobdisplacement as automation beconmes more prevalent.
AI can be biased if trained on biased data, leading to discrimination and
unfair outcomes.
Al can pose a threat to privacy if it is used to collect and analyze personal
data without consent or appropriate security measures.
AI can be used maliciously by bad actors to spread disinformation or
conduct cyber-attacks.
Artificial lntelligence and Machine Learning Fundamental,
1.14|
like transparency,
AI can also raise ethical concerns around issues

accountability, and responsibility.

Risks of AI Benefits of AI
Increased efficiency and productivity
Job displacement
Improved healthcare and disease
Bias in decision-making diagnosis

Advancements in scientific research and


Security threats and cyberattacks
discovery
Enhanced personalization and
Lack of transparency and
customization in consumer products and
accountability
services

Dependence on AI and loss of Improved safety in industries such as


human skills transportation and manufacturing
Potential for misuse and Increased accessibility and affordability
weaponization of education and training
Loss of privacy and surveillance Development of new technologies and
Concens innovations
Potential for unintended Increased accessibility and inclusivity for
consequences and unforeseen people with disabilities and marginalized
outcomes communities

1.8. INTELLIGENT AGENTS

An agent is anything that can be viewed as perceiving its environment throu


sensors and acting upon
that environment through actuators.
Thissimple idea is illustrated in
Figure 1.1.
A
human agent hands
has eyes, ears, and other organs for sensors and
legs, mouth, and other body parts
for actuators.
A
robotic agent might have cameras sensoß
and infrared range finders for
and various motors for actuators.
Intelligent Agent and Uninformed Search 1.15|

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.
Agent Sensors
Percepts
Environment

Actions
Actuators

Fig. 1.1. Agents interact with environments through sensors and actuators 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 Figure 1.2. This particular world has just two locations: squares A
and B. THa 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
S
shown inFigure 1.3.
Learning Fundamentole
Artificial Intelligence and Machine
1.16

B
A

Fig. 1.2. vacuun-cleaner world witlh just two locations


A

Percept Sequence Action

[A, Clean] Right

[A, Dirty] Suck

[B, Clean] Left

[B, Dirty] Suck


[A,Clean], [A, Clean] Right
[A, Clean, [A, Dirty] Suck

[A, Clean],[A, Clean],[A, Clean] Right


[A, Clean],[A, Clean], [A, Dirty] Suck

Fig. 1.3. Partial tabulation of a simple agent function


for the vacuum-cleaner world
slhown in Figure 1.2,
Rational Agent
A rational agent is one that does the right thing-conceptually
speaking, every enu)
in the table for the agent function is filled out correctly.
Obviously, doing the rig
thing is better than doing the wrong thing. The right
action is the one that will caus
the agent to be most successful.
Intelligent Agent and Uninformed Search |1.17|

Performance Measures
A performance measure embodies the criterion for
success of an agent's behavior.
a sequence of actions
When an agent is plunked down in an environment, it generates
according to the percepts it receives. This
sequence of actions causes the
environment to go through a sequence of states. If the
sequence is desirable, then the
agent has performed well.

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.
This leads to a definition ofa 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.

Omniscience, Learning, and Autonomy


An omniscient agent knows the actual outcome of its actions and can act
accordingly; but omniscience is impossible in reality.
Doing actions in order to modify future percepts-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.
X Our definition requires a rationalagent not only to gather information, but
also to learn as much as possible from what it perceives.
Theagent's initial configuration could reflect some prior knowledge of the
environment, but as the agent gains experience this may be modified and
augmented.
Learning Fndamentals
Artificial Intelligence and Machine
1.18|
environment is completely known a
cases in which the
There are extreme
cases, agent need not perceive or learn; it simply acts
priori. In such the
are fragile
correctly. Of course, such agents
on the prior knowledge of its designer
To the extent that an agent relies
we say that the agent lacks autonomy.
rather than on its own percepts,
A rational agent should be autonomous-it
should learn what it can to
compensate for partial or incorrect prior knowledge.
to foresee where and
3 For example, a vaçuum-cleaning agent that learns
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.

1.9. NATURE OF ENVIRONMENT


-
We must think about task environments, which are essentially the "problems" to
which rational agents are the "'solutions."
1.9.1. SPECIFYING THE TASK ENVIRONMENT
The rationality of the simple vacuum-cleaner agent, needs specification
of
the performance measures
the environment
the agent's actuators and sensors.
All these are grouped together under the heading
of the task environment. 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.

Example
Let us consider a more
complex problem: an automated
taxi driver, as an example
from the vacuum world. Before
the reader becomes concerned, we
a
that fully automated taxi is currently beyond should point out
the capabilities of current technology.
Intelligent Agent and Uninformed Search 1.19

The entire driving task is extremely flexible. Another reason we chose as a topic
it
for discussion is that the novel combinations of circumstances that can arise are
limitless. The PEAS description for the taxi's task environment is summarized in
Figure 1.4.

Performance
-AgentType Environment Actuators Sensors
Measure
Taxi driver Safe, fast, Roads, other Steering, Cameras,
legal, traffic, accelerator, Sonar,
comfortable pedestrians, brake, signal, speedometer,
trip, maximize customers horn, display GPS,
profits odometer,
accelerometer,
engine sensors,
keyboard
itiFig. 1.4. PEAS description of the task environment for an automated taxi.

Performance Measure
$ Desirable characteristics include:
u$ arriving at the correct destination; minimizing fuel consumption and wear
and tear;.
minimizing trip time or cost;
&
minimizing traffic violations and disturbances to other drivers; maximizing
safety and passenger comfort; and
3 maximizing profits.
3Obviously, some of these objectives are incompatible, so trade-offs will be
necessary.

Environment
Any taxi driver must navigate a wide range of roads, from rural lanes and
urban alleys to 12-lane freeways.
Other traffic, pedestrians, stray animals, road works, police cars, puddles,
and potholes can all be
found on the roads.
Learning Fundamentals
Artificial Intelligence and Machine
120
must interact with both potential and actual
In addition, the taxi
options.
passengers. There are also some additional
to operate in Southern California, where snow is
The taxi may be required
a or in Alaska, where it is almost never a problem.
rarely problem,
on the right, or we might want it to be able to drive
It could always drive
places like Britain or Japan. Obviously, the easier the design
on the left in
environment.
problem, the more restricted the

Actuators
a human
The actuators for an automated taxi include those available to
driver:
over steering
control over the engine through the accelerator and control
and braking.
In addition, it will need output to a display screen or voice synthesizer
to

talk back to the passengers, and perhaps some way to communicate with
other vehicles, politely or otherwise.

Sensors
The taxi's basic sensors will include one or more controllable video
cameras to see the road; these may be supplemented with infrared or sonar
sensors to detect distances to other cars
and obstacles.tatN
To avoid speeding tickets,-the taxi should have a speedometer, and an
accelerometer to properly control the vehicle, especially on curves.
The usual array of engine, fuel, and electrical system sensors
will be
required to determine the mechanical state
of the vehicle. It, like many
human drivers, may desire a global positioning
system (GPS) to avod
getting lost.

3 Finally, a keyboard or microphone


will be required for the passenger to
a
request destination,
In Figure 1.5, we have sketched the
basic PEAS elements for a number o
additional agent types.
Intelligent Agent and Uninformed Search |1.21|

Performance
Agent Type Environment Actuators Sensors
Measure
Medical Healthy Patient, Display of Keyboard
diagnosis hospital. staff hospital, staff questions, entry of
system tests,Symptoms,
diagnoses, findings,
treatments, patient's
referrals answers
Satellite image Correct image Downlink Display of Color pixel
analysis categorization from orbiting Scene arrays
system satellite categorization
Part-picking Percentage of Conveyor belt Jointed armCamera, joint
robot parts in correct with parts; and hand angle sensors
bins bins
Refinery Purity, yield, Refinery, Valves, Temperature,
controller safety operators pumps, pressure,
heaters, chemical
displays T
sensorS
Interactive Student's Set of Display of Keyboard
English tutor Score on test students, exercises, entry
testing agency suggestions,
corrections
Fig. 1.5. Eranples of agent types and their PEAS descriptions.

1.9.2. PROPERTIES OF TASK ENVIRONMENTS

Fully observable vs. partially observable


& If an agent's sensors provide it with complete access to the state of the
environment at any point in time, we say the task environment is fully
e
observable.
A
task environment is effectively fully observable if the sensors detect all
aspects relevant to the action choice; relevance is determined by the
performance measure.E
S. Fully observable environments are advantageous because the agent does
not need to maintain any internal state in order to keep track of the world.
Artificial Intelligence and Machine Learning Fndamental.
1.22

state
o Because of noisy and inaccurate sensors, or because parts of the
sinply missing from the sensor data, an environment may be partially
a sen
observable for example, a vacuum agent with only local dirt
-

cannot tell whether there is dirt in other squares, and an automated taxi

cannot see what othèr drivers are thinking.


The environnment is unobservable if the agent has no sensors.

Single agent vs. multiagent


A singleagent solving a crssword puzzle is clearly in a single-agent
environment, whereas a two-agent environment is in play.
The most difficult case, as one might expect, is partially observable,
stochastic, sequential, dynamic, continuous, and multiagent.

Deterministicvs. Stochastic
& If the next state of the environment is completely determined by the
current state and the action taken by. the agent, the environment is said to
be deterministic; otherwise, it is stochastic.
If an environment is not fully observable or deterministic, we call it
uncertain. The term "stochastic" generally implies that uncertainty about
outcomes is quantified in terms of probabilities; - a nondeterministic
environment is one in which actions are defined by their potential
outcomes but no probabilities are assigned to them.
$.Nondeterministic environmunt descriptions are typically associated with
performance measures that require the agent to be successful
in all
possible outcomes of its act' ons.
Episodic vs. Sequential

* The agent's experience


iu an episodic task environment is divided into
atomic episodes. Each episode begins
with the agent perceiving and then
acting on a single perception. Importantly, the next
episode is unaffected
by previous episodes' actions.
An agent on an assembly line,
for example, bases each decision on
current part, regardless th
of previous decisions; In sequential
environments, howevr', the current
decision may affect all future
decisions. Chess and 1 driving come after each other.
Intelligent Agent and Uninformed Search 1.23

Static vs. Dynamic


* If an agent's environment can change while he or she is deliberating, we
call it dynamic; otherwise, it is static.
Static environments ate sinmple to deal with because the agent does not
need to keep looking around whiledeciding on an action, nor does it need
to be concerned about the passage of time.
On the other hand, dynamic environments constantly ask the agent what it
wants to do; if it hasn't decided yet, that counts as deciding to do nothing.
If the environment does not change over time but the agent's performance
score does, we say the environment is semi dynamic. Taxi driving is
clearly dynamic: other cars and the taxi itself continue to move while the
driving algorithm mulls over what to do next. Chess is semi-dynamic when
played against a clock. Crossword puzzles are immobile.
Task Discrete
Observable Agents Deternministic Episodic Static
Environment
Crossword Fully Single Deterministic Sequential Static Discrete
puzzle Fully Multi DeterministicSequential | Semi Discrete
Chess with a
clock
Poker Partially Multi Stochastic Sequential Static Discrete
Backgammon Fully Multi Stochastic Sequential Static Discrete
Taxi driving Partially Multi Stochastic Sequential Dynamic Continuous
Partially Single Stochastic Sequential | Dynamic Continuous
Medical
diagnosis
Image Fully Single Deterministic Episodic Semi Continuous
analysis Single StochasticEpisodic Dynamic Continuous
Partially
Part-picking
robot
Single Stochastic Sequential Dynamic Continuous
Refinery Partially
controller Multi Stochastic Sequential Dynamic Discrete
Partially
Interactive
English tutor
Fig. 1.6. Examples of taskenvironments and their characteristics
Machine Learning Fundamentals
Artificial Intelligence
and
1.24
Discrete vs. Continuous state of the environment,
distinction appliestothe
discrete/continuous and actions.
The agent's perceptions
handled, and the disti..
a limited number of
how time is
example, has
The chess
environment, for set of perceptions ax
* a distinct
(excluding the clock). Chess has
states
actions.
continuous-time problem: the tav.
a continuous-state and
3 Taxi driving is
locations sweep through a range of
speeds and
and other vehicles'
over time.
continuous values smoothly
(steering angles, etc.)
The actions
of
taxi driver are also continuous
a
as
camera input is discrete, it is commonly interpreted
Although digital
representing continuously varying intensities
and locations.

Known vs. Unknown


state
Strictly speaking, this distinction refers to the agent's (or designer's)
of knowledge about the."laws of physics" of the environment, rather than
the environment itself.
The outcomes (or outcome probabilities if the environment is stochastic)
for all actions are given in a known environment.
Obviously, if the environment isunfamiliar, the agent must learn how it
operates in order to make sound decisions.
It should be noted that the distinction
between known and unknown
environments differs from the distinction
between fully and partially
observable environments.u
* It is entirely possible for a known
environment to be
partially observable -
for example, I know the rules
see the cards
of solitaire card games
but am still unable t0
that have not yet been turned over.
environment can be fully In contrast, an unknow
-
visible in a new
display the entire game state, video game, the screen ay
but I won't know what
try them. the buttons do until

1.10. STRUCTURE OF
AGENT

The job of AI
is to
function - the mapping
design an
agent program
that implements the agent
from percepts to
actions.
Intelliqnt AQent anx Uinformed Searclh 1.25|

Ne assume this program will run on some sort of computing device with
-
physical sensors and actuators 0 we call this the architecture:
ngent = architecture + program.
Agent Programs
The skeleton of cach agent program is the same: it receives the current
peveption as input from the sensors and sends back an action to the
actuator.6 Take note of the distinction betvween the agent function, which
accepts the entire percept history, and the agent program, which only
accepts the current percept.
Take note of the distinction between the agent function, which accepts the
entie percept history, and the agent program, which only accepts the
current percept.
Nothing more is available from the environment, so the agent program
only accepts the current percept as input; if the agent's actions are
dependent on the entire percept sequence, the agent will have to memorize
the percepts.
As an illustration, Figure 1.7 depicts a rather simple agent program that
tracks the percept sequence and uses it to index into a table of actions to
determine what to do. Figure 1.3's example table, which is for the vacuum
world, clearly illustrates the agent function that the agent program
embodies.
function TABLE-DRIVEN-AGENT (percept) returns an action

persistent: percepts, a sequence, initially empty


ihst
table, a table of actions, indexed by percept sequences, initially fully
specified

append percept to the end of percepts toste


action LOOKUP(percepts, table)
return action

Fig. 1.7. The TABLE-DRIVEN-AGENTprogram is invoked each new percept


for and
returns an action eaclh timne. It retains the complete percept sequence memory.
in
1.26| Artificial ntelligence and Machine Learning Fundamental,

Challenges
Table lookup of percept-action pairs defining allpossible condition-actiom
rules necessary to interact in an environment
Problems
Too big to generate and to store (Chess has about 10^120 states, for

example)
No knowledge of non-perceptual parts of the current state
Not adaptive to changes in the environment; requires entire table to
be updated if changes occur
Looping: Can't make actions conditional
Take a long time to build the table
No autonomy
Even with learning, need a long time to learn the table entries

1.10.1. TYPES OF AGENTS


We outline four basic kinds of agent programs that embody the principles
underlying almost all intelligent systems:
$ Simple reflex agents;
Model-based reflex agents;
Goal-based agents; and
Utility-based agents.

1.10.2. SIMPLE REFLEX AGENT


agents choose
3 A simple reflex agent is the most basic type of agent. These
theircourse action based solely on the current perception, disregarding
of
previous perceptions.
vacuum agent whose agcnt
A simple reflex agent is, for instance, the
vacuum agent bases
function is tabulated in Figure 1.3. This is because the
or not it contans
its decision solely on its current location and whether
dirt. Figure. 1.8 depicts the agent program for this agent.
are present.
Even in more complex environments, simple reflex behaviors
Intelligent Agent and Uninformed Search 1.27
Consider yourself the automated taxi's driver. You should be aware of this
and begin to brake if the vehicle in front of you applies the brakes and
illuminates its brake lights. To put it another way, some processing is done
on the visual input to determine the circumstance known as "The car in
front is braking." Then, something built into the agent program connects
this to the action "initiate braking." We call such a connection a condition
action rule, written as
if car-in-front-is-brakingthen initiate-braking
function REFLEX-VACUUM-AGENT(location, status]) returns an action
if status = Dirty then return Suck
else if location = A then return Right
else if location = B then return Left
Fig. I.8. The agent program fora simple reflex agent in the two-state vacuum
environmnent. This program implements the agent function tabulated in Figure 1.3.

The program in Figure 1.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 1.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. seo
Agent
Sensors

What the world Environment

s like now

What action
Condition-action rules
should do now

Actuators

Fig. 1.9. Schematic diagram ofa simple reflex agen.


12S| Artificial Intelligence and Machine Learming Fndamentol.

We use etangles to denote the curent internal state of the aget:


decision process, and ovals to represent the background information use:
in the prces.
The agent program, which is also very simple, is shown in Figure 1.10.

function SIMPLE-REFLEX-AGENT(percept) retunsan action


persistent: rules a set of condition-action rules
state
rule
- INTERPRET-INPUT(percept)
RULE-MATCH (state, rules)
action -rule, ACTION
return action
Fig. 1.10. A sunple reflex agent. It acts according to a rule whose condition
matches the current state, as defined by the percept
The RULE-MATCH function returns the first rule in the set of rules that
matches the given state description, and the INTERPRET-NPUT fnction
&
sure generates an abstracted description of the current state from the percept.
* Simple reflex agents have the admirable quality of simplicity, but their
intelligence is constrained.
o
The agent in Figure 1.10 will only function if the right choice can be made
tc based solely on the current perception, or in other words, if the
environment is completely observable. Unobservalbility any size can be
of
extremely problematic.
For instance, the braking rule presented earlier assumes that the current
percept - a single frame of video - can be used to determine the condition
car-in-front-is-braking. If the vehicle in front has a brake light mounted in
the center, this will work.
If the agent can randomize its actions, it can break out of infinite loops.
For instance, the vacuum agent might flip a coin to decide between Left
and Right if it detects (Clean]. It is simple to demonstrate that the agent
Will take an average of two steps to reach the other square. The
task will
then be finished if that square needs to be cleaned because it was dirty.
Intelligent Agent and Uninformed Search 1.29|

Consequently, a random simple reflex agent may perform better than a


deterministic simple reflex agent.

1.10.3. MODEL-BASED REFLEX AGENTS


The agent should keep track of the portion of the world it can't currently
see because this is the most efficient way to handle partial observability.
That is, the agent must preserve some kind of internal state that is
dependent on perceptual history and thus captures at least some of the
current state's unobserved characteristics.
There are two different types of knowledge that must be encoded in the
agent program in order to update this internal state information over time.

Sensors
State

How the world evolves What the world


is like now

What my actions do Environment

Condition-action rules What action I

should do now

Actuators
Agent

Fig. 1.11. A
model-based reflex agent
First, we need to know how the world changes without the agent, such as
the fact that a car overtaking it will usually be closer to it now than it was
earlier.

$ Second, we need to know how the agent's actions affect the outside world.
For instance, we need to know that turning the steering wheel clockwise
causes the car to turn to the right, or that after five minutes of driving
northbound on the freeway, one is typically about five miles further north
than when they started.
1.30 Artificial Intelligence and Machine Learning Fundamentals

A model of the wvorld refers to this understanding of "how the world


works," whether it is expressed in straightforward Boolean circuits or in
comprehensive scientific theories. A model-based agent is one that makes
use of such a MODEL-BASED model.
The structure of the model-based reflex agent with internal state is shown
in Figure 1.11. Based on the agent's model of how the world functions, it
demonstrates how the current percept is combined with the previous
internal state to produce the updated description of the current state. In
Figure 1.12, the agent program is displayed.

function MODEL-BASED-REFLEX-AGENT(percept) returns an action


persistent: state, the agent's current conception of the world state
model, a description of how the next state depends on current state
and action
rules, a set of condition-action rules
action, the most recent action, initially none
state
rule
- UPDATE-STATE(state, action, percept, model).
RULE-MATCH(state, rules)
action rule, ACTION
return action
Fig. 1.12. A model-based reflex agent
It keeps track of the current state of the world, using an internal model. It
then chooses an action in the same way as the refleX agent

1.10.4. GOAL-BASED AGENTS


Understanding the current state of the environment is not always sufficient
to make decisions.
The taxi can, for instance, turn left, turn right, or continue straight ahead at
a road intersection. Depending on
where the taxi is trying to go, the
appropriate choice will vary. In other words, in addition to describing the
current state, the agent also needs some sort
of goal. information that
i describes desirable situations, such as being at the passenger's
destination.
Intelligent Agent and Uninformed Search
1.31

The agent program can choose actions that accomplish


the goal by
combining this with the model (the same data that was
used in the model
based reflex agent). Figure 1.13 depicts the structure
of the goal-based
agent.

Sensors
State

How the world evolves What the world


is like now
What my actions do
What it will be Environment

like if Ido action A

Goals What action I


should do now

Actuators
Agent

Fig. 1.13. A model-based, goal-based agent


It keeps track of the world state as well as a set
of goals it is trying to achieve,
and chooses an action that wvill (eventually) lead to the achievement its goals
of
Sometimes goal-based action selection is straightforwardfor
example,
when goal satisfaction results immediately from a single action.
Sometimes it will be trickier - for example, when the agent
has to consider
long sequences of twists and turns in order to find a way to achieve the
goal. Search and planning are the subfields of AI devoted to
finding action
sequences that achieve the agent's goals.

1.10.5. UTILITY-BASED AGENTS


In most environments, goals do not suffice to produce high-quality
behavior. For instance, a lot of action scenes will get the taxi to its
destination (and thus accomplish the goal), but some are faster, safer, more
dependable, or more affordable than others.
The only distinction that goals make between "happy" and "unhappy"
states is a crude binary one.
Artificial Intelligence and Machine Learning Fundamentals
1.32|

A more comprehensive performance metric should enable comparisons


states ascd on the level of happiness they
between various world they would
bring to the agent.
Economists and computer scientists prefer the term utility because "happy"
doesn't sound very scientific.
We've already seen that a performance measure can easily distinguish
between more and less desirable routes to the destination of the tavi
because it can assign a score to any given sequence of environmental
states.
The utility function of an agent essentially internalizes the performance
metric.
If the internal
utility function and the external performance measure agree,
an agent will be considered rational in the eyes of the external performance
measure if it chooses to take actions that will maximize its utility. Figure
1.14shows the utility-based agent structure.

Sensors
State

How the world evolves What the world


is like now
What my actions do
What it will be Environment

like if Ido action A

Howhappy Iwill
Utility
be In such a state

What action |
should do now

Actuators
Agent

Fig. 1.14. A model-based, utility-based agent


Intelligent Agent and Uninformed Search 1.33|

It uses a model of the world, along with a utility function that measures its
preferences among states of the world. Then it chooses the action that leads to
the best expected utility, where expected utility is computed by averaging
over all possible outcome states, weighted by the probability of the
outcome

1.10.6. LEARNING AGENT


As shown in Figure 1.15, a learning agent can be broken down into four
conceptual components.
The most crucial distinction is between the performance element, which
chooses external actions, and the learning clement, which is in charge of
making improvements.
The performance component is what we previously thought to be the entire
agent; it processes perceptions and makes decisions about what to do.
The learning element determines how the performance element should be
changed to perform better in the future using CRITICAL feedback from
the critic on how the agent is performing.
Performance
Standard

Critic Sensors +

Environment

changes
Performance
Learning
knowledge element
.element

Learning goals t
Problem
Generator
Actuators
Agent

Fig. 1.15. A general learnng agent


The design of the performance element heavily influences the design of
the learning element. The critic informs the learning component of the
standard.
agent's performance in relation to a predetermined performance
Machine Learning Fundamental,
Artifcial Intelligence and
|1.34|
an aes
perceptions cannot by themselves determine whether
Because the
is successful, the critic is required.
a percept indicating that
a chess program might receive it has
For instance,
opponent, but. it requires a performance standard
checkmated its
a thing since the percept itself does not
understand whether this is good
is. The performance standard needs to be set in stone.
state that it
generator is the final element of the learning agent. It is in
The problem
recommendations for actions that willresult in novel and
charge of making
educational experiences.
some exploration, it may find far better
However, if the agent is open to
course action. These exploratory steps must be suggested by
long-term of
experiments, they do this.
the problem generator. When scientists conduct

1.11. PROBLEM SOLVING AGENTS

A Problem-solving agent is a goal-based agent.


It decides what to do by finding sequence of actions that lead to desirable
states.
The agent can adopt a goal and aim at satisfying it. To illustrate the agent's
behavior, let us take an example where our agent is in the city of Arad,
which is in Romania. The agent has to adopt a goal of getting to Bucharest.
§ Goal formulation, based on the current situation and the agent's
performance measure, isthe first step in problem solving. The agent's task
is to find out which sequence of actions will get to a goal state.
Problem formulation is the process of deciding what actions and states to
consider given a goal
An agent with several immediate options of unknown value can decide
what to do by first examiníng future actions that eventually lead to states
of known value.
The process of looking for a sequence of actions that reaches the goal is
called search. A search algorithm takes a problem as input and returns
n
solution in the form of an action sequence.
Intelligent Agent and Uninformed Search 1.35

Once a solution is found, the actions it recommends can be carried out.


This is called the execution phase. Thus, we have a simple “formulate,
search, execute" design for the agent, as shown in Figure 1.16.

function SIMPLE-PROBLEM-SOLVING-AGENT(percept) returns an action


persistent seq, an action sequence, initially empty
state, some description of the current world state
goal, a goal, initially null
problem, a problem formulation
state UPDATE-STATE(state, percept)
if seq is empty then
goal
problem
- t-FORMULATE-PROBLEM(state)
FORMULATE-PROBLEM(state, goal)
seq - SEARCH(problem)
if seq = failure then returna null action
action
seq
-
-REST(Seq)
FIRST(Seq)

return action
Fig. 1.16. A simple problem-solving agent
It first forimulates a goal and a problem, searches for a sequence of actions
that would solve the problem, and then executes the actions one at a time.
When this is complete, it formulates another goal and starts over
After formulating a goal and a problem to solve, the agent calls a search.
procedure to solve it. It then uses the solution to guide its actions, doing
whatever the solution recommends as the next thing todo - typically, the
first action of the sequence and then removing that step from the
sequence.
Once the solution has been executed, the agent will formulate a new goal.
while the agent is executing the solution sequence it ignores its percepts
when choosing an action because it knows in advance what they will be.
|1.36| Artificial Intelligence and Machine Learning Fundamentals

so to speak, must be
An agent that carries out its plans with its eycs closed,
an open-loop
quite certain of what is going on. Control theorists call this
system, because ignoring the percepts brcaks the loop between agent and
environment

1.11.1. WELL-DEFINED PROBLEMS AND SOLUTIONS


A
problem can be defined formally by five components:
state for
The initial state that the agent starts in. For example, the initial
our agent in Romania might be described as In(Arad).
a
A description of the possible actions available to the agent. Given
s.
particular state s, (s) returns the set of actions that can be executed in
We say that each of these actions is applicable in s. For example, from the
state In (Arad), the applicable actions are {Go(Sibiu), Go(Timisoara),
Go(Zerind)}.

4A description of what each action does; the formal name for this is the
a
transition model, specified by function (s, a) that returns the state that
results from doing action a in state s. We also use the term successor to
refer to any state reachable from a given state by a single action.
For example, we have
RESULT (In (Arad), Go (Zerind)) = In (Zerind)
Oradea
Neamt
Jzerind 151 87
75/
Isai
Arad 140
Sibiu
92
99 Fagaras
118
80 Vaslui
Timisoara Rimicu Vilcea

111 Pitesti 211 142


OLugoj 97

146 98
Mehadia 85 Hirsova
101 Urziceni
75
138 86
Bucharest
Dobrete O20 JCraiova
Glurgiu Eforie

Fig, 1.17. A
simplified road map of part of Romania
Intelliget Agent and Uninformed Search |1.37

Together, the initial state, actions, and transition model implicitly define
-
the state space of the problem the set of all states reachable from the
a
initial state by any sequence of actions. The state space forms directed
network or graph in which the nodes are states and the links between
nodes are actions.
The map of Romania shown in Figure 1.17 can be interpreted as a state
space graph if we view each road as standing for two driving actions, one
in each direction. A path in the state space is a sequence of states
connected by a sequence of actions.
The goal test, which determines whether a given state is a goal state.
Sometimes there is an explicit set of possible goal states, and the test
simply checks whether the given state is one of them. The agent's goal in
Romania is the singleton set {In(Bucharest)}
A path cost function that assigns a numeric cost to each path. The
problem-solving agent chooses a cost function that reflects its own
performance measure. For the agent trying to get to Bucharest, time is of
the essence, so the cost of a path might be its length in kilometres.
The step cost of taking action a in state s to reach state s is denoted by
c(s, a, s' ). The step costs for Romania are shown in Figure 1.17 as route
distances. We assume that step costs are nonnegative.
The preceding elements define a problem and can be gathered into a single
data structure that is given as input to a problem-solving algorithm.
A solution to a problem is an action sequence that leads from the initial
state to a goal state. Solution quality is measured by the path cost function,
and an optimal solution has the lowest path cost among all solutions

1.11.2. FORMULATING PROBLEMS

3 Abstraction is the removal of specifics from a representation. We must


abstract the actions themselves in addition to the state description.

3 Driving has a variety of outcomes. In addition to moving the vehicle and


its occupants, traveling requires time, fuel, creates pollution, and shifts the
agent (travel is broadening, as they say).
Fundamental
|1.38 Artificial Intelligence and Machine Learning

in our formulation. Additionally.


Only the changè in location is considered
on
we completely skip, including turning
there are numerous actions that
the radio, looking out the window, slowing down
for police officers, and

more.
to Sibiu, Rimnicu Vilcea.
As an illustration, consider the route from Arad
to this
Pitesti,and Bucharest. Numerous more intricate paths correspond
driving
abstract solution. For instance, we could listen to the radio while
between Sibiu and Rimnicu Vilcea before turning it off for the remainder
of the journey.
For every detailed state that is "in Arad," there must be a detailed path
to

some state that is "in Sibiu," and so on. The abstraction is valid if we can
expand any abstract solution into a solution in the more detailed world.
The abstraction is helpful if executing each step of the solution is simpler
than the original issue; in this case, the steps are simple enough to be
completed by a typical driving agent without the need for additional
research or planning.
Thus, choosing a good abstraction entail taking away as litle information
as possible while maintaining its validity and making sure
that the abstract
actions are simple to perform.

1.12. UNINFORMED SEARCH

Uninformed Search Strategies have no additional information


about states
beyond that provided in the problem definition
Strategies that know whether one non goal state
is "more promising" than
another are called Informed search or heuristic search
strategies. There are
five uninformed search strategies as given
below.
Breadth-first search
s Uniform-cost scarch /Dikstra's algorithmsh
Depth-first search
t i by Depth-limited scarch
Iterative deepening
searchi
Intelligent Agent and Uninformed Search |1.39

1.12.1. BREADTH-FIRST SEARCH


$ Breadth-first search is a straightforward method in which all of the root
node's descendants are expanded first, followed by their descendants, and
so forth.
In the search tree, all nodes are typically expanded at a certain depth
before any nodes at the next level arce expanded.
A variation of the general graph-search algorithm known as breadth-first
search selects the shallowest unexpanded node for expansion. The use of a
FIFO queue for the frontier makes this very simple to accomplish.
As a result, old nodes, which are shallower than the new nodes, get
expanded first while new nodes, which are always deeper than their
parents, are pushed to the back of the line.
$ The goal test is applied to each node when it is generated rather than when
it is chosen for expansion, which is a minor modification to the general
graph-search algorithm.
Figure 1.18 provides pseudocode. Figure 1.19 displays the search's
progression on a straightforward binary tree.
function BREADTH-FIRST-SEARCH(problem) returns a solution, or failure
node - a node with STATE= problem.INITIAL-STATE,PATH-COST =0
if problem,GoAL-TEST(node.STATE)then return SOLUTION(node)
frontier a FIFO queue with node as the only element
explored
loop do
- an empty set

if EMPTY?(frontier) then return failure


node POP(frontier) /* chooses the shallowest node in frontier */
add node.STATE to explored
for each action in problem.ACTIONS(node.STATE) do
child - CHILD-NODE(problem, node,action)
if child.STATE is not in explored or frontier then
if child.STATE is not in explored or frontier then
if problem.GOAL-TEST(child.STATE) then return
SOLUTION(child)
frontier -INSERT(child, frontier)
Fig. 1.18. Breadth-first search on agraph
1.40| Artificial Itelligence and Machine Learning Fundamentals

(B)

©. F G

to be
Fig. 1.19. Breadth-first search on a simple binary tree. At each stage, the node
erpanded next is indicated by a marker
-
We can easily see that it is complete if the shallowest goal node is at
some finite depth d, breadth-first search will eventually find it after

generating all shallower nodes.


Breadth-first search is optimal if the path cost is a non decreasing function
of the depth of the node. The most common such scenario is that all
actions have the same cost.
Imagine searching a uniform tree where every state has b successors.
The root of the search tree generates b nodes at the first level, each of
which generates b more nodes, for a total of b2 at the second level.
Each of these generates b more nodes, yielding
b³nodes at the third level,
and so on. Now suppose that the solution is at depth d.
In the worst case, it
is the last node generated at that level. Then the total
number of
nodes
generated is,
b+ b2 + b3 + ... + bd = O(b)
space complexity: for any
kind of graph search, which stores every
expanded node in the explored set,
the space complexity is always within a
factor of b of the time
complexity.
* For breadth-first graph search
in particular, every node
generated remains
in memory. There will be O(hd
-1) nodes in the explored set and O(b)
nodes in the frontier so
the space complexity is
O(b), i.e., it is dominated
by the size of the frontier.
Intelligent Agent and Uninforned Search |1.41

Depth Nodes Time Memory


2 110 11 milliseconds 107 kilobytes

4 11,110 11 milliseconds 10.6 megabytes

6 106 1.1scconds Igigabyte

8 108 2 minutes 103 gigabytes

10 1010 3 hours 10 terabytes

12 1012 13 days 1petabyte

14 1014 3.5 years 99 petabytes


16 1016 350 years 10exabytes

and memory requirenents for breadth-first search. The numbers


Fig. 1.20. Time
shown assume branching factor b = 10; I million nodes/second; 1000 bytes/node
the memory requirements are a bigger problem for breadth-first search
than is the execution time
exponential-complexity search problems cannot be solved by uninformed
methods for any but the smallest instances

1.12.2. UNIFORM COST SEARCH


Because it always expands the shallowest unexpanded node, breadth-first
search is the best option when all step costs are equal. We can discover an
algorithm that is best for any step-cost function by making a
straightforward extension.
Uniform-cost search expands the node n with the lowest path cost g(n), as
opposed tothe shallowest node. To achieve this, the frontier is kept in a
priority queue that is sortd by g. Figure. 1.20 depicts the algorithm.
There are two additional key differences between path cost ordering and
breadth-first search in addition to the queue being ordered by path cost.
The first is that rather than when a node is first generated, the goal test is
applied to it when it is chosen for expansion. The first goal node that is
generated might be on a path that is not ideal, which is the cause.
The second difference is the addition of a test in the event that a better
route to a node that is currently on the frontier is discovered.
|1.42 Artificial Intelligence and Machine Learning Fundamentale

function UNIFORM-COST-SEARCH(problem) returns a solution, or failure


node -
frontier
a node with STATE = problem.INITIAL-STATE,PATH-COST = 0
a priority queue ordered by PATH-COST, with node as the only
element
explored an empty set

loop do
if EMPTY?(frontier) then return failure
node -
POP(frontier) /* ch00ses the lowest-cost node in frontier */
if problem.GOAL-TEST(node.State) then return SOLUTION (node)
add node. STATE to explored
for each action In problem.Action(node.STATE) do
aso child - CHILD-NODE(problem,node,action)nst
if child. STATE is not in explored or frontier then
frontier - NSERT(child,frontier)
else if child.STATE is in frontier with higher PATH-COST then
replace that frontier node with child
Fig. 1.21. Uniforn-cost search on a graph
The algorithm is identical to the general graph search algorithm in Figure
1.7, except for the use of a priority queue and the addition of an extra
check in case a shorter path to a frontier state is discovered. The data
structure for frontier needs to support efficient membership testing, so it
should combine the capabilities of a priority queue and a hash table.
Sibiu Fagaras
99
80
Rimicu Vilcea

Pitesti 211
97

101

Bucharest
Fig. 1.22. Part of theRomania state space, selected to illustrate uniforn-cost search
Intelligent Agent and Uninformned Search 1.43

Both of these modifications come into play in the example shown in


Figure 1.21, where the problem is to get from Sibiu to Bucharest. The
successors of Sibiu are Rimnicu Vilcea and Fagaras, with costs 80 and 99,
respectively. The least-cost node, Rimnicu Vilcea, is expanded next,
adding Pitesti with cost 80 +97 = 177. The least-cost node is now Fagaras,
so it is expanded, adding Bucharest with cost 99+211 =310.

Now a goal node has been generated, but uniform-cost search keeps going,
choosing Pitesti for expansion and adding a second path to Bucharest with
cost 80 + 97 + 10l=278. Now the algorithm checks to see if this new path
is better than the old one; it is, so the old one is discarded. Bucharest, now
with g-cost 278, is selected for expansion and the solution is returned.
Uniform-cost search does not care about the number of steps a path has,
but only about their total cost. Thereföre, it will get stuck in an infinite
loop if there is a path with an infinite sequence of zero-cost actions.
The algorithm's worst-case time and space complexity is O(5 ),
which can be much greater than b-.

1.12.3. DEPTH-FIRST-SEARCH
The deepest node in the curent frontier of the search tree is always
expanded by depth-first search. Figure 1.23 shows how the search is
progressing.
The deepest level of the search tree, where the nodes have no successors,
is reached right away by the search. The search "backs up" to the next
deepest node that still has unexplored successors as those nodes are
expanded and dropped from the frontier.
An example of graph-searchalgorithm is the depth-first search
a

algorithm. Depth-first search makes use of a LIFO queue as opposed to


breadth-first search's FIFO queue.
The most recent generated node is picked for expansion in a LIFO queue.
Given that it is one deeper than its parent, which was the deepest
unexpanded node when it was chosen, this must be the deepest
unexpanded node.
1.44 Artificial Intelligence and Machine Learning Fndamental,

common to implement depth-first search using a recursive function


3 It is as an alternative to the
that calls itsclf on cach of its children in turn
GRAPH-SEARCH-style implementation.

A
B

A)
B

Fig. 1.23. Depth-first search on a binary tree. The unexplored region is shown in light
grav. Explored nodes with no descendants in
the frontier are removed from memor.
Nodes at depth 3 have no successors and Mis the only goal node.

$ The properties of depth-first search depend strongly on whether the graph


search or tree-search version is used. The graph-search version, which
avoids repeated states and redundant paths, is complete in finite state
spaces because it will eventually expand every node.
Intelligent Agent and Uninformed Search 1.45|

Depth-first tree search can be modified at no extra memory cost so that it


checks new states against those on the path from the root to the current
node: this avoids infinite loops in finite state spaces but does not avoid the
proliferation of redundant paths.

In infinite state spaces, both versions fail if an infinite non-goal path is


encountered.
A
variant of depth-first search called backtracking search uses still less
memory

3 In backtracking, only one successor is generated at a time rather than all


successors; each partially expanded node remembers which successor to
generate next.

In this way, only O(m) memory is needed rather than O(bm). Backtracking
search facilitates yet another memory-saving (and time-saving) trick: the
idea of generating a successor by modifying the current state description
directly rather than copying it first.

This reduces the memory requirements to just one state description and
O(m) actions.

1.12.4. DEPTH-LIMITED SEARCH

3 The embarrassing failure of depth-first search in infinite state spaces can


be alleviated by supplying depth-first search with a predetermined depth
limit 1. That is, nodes at depth l are treated as if they have no successors.

This approach is called depth-limited search. The depth limit solves the
infinite-path problem

$ Unfortunately, it also introduces an additional source of incompleteness if


we choose l
<d, Time complexity is O(b/) and space complexity is O(b/).
& Depth-first search can be viewed as a special case of depth-limited search
with 1= 0.
Artificial Itelligence and Machine Learning Fundamentals
1.46|

function DEPTH-LIMITED-SEARCH(problem, limit)returns a solution.


failure/cutoff
return RERCUSIVE-DLS(MAKE-NODE(problem.INITIÁL STATE)
problem, limit)
function RECURSIVE-DLS(node,problem,limit) returns solution,
failure/cutoff
if problem.GOAL-TEST(node.STATE) then return SOLUTION(node)
else if limit = 0 then return cutoff
else
cutoff-occurred? false
for each action in problem.ACTIONS(node.STATE) do
child
result - CHILD-NODE(problem, node, action)td
RECURSIVE-DLS(Child, problem, limit -1)
if result = cutoff the cutoff-occurred? true
else if result failure then return result
if cutoff-occurred? then return cutoff else return failure
Fig. 1.24. A recursive implementation
of depth-limited tree search.
Depth-limited search can be implemented as a
simple modification to the
general tree or graph-search algorithm.
Alternatively, it can be
implemented as a simple recursive algorithm as
shown in Figure 1.24.
1.12.5. ITERATIVE DEEPENING DEPTH-FIRST
SEARCH
Iterative deepening search (or iterative
deepening depth-first search) is a generd
strategy, often used in combination
with depth-first tree search, that
depth limit. It does this by gradually finds the best
increasing the limit - first 0,
so on - until a goal is found. then 1, then 2, and
function ITERATIVE-DEEPENING-SEARCH(problem)
failure return a solution,

for depth =0 to o do
result DEPTH-LIMITED-SEARCH(problem,
depth)
if result# cutoff then return result
Fig. The iterative deepening search algorithm,
1.25.
which repeatedly applies depth limied
search with increasing limits. It terminates when a
search returnsfailure, meaning
solution is found or if
the depth limited
that no solution exists.
Intelligent Agent and Uinformed Search 1.47

Limit = 0

Limit = 1

Limit =2

Limit =3

Fig. 1.26. Four iterations ofiterative deepening search on a binary tree.


This will occur when the depth limit reaches d, the depth of the shallowest
goal node. The algorithm is shown in Figure 1.25.

4 Iterative deepening combines the benefits of depth-first and breadth-first


search.
Like depth-first search, its memory requirements are modest: O(bd) to be
precise.
Like breadth-first search, it is complete when the branching factor is finite
and optimal when the path cost is a non decreasing function of the depth of
the node.
1.48 Artilead htelligence amd Muchine learning F'ndamentas

Figure 1.26 shows four iterntions of on a binary scnrch trcc, where the
solution is found on the fourth iteration

TWO MARKS QUESTION WITH ANSWERS

1. Define artificial intelligence.


Artificial Intelligence is the study of how to make computers do things which,
at the moment, pcople do betlcr

2. How to improve the effectiveness of a search-based problem-solving


technique?
(a) Goal formulation
(6) Problem formulation
(c) Search
(d) Solution
(e) Execution phase
3. List the issues that affect the designof an learning
element.
The design of a lcarning clement is affected by three major
issues: Which
components of the performancc clement arc to be learned?
What feedback is
available to learm thesc componcnts? What representation
is used for the
components?
4. List the Properties of breadt-first searclh
Complete? Yes (if b is finite)
Time? 1+b + b2 4+ h3 t... + bd t+
b(bd-1) = 0(bd +
1)
Space? O (bd+ 1) (keeps every node in memory)
Optimal? Yes (if cost =1 per step)
Space is the bigger problem (more than timc)
5. List the Properties of depth-first search
Complete? No: fails in infinite-depth spaces, spaces
with loops - Modity to
avoid repcated states along path å complete in finite spaces
Time? O (bm): terrible if is much larger than
m

d But if solutions are


dense, may be much faster than brcadth-first
Intelligent Agent and Uninformed Search |1.49

Space? O(bm), i.e., linear space!


6. Define the term Agent
An agent is anything that can be viewed as perceiving its environment
through sensors and acting upon the environment through effectors.
7. Define the term Agent Function
The agent function for an agent specifies the action taken by the agent in
response to any percept sequence. It is an abstract mathematical description.
Internally, the agent function for an artificial agent will be implemented by an
agent program
8. Why problem formulation must followthe goalformulation?
In goal formulation, we decide which aspects of the world we are interested
in, and which can be ignored or abstracted away. Then in problem formulation
we decide how to manipulate the important aspects (and ignore the others). If we
dd problem formulation first we would not know what to include and what to
leave out. That said, it can happen that there is a cycle of iterations between goal
formulation, problem formulation, and problem solving until one arrives at a
sufficiently useful and efficient solution
9
What is the use of online search agents in unknown environment?
Online search agents operate by interleaving computation and action: first it
takes an action, and then it observes the environment and computes the next
action. Online search is a good idea in dynamic or semi dynamic domains and
stochastic domains. Online search is a necessary idea for an exploration
problemn, where the states and actions are unknown to the agent.
10. between uninformed and informed search strategies?
What is the difference
S.NO Uninformedsearch(Blindsearch) Informed search(Heuristic search)
No information about the number| The path cost from the current state
to select
of steps (or) path cost from the to goal state is calculated,
current state to goal state the minimum path cost as the next
state
2 Less effective in search method More effective
can be added
problem to be solved with the Additional information
given information as assumption to solve the problem
|1.50| Artificial Intelligence and Machine Learning Fundamental

4 E.g E.g.
(a) Breadth first search (a) Best First Search
(6) Uniform cost search (6)Greedy search
(c) Depth limited search (c)A* search
(d) Depth limited search
(e)lnteractive deepening search
) Bi-directional search
11, What is a rational agent?
A rational agent is one that does the right thing. Here
right thing is one that
will cause agent to be more successful. That leaves us with the problemn of
deciding how and when to evaluate the agent's success.
12. List the Risks and benefits of
A.
Risks of AI Benefits of AI
Job displacement Increased efficiency and productivity

Bias in decision-making Improved healthcare and disease


diagnosis
Security threats and cyber Advancements in scientific research
attacks and discovery

Lack of transparency and Enhanced personalization and


accountability customization in consumer products
and services
Dependence on AI and loss of Improved safety in industries such as
human skills transportation and manufacturìng

Potential for misuse and Increased accessibility and


weaponization affordability of education and training
Loss of privacy and surveillance Development of new technologies and
Concerns innovations
Potential for unintended Increased accessibility and inclusivity
consequences and unforeseen for people with disabilities and
Outcomes marginalized communities
Intelligent Agent and Uninformed Search |1.51|

13. WIat are PEAS?


PEAS (Performance, Environment, Actuators, Sensors)
14. What is problem solving agent?

A Problem-solving agent is a goal-based agent. It decides what to do by


finding sequence of actions that lead to desirable states. The agent can adopt a
goal and aim at satisfying it.
15. Define backtracking search.
A variant of depth-first search called backtracking search uses less memory
and only one successor is generated at a time rather than all successors.; Only
O(m) memory is needed rather than O(bm)

REVIEW QUESTIONS

1. Given an example of a problem for which breadth-first search would work better
than depth-first search.
2. Explain the following search strategies. () depth limited search (i) Uniform
search
3. Explain Uniformed search Strategies.
4. Discuss on different types of Agent Program
Outline the components and functions of any one of the basic kinds of agent
programs.
6. The given figure shows the 15 node state space. Node 12 is the goal node.
Workout the order in which the nodes will be visited for () Breadth first search
(i1) Depth first search.

4 5 6

. Discuss the properties of task environments.


8, Explain the types of Agents.

You might also like