0% found this document useful (0 votes)
6 views

AI Unit 1 Part 1 Notes

The document outlines the syllabus for an introductory course on Artificial Intelligence (AI), covering topics such as intelligent agents, search strategies, and various definitions and approaches to AI. It discusses the historical development of AI, key contributors, and interdisciplinary foundations, including philosophy, mathematics, and neuroscience. Additionally, it highlights contemporary applications of AI, such as robotic vehicles, speech recognition, and autonomous planning.

Uploaded by

deepakhokalay
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views

AI Unit 1 Part 1 Notes

The document outlines the syllabus for an introductory course on Artificial Intelligence (AI), covering topics such as intelligent agents, search strategies, and various definitions and approaches to AI. It discusses the historical development of AI, key contributors, and interdisciplinary foundations, including philosophy, mathematics, and neuroscience. Additionally, it highlights contemporary applications of AI, such as robotic vehicles, speech recognition, and autonomous planning.

Uploaded by

deepakhokalay
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 44

Unit-1

SYLLABUS:
Problem Solving by Search-I: Introduction to AI, Intelligent Agents
Problem Solving by Search –II: Problem-Solving Agents, Searching for Solutions,
Uninformed Search Strategies: Breadth-first search, Uniform cost search, Depth-first search,
Iterative deepening Depth-first search, Bidirectional search,

Informed (Heuristic) Search Strategies: Greedy best-first search, A* search, Heuristic


Functions Beyond Classical Search: Hill-climbing search, Simulated annealing search,

Local Search in Continuous Spaces,


Searching with Non-Deterministic Actions,
Searching wih Partial Observations,
Online Search Agents and Unknown Environment .

INTRODUCTION TO AI
➢ WHAT IS AI
➢ THE FOUNDATIONS OF ARTIFICIAL INTELLIGENCE
➢ THE HISTORY OF ARTIFICIAL INTELLIGENCE
➢ THE STATE OF THE ART

WHAT IS AI?
categorizing AI in four parts.
1. Thinking Humanly
2. Thinking Rationally
3. Acting Humanly
4. Acting Rationally
Thinking Humanly Thinking Rationally
“The exciting new effort to make “The study of mental faculties
computers think ... machines with through the use of computational
minds, in the full and literal sense.” models.”
(Haugeland, 1985) (Charniak and McDermott, 1985)
“[The automation of] activities that “The study of the computations that
we associate with human thinking, make it possible to perceive, reason,
activities such as decision-making, and act.” (Winston, 1992)
problem solv- ing, learning .. .”
(Bellman, 1978)
Acting Humanly Acting Rationally
“The art of creating machines that “Computational Intelligence is the
per- form functions that require study of the design of intelligent
intelligence when performed by agents.” (Poole et al., 1998)
people.” (Kurzweil, 1990)
“The study of how to make “AI . . . is concerned with intelligent
computers do things at which, at the be- havior in artifacts.” (Nilsson,
moment, people are better.” (Rich 1998)
and Knight, 1991)
Figure 1.1 Some definitions of artificial intelligence, organized into
four categories.

we see eight definitions of AI, laid out along two dimensions.


• The definitions on top are concerned with thought processes and reasoning, whereas
the ones on the bottom address behavior.
• The definitions on the left measure success in terms of fidelity to human performance,
whereas the ones on the right measure against an ideal performance measure, called
rationality.
• A system is rational if it does the “right thing,” given what it knows.

Historically, all four approaches to AI have been followed, each by different people with
different methods.
A human-centered approach must be in part an empirical science, in- volving observations
and hypotheses about human behavior.
A rationalist approach involves a combination of mathematics and engineering. The various
group have both disparaged and helped each other.
Acting humanly: The Turing Test approach
The Turing Test, proposed by Alan Turing (1950), was designed to provide a satisfactory
operational definition of intelligence. A computer passes the test if a human interrogator, after
posing some written questions, cannot tell whether the written responses come from a person
or from a computer.
The computer would need to possess the following capabilities:
• natural language processing to enable it to communicate successfully in English;
• knowledge representation to store what it knows or hears;
• automated reasoning to use the stored information to answer questions and to draw
new conclusions;
• machine learning to adapt to new circumstances and to detect and extrapolate
patterns.
• computer vision to perceive objects, and
• robotics to manipulate objects and move about.
To pass the total Turing Test, the computer will need These six disciplines compose most of
AI, and Turing deserves credit for designing a test that remains relevant 60 years later.

Thinking humanly: The cognitive modeling 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:
1. Through introspection—trying to catch our own thoughts as they go by;
2. Through psychological experiments—observing a person in action; and
3. Through brain imaging—observing the brain in action.
Once we have a sufficiently precise theory of the mind, it becomes possible to express the
theory as a computer program.
If the program’s input–output behavior matches corresponding human behavior, that is
evidence that some of the program’s mechanisms could also be operating in humans.
The interdisciplinary field of cognitive science brings together computer models from AI and
experimental techniques from psychology to construct precise and testable theories of the
human mind.

Thinking rationally: The “laws of thought” approach


By 1965, programs existed that could, in principle, solve any solvable problem described in
logical notation. (Although if no solution exists, the program might loop forever.) The so-
called logicist tradition within artificial intelligence hopes to build on such programs to create
intelligent systems.
There are two main obstacles to this approach.
1. First, it is not easy to take informal knowledge and state it in the formal terms
required by logical notation, particularly when the knowledge is less than 100%
certain.
2. Second, there is a big difference between solving a problem “in principle” and solving
it in practice.
Even problems with just a few hundred facts can exhaust the computational resources of any
computer unless it has some guidance as to which reasoning steps to try first. Although both
of these obstacles apply to any attempt to build computational reasoning systems, they
appeared first in the logicist tradition

Acting rationally: The rational agent approach


A rational agent is one that acts so as to achieve the best outcome or, when there is
uncertainty, the best expected outcome.
In the “laws of thought” approach to AI, the emphasis was on correct inferences.
Making correct inferences is sometimes part of being a rational agent, because one way to act
rationally is to reason logically to the conclusion that a given action will achieve one’s goals
and then to act on that conclusion.
On the other hand, correct inference is not all of rationality; in some situations, there is no
provably correct thing to do, but something must still be done.
There are also ways of acting rationally that cannot be said to involve inference. For example,
recoiling from a hot stove is a reflex action that is usually more successful than a slower
action taken after careful deliberation.
All the skills needed for the Turing Test also allow an agent to act rationally. Knowledge
representation and reasoning enable agents to reach good decisions.
We need to be able to generate comprehensible sentences in natural language to get by in a
complex society.
We need learning not only for erudition, but also because it improves our ability to generate
effective behaviour.
The rational-agent approach has two advantages over the other approaches.
First, it is more general than the “laws of thought” approach because correct inference is just
one of several possible mechanisms for achieving rationality.
Second, it is more amenable to scientific development than are approaches based on human
behaviour or human thought. The standard of rationality is mathematically well defined and
completely general, and can be “unpacked” to generate agent designs that provably achieve
it. Human behaviour, on the other hand, is well adapted for one specific environment and is
defined by, well, the sum total of all the things that humans do.
THE FOUNDATIONS OF ARTIFICIAL INTELLIGENCE
The disciplines that contributed ideas, viewpoints,and techniques to AI.

Philosophy
• Can formal rules be used to draw valid conclusions?
• How does the mind arise from a physical brain?
• Where does knowledge come from?
• How does knowledge lead to action?
Philosophical inquiries into the nature of knowledge, reasoning, and action have laid the
groundwork for understanding how AI systems should operate. Thinkers like Aristotle,
Descartes, and Hobbes explored questions about formal reasoning, the relationship
between mind and body, and the sources of knowledge and action.

Mathematics
• What are the formal rules to draw valid conclusions?
• What can be computed?
• How do we reason with uncertain information?
Mathematics provided the formal tools necessary for reasoning and computation. From
the development of logic by Boole and Frege to the exploration of computability by
Turing, mathematical concepts formed the backbone of AI, enabling the understanding
of what can be computed and what problems are tractable or intractable.

Economics
• How should we make decisions so as to maximize payoff?
• How should we do this when others may not go along?
• How should we do this when the payoff may be far in the future?
Economic theories introduced the concept of decision-making under uncertainty and the
optimization of outcomes. Scholars like Walras, von Neumann, and Morgenstern laid the
foundation for decision theory and game theory, which have implications for rational
decision-making in AI agents.

Neuroscience
• How do brains process information?
The study of the nervous system, particularly the brain, has revealed much about how
information is processed.

Through the discovery of localized brain functions by scientists like Paul Broca and the
development of techniques like staining by Camillo Golgi, we've gained insight into the
structure and function of neurons. Advances in technology, such as electroencephalography
(EEG) and functional magnetic resonance imaging (fMRI), have furthered our understanding
of brain activity. However, the exact mechanisms of cognition and memory storage remain
elusive.

Psychology
• How do humans and animals think and act?
The origins of scientific psychology can be traced back to figures like Hermann von
Helmholtz and Wilhelm Wundt, who applied scientific methods to the study of human
behaviour. Behaviourism, led by John Watson, focused on observable behaviour’s rather than
subjective mental processes.
Cognitive psychology, influenced by William James and others, views the brain as an
information-processing device, emphasizing mental processes like perception and memory.

Computer engineering
• How can we build an efficient computer?
The development of computers, from early mechanical devices to modern electronic
systems, has revolutionized technology. Figures like Alan Turing and Konrad Zuse played key
roles in pioneering programmable computers. Moore's Law, which describes the doubling of
computer performance roughly every 18 months, has driven continuous advancements in
computing power.

Control theory and cybernetics


• How can artifacts operate under their own control?
Concepts of self-regulating feedback systems, pioneered by individuals like Norbert Wiener
and W. Ross Ashby, have contributed to the development of control theory and cybernetics.
These fields explore how artifacts can operate autonomously under their own control,
drawing parallels between mechanical and biological systems.

Linguistics
• How does language relate to thought?
Noam Chomsky's critique of behaviorist theories of language learning in the 1950s led to the
emergence of modern linguistics. Chomsky's syntactic models, rooted in formal grammatical
structures, challenged behaviorist ideas and paved the way for computational linguistics.
Understanding language involves more than just syntax—it requires context and subject
matter knowledge, highlighting the complexity of natural language processing.

Overall, the interdisciplinary nature of AI draws from a rich tapestry of knowledge, combining
insights from philosophy, mathematics, economics, and neuroscience, cybernetics, linguistics
to create intelligent systems capable of reasoning, learning, and decision-making.
contributing to our understanding of the human mind, the development of artificial
intelligence, and the advancement of technology.

THE HISTORY OF ARTIFICIAL INTELLIGENCE


In the early 1940s and 1950s, pioneers like Warren McCulloch, Walter Pitts, and Donald
Hebb laid the groundwork for artificial intelligence (AI) by proposing models of artificial
neurons and demonstrating simple learning rules.
Meanwhile, Alan Turing's vision, articulated in his 1950 article, introduced concepts like
machine learning, genetic algorithms, and reinforcement learning, along with the famous
Turing Test.
The birth of AI as a field is often credited to the 1956 Dartmouth Conference organized by
John McCarthy, where prominent researchers like Marvin Minsky, Claude Shannon, and
Herbert Simon gathered. This conference marked the beginning of organized efforts to study
and develop AI systems. Allen Newell and Herbert Simon's Logic Theorist, which proved
theorems in symbolic logic, and later the General Problem Solver (GPS), showcased early
successes in AI research.
The 1950s and 1960s saw significant developments, including the invention of Lisp by
McCarthy, the first high-level programming language widely used in AI.
McCarthy also introduced the concept of the Advice Taker, an early attempt at a
comprehensive AI system capable of reasoning and problem-solving using general
knowledge.
At MIT, McCarthy and Minsky made important contributions, but their approaches diverged.
McCarthy emphasized logical reasoning, while Minsky focused on practical problem-solving
and developed the concept of microworlds—limited domains that required intelligent
solutions.
Examples include James Slagle's SAINT program for calculus integration and Tom Evans's
ANALOGY program for solving geometric analogy problems.
Overall, this period saw rapid progress and enthusiasm for AI, with researchers making
foundational contributions that laid the groundwork for future advancements in the field.

Evolution of Artificial Intelligence (AI) from its early days to the present, highlighting key
developments, challenges, and shifts in focus within the field.

1. Blocks World and Early AI Pioneers: The blocks world served as a foundational
microworld for AI research, with notable contributions from David Huffman, David Waltz,
Patrick Winston, Terry Winograd, and Scott Fahlman. Early work on neural networks, such
as perceptrons and adalines, laid the groundwork for subsequent research.
Blue

Red
Red Green

Green Blue

Green

Figure :

2. Dose of Reality (1966–1973): Early optimism about AI's potential gave way to
recognition of significant challenges, including the need for domain-specific knowledge
and the limitations of early problem-solving approaches.
3. Knowledge-Based Systems (1969–1979): The emergence of knowledge-based systems,
exemplified by projects like DENDRAL and MYCIN, demonstrated the importance of
domain-specific knowledge for solving complex problems.
4. AI Becomes an Industry (1980–present): The 1980s saw the commercialization of AI
with the development of expert systems. However, the period was followed by an "AI
Winter" characterized by unmet expectations and financial setbacks.
5. The Return of Neural Networks (1986–present): Neural networks experienced a
resurgence in the mid-1980s with the rediscovery of back-propagation. Connectionist
models offered an alternative to symbolic AI approaches, leading to advancements in
machine learning and data mining.
6. AI Adopts the Scientific Method (1987–present): AI shifted towards a more rigorous
and empirical approach, embracing existing theories and methodologies from fields like
control theory and statistics.
7. The Emergence of Intelligent Agents (1995–present): Research shifted towards
building complete agent architectures, with applications expanding to internet-based
systems. Efforts towards Human-Level AI (HLAI) and Artificial General Intelligence (AGI)
gained traction.
8. The Availability of Very Large Data Sets (2001–present): Recent AI research has
focused on leveraging large datasets to train algorithms, leading to breakthroughs in
areas like natural language processing and computer vision.

Overall, the history of AI reflects a progression from early optimism and experimentation to a
more grounded and methodical approach, driven by advancements in technology and a deeper
understanding of the challenges involved in creating intelligent systems.

THE STATE OF THE ART


What can AI do today? Here we sample a few applications;
several contemporary applications of artificial intelligence (AI) across various domains:

1. Robotic Vehicles: Examples include STANLEY, a driverless car that won the
DARPA Grand Challenge in 2005, and CMU's BOSS, which won the Urban
Challenge the following year. These vehicles use sensors and onboard software for
navigation and obstacle avoidance.
2. Speech Recognition: Automated systems, like those used by United Airlines for
booking flights, employ speech recognition and dialog management to interact with
users over the phone.
3. Autonomous Planning and Scheduling: Programs like NASA's Remote Agent and
its successors, such as MAPGEN and MEXAR2, autonomously plan and schedule
spacecraft operations, including logistics and science planning for missions to Mars.
4. Game Playing: IBM's DEEP BLUE defeated world chess champion Garry Kasparov
in 1997, marking a significant milestone in AI's ability to excel in complex strategic
games.
5. Spam Fighting: Learning algorithms are employed to classify spam messages,
helping users filter out unwanted emails efficiently.
6. Logistics Planning: Systems like Dynamic Analysis and Replanning Tool (DART)
automate logistics planning and scheduling for large-scale operations, such as military
deployments, resulting in significant time savings.
7. Robotics: iRobot's Roomba robotic vacuum cleaners and PackBot deployed in
conflict zones demonstrate AI's role in household chores and hazardous tasks like
bomb disposal.
8. Machine Translation: Programs utilizing statistical models and machine learning
algorithms translate text between languages, facilitating communication across
linguistic barriers.

These examples illustrate the practical applications of AI in solving real-world problems,


showcasing the integration of science, engineering, and mathematics in developing intelligent
systems. Additionally, the text emphasizes the transition of AI from science fiction to
tangible technologies grounded in scientific principles and methodologies.

INTELLIGENT AGENTS
➢ AGENTS AND ENVIRONMENTS
➢ GOOD BEHAVIOUR: CONCEPT OF RATIONALITY
➢ NATURE OF ENVIRONMENTS
➢ THE STRUCTURE OF AGENTS

AGENTS AND ENVIRONMENTS


An agent is anything that can be viewed as perceiving its environment through sensors and acting

upon that environment through actuators. This simple idea is illustrated in Figure

Agent Sensors
Percepts

Actions
Actuators

Figure 2.1 Agents interact with environments through sensors and actuators.

human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract, and so
on 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.
We use the term percept to refer to the agent’s perceptual inputs at any given instant. An
agent’s percept sequence is the complete history of everything the agent has ever perceived.
In general, an agent’s choice of action at any given instant can depend on the entire percept
sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s
choice of action for every possible percept sequence, we have said more or less everything
there is to say about the agent. Mathematically speaking, we say that an agent’s behavior is described
by the agent function that maps any given percept sequence to an action.
can imagine tabulating the agent function that describes any given agent; for mostagents, this
would be a very large table—infinite, in fact, unless we place a bound on the length of percept
sequences we want to consider. Given an agent to experiment with, we can,in principle, construct this
table by trying out all possible percept sequences and recording which actions the agent does in
response.1 The table is, of course, an external characterization of the agent. 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, runningwithin some physical system.
To illustrate these ideas, we use a very simple example—the vacuum-cleaner world shown in Figure
2.2.

Figure 2.2 A vacuum-cleaner world with just two locations.

The 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,
thensuck; otherwise, move to the other square. A partial tabulation of this agent function is shownin
Figure 2.3
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
. .
Figure 2.3 Partial tabulation of a simple agent function for the vacuum-cleaner world
shown in Figure 2.2.

GOOD BEHAVIOUR: CONCEPT OF RATIONALITY


A rational agent is one that does the right thing—conceptually speaking, every entry in the
table for the agent function is filled out correctly. Obviously, doing the right thing is better
than doing the wrong thing, but what does it mean to do the right thing?
We answer this age-old question in an age-old way: by considering the consequences of the
agent’s behavior. When an agent is plunked down in an environment, it generates a sequence
of actions 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. This notion of desirability is captured by a performance measure that
evaluates any given sequence of environment states.
2.1.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.
This leads to a definition of a 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.

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

rationality is not the same as perfection. Rationality max- imizes expected performance, while
perfection maximizes actual performance.

rational agent not only to gather information but also to learnas much as possible from what it
perceives. The agent’s initial configuration could reflect some prior knowledge of the environment,
but as the agent gains experience this may be modified and augmented. There are extreme cases in
which the environment is completely known a priori. In such cases, the agent need not perceive or
learn; it simply acts correctly.

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 knowl-edge.

NATURE OF ENVIRONMENTS
task environments, which are essentially the “problems” to which rational agents are the “solutions.”
We begin by showing howto specify a task environment, illustrating the process with a number of
examples. We then show that task environments come in a variety of flavors. The flavor of the task
environmentdirectly affects the appropriate design for the agent program.

2.1.3 Specifying the task environment


Agent Type Performance Environment Actuators Sensors
Measure
Taxi driver Safe, fast, legal, Roads, other Steering, Cameras, sonar,
comfortable trip, traffic, accelerator, speedometer,
maximize profits pedestrians, brake, signal, GPS, odometer,
customers horn, display accelerometer,
engine sensors,
keyboard

Figure 2.4 PEAS description of the task environment for an automated taxi.

2.1.1 Properties of task environments


PEAS (Performance, Environment, Actuators, Sensors) description. In designing anagent, the first step
must always be to specify the task environment as fully as possible

Agent Type Performance Environment Actuators Sensors


Measure

Medical Healthy patient, Patient, hospital, Display of Keyboard entry


diagnosis system reduced costs staff questions, tests, of symptoms,
diagnoses, findings, patient’s
treatments, answers
referrals

Satellite image Correct image Downlink from Display of scene Color pixel
analysis system categorization orbiting satellite categorization arrays

Part-picking Percentage of Conveyor belt Jointed arm and Camera, joint


robot parts in correct with parts; bins hand angle sensors
bins

Refinery Purity, yield, Refinery, Valves, pumps, Temperature,


controller safety operators heaters, displays pressure,
chemical sensors

Interactive Student’s score Set of students, Display of Keyboard entry


English tutor on test testing agency exercises,
suggestions,
corrections

Figure 2.5 Examples of agent types and their PEAS descriptions.

Task Environment Observable Agents Deterministic Episodic Static Discrete


Crossword puzzle Fully Single Deterministic Sequential Static Discrete
Chess with a clock Fully Multi Deterministic Sequential Semi Discrete
Poker Partially Multi Stochastic Sequential Static Discrete
Backgammon Fully Multi Stochastic Sequential Static Discrete
Taxi driving Partially Multi Stochastic Sequential Dynamic Continuous
Medical diagnosis Partially Single Stochastic Sequential Dynamic Continuous
Image analysis Fully Single Deterministic Episodic Semi Continuous
Part-picking robot Partially Single Stochastic Episodic Dynamic Continuous
Refinery controller Partially Single Stochastic Sequential Dynamic Continuous
Interactive English tutor Partially Multi Stochastic Sequential Dynamic Discrete
Figure 2.6 Examples of task environments and their characteristics.

T HE S TRUCTURE OF AGENTS
The job of AI is to design an agent program that implements the agent function— the mapping from
percepts to actions. We assume this program will run on some sort of computing device with physical
sensors and actuators—we call this the architecture:
agent = architecture + program

2.1.1 Agent programs


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.

2.1.4 Simple reflex agents

Agent Sensors

What the
worldis like
now

Condition-action rules What action I


should do now

Actuators

Figure 2.9 Schematic diagram of a simple reflex agent.

function SIMPLE-REFLEX-AGENT( percept ) returns an action


persistent: rules, a set of condition–action rules
state ← INTERPRET-INPUT( percept )
rule ← RULE-MATCH(state, rules)
action ← rule.ACTION
return action

Figure 2.10 A simple reflex agent. It acts according to a rule whose condition matches
the current state, as defined by the percept.
2.1.5 Model-based reflex agents
3 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.

SOLVING PROBLEMS BY SEARCHING


P ROBLEM -S OLVING AGENTS
1. Goal Formulation: Intelligent agents maximize their performance by adopting goals.
Goals help in organizing behavior by narrowing down objectives and actions to
consider. The process involves defining a set of world states in which the goal is
satisfied.
2. Problem Formulation: Problem formulation is essential for deciding which actions
and states to consider in achieving the goal. It involves selecting actions at an
appropriate level of abstraction to navigate through the environment efficiently.
3. Example in Romania: Illustrated with an example of a tourist in Romania, where the
goal is to reach Bucharest. Problem formulation involves considering actions at the
level of driving from one major town to another.
4. Environment Assumptions: Assumptions about the environment include
observability, discreteness, knowledge, and determinism. These assumptions facilitate
the process of finding a sequence of actions that lead to the goal.
5. Search and Execution: Search algorithms are used to find solutions to problems by
determining sequences of actions. Once a solution is found, the agent executes it to
guide its actions. This follows a "formulate, search, execute" design.
6. Open-Loop System: During execution, the agent ignores percepts as it knows in
advance what they will be. This represents an open-loop system, where the agent's
actions are determined without feedback from the environment.
7. Problem Solving Process: The process involves problem formulation, search for
solutions, and execution of the found solution. This iterative process allows the agent
to continually pursue and achieve its goals.

These points highlight the importance of goal and problem formulation in guiding intelligent
agent behavior towards achieving desired outcomes efficiently.

Uninformed Search Algorithms:


What is the Uninformed Search?

Uninformed search, also known as blind search, is a search algorithm that

explores a problem space without any specific knowledge or information about


the problem other than the initial state and the possible actions to take. It lacks

domain-specific heuristics or prior knowledge about the problem. Uninformed

search algorithms, such as breadth-first search and depth-first search,

systematically explore the search space by applying predefined rules to generate

successor states until a goal state is found or the search is exhausted. These

algorithms are typically less efficient than informed search algorithms but can be

useful in certain scenarios or as a basis for more advanced search techniques.

Types of Uninformed Search Algorithms

The different types of uninformed search algorithms used in AI are as follows:

• Depth First Search

• Breadth-First Search

• Depth Limited Search

• Uniform Cost Search

• Iterative Deepening Depth First Search

• Bidirectional Search (if applicable)

But before we go into these search types and you go a step further wandering

into any Artificial Intelligence course, let’s get to know the few terms which will be

frequently used in the upcoming sections.

State: It provides all the information about the environment.

Goal State: The desired resulting condition in a given problem and the kind of

search algorithm we are looking for.


Goal Test: The test to determine whether a particular state is a goal state.

Path/Step Cost: These are integers that represent the cost to move from one

node to another node.

Space Complexity: A function describing the amount of space(memory) an

algorithm takes in terms of input to the algorithm.

Time Complexity: A function describing the amount of time the algorithm takes

in terms of input to the algorithm.

Optimal: Extent of preference of the algorithm

‘b‘ – maximum branching factor in a tree.

‘d‘ – the depth of the least-cost solution.

‘m‘ – maximum depth state space(maybe infinity)

Now let’s dive deep into each type of algorithm.

Depth First Search (DFS)

It is a search algorithm where the search tree will be traversed from the root

node. It will be traversing, searching for a key at the leaf of a particular branch. If

the key is not found, the searcher retraces its steps back (backtracking) to the

point from where the other branch was left unexplored, and the same procedure

is repeated for that other branch.


The above image clearly explains the DFS Algorithm. First, the search technique

starts from the root node A and then goes to the branch where node B is present

(lexicographical order). Then it goes to node D because of DFS, and from D,

there is only one node to traverse, i.e., node H. But after node H does not have

any child nodes, we retrace the path in which we traversed earlier and again

reach node B, but this time, we traverse through in the untraced path a traverse

through node E. There are two branches at node E, but let’s traverse node I

(lexicographical order) and then retrace the path as we have no further number

of nodes after E to traverse. Then we traverse node J as it is the untraced

branch and then again find we are at the end and retrace the path and reach

node B and then we will traverse the untraced branch, i.e., through node C, and

repeat the same process. This is called the DFS Algorithm.


Advantages

• DFS requires very little memory as it only needs to store a stack of the nodes on

the path from the root node to the current node.

• It takes less time to reach the goal node than the BFS algorithm [which is

explained later](if it traverses in the right path).

Disadvantages

• There is the possibility that many states keep reoccurring, and there is no

guarantee of finding a solution.

• The DFS algorithm goes for deep-down searching, and sometimes it may go to

the infinite loop.

Verdict

It occupies a lot of memory space and time to execute when the solution is at the

bottom or end of the tree and is implemented using the LIFO Stack data

structure[DS].

• Complete: No

• Time Complexity: O(bm)

• Space complexity: O(bm)

• Optimal: Yes
Breadth-First Search (BFS)

This is another graph search algorithm in AI that traverses breadthwise to search

for the goal in a tree. It begins searching from the root node and expands the

successor node before expanding further along breadthwise and traversing those

nodes rather than searching depth-wise.

The above figure is an example of a BFS Algorithm. It starts from the root node A

and then traverses node B. Till this step, it is the same as DFS. But here, instead

of expanding the children of B as in the case of DFS, we expand the other child

of A, i.e., node C because of BFS, and then move to the next level and traverse

from D to G and then from H to K in this typical example. To traverse here, we

have only taken into consideration the lexicographical order. This is how the BFS

Algorithm is implemented.
Advantages

• BFS will provide a solution if any solution exists.

• If there is more than one solution for a given problem, then BFS will provide the

minimal solution which requires the least number of steps.

Disadvantages

• It requires lots of memory since each level of the tree must be saved in memory

to expand to the next level.

• BFS needs lots of time if the solution is far away from the root node.

Verdict

It requires a lot of memory space and is time-consuming if the goal state is at the

bottom or end. It uses a FIFO queue DS to implement.

• Complete: Yes (assuming b is finite)

• Time Complexity: O(bd)

• Space complexity: O(bd)

• Optimal: Yes, if step cost = 1 (i.e., no cost/all step costs are same)
Uniform Cost Search Algorithm (UCS)

Uniform Cost Search (UCS) is a graph traversal and search algorithm used in the

field of artificial intelligence and computer science. UCS is an informed search

algorithm that explores a graph by gradually expanding nodes starting from the
initial node and moving towards the goal node while considering the cost

associated with each edge or step.

This algorithm is mainly used when the step costs are not the same, but we need

the optimal solution to the goal state. In such cases, we use Uniform Cost

Search to find the goal and the path, including the cumulative cost to expand

each node from the root node to the goal node. It does not go depth or breadth.

It searches for the next node with the lowest cost, and in the case of the same

path cost, let’s consider lexicographical order in our case.

In the above figure, consider S to be the start node and G to be the goal state.

From node S we look for a node to expand, and we have nodes A and G, but

since it’s a uniform cost search, it’s expanding the node with the lowest step

cost, so node A becomes the successor rather than our required goal node G.

From A we look at its children nodes B and C. Since C has the lowest step cost,

it traverses through node C. Then we look at the successors of C, i.e., D and G.

Since the cost to D is low, we expand along with node D. Since D has only one

child G which is our required goal state we finally reach the goal state D by
implementing UFS Algorithm. If we have traversed this way, definitely our total

path cost from S to G is just 6 even after traversing through many nodes rather

than going to G directly where the cost is 12 and 6<<12(in terms of step cost).

But this may not work with all cases.

Advantages

• Uniform cost search is an optimal search method because at every state, the

path with the least cost is chosen.

Disadvantages

• It does not care about the number of steps or finding the shortest path involved

in the search problem, and it is only concerned about path cost. This algorithm

may be stuck in an infinite loop.

Verdict

• Complete: Yes (if b is finite and costs are stepped, costs are zero)

• Time Complexity: O(b(c/ϵ)) where, ϵ -> is the lowest cost, c -> optimal cost

• Space complexity: O(b(c/ϵ))

• Optimal: Yes (even for non-even cost)

Depth Limited Search (DLS)

DLS is an uninformed search algorithm. This is similar to DFS but differs only in

a few ways. The sad failure of DFS is alleviated by supplying a depth -first search

with a predetermined depth limit. That is, nodes at depth are treated as if they

have no successors. This approach is called a depth-limited search. The depth


limit solves the infinite-path problem. Depth-limited search can be halted in two

cases:

1. Standard Failure Value (SFV): The SFV tells that there is no solution to the

problem.

2. Cutoff Failure Value (CFV): The Cutoff Failure Value tells that there is no solution

within the given depth limit.

The above figure illustrates the implementation of the DLS algorithm. Node A is

at Limit = 0, followed by nodes B, C, D, and E at Limit = 1 and nodes F, G, and H

at Limit = 2. Our start state is considered to be node A, and our goal state is

node H. To reach node H, we apply DLS. So in the first case, let’s set our limit to

0 and search for the goal.

Since limit 0, the algorithm will assume that there are no children after limit 0

even if nodes exist further. Now, if we implement it, we will traverse only node A

as there is only one node in limit 0, which is basically our goal state. If we use

SFV, it says there is no solution to the problem at limit 0, whereas LCV says

there is no solution for the problem until the set depth limit. Since we could not

find the goal, let’s increase our limit to 1 and apply DFS till limit 1, even though
there are further nodes after limit 1. But those nodes aren’t expanded as we have

set our limit as 1.

Hence nodes A, followed by B, C, D, and E, are expanded in the mentioned

order. As in our first case, if we use SFV, it says there is no solution to the

problem at limit 1, whereas LCV says there is no solution for the problem until

the set depth limit 1. Hence we again increase our limit from 1 to 2 in the notion

to find the goal.

Till limit 2, DFS will be implemented from our start node A and its children B, C,

D, and E. Then from E, it moves to F, similarly backtracks the path, and explores

the unexplored branch where node G is present. It then retraces the path and

explores the child of C, i.e., node H, and then we finally reach our goal by

applying DLS Algorithm. Suppose we have further successors of node F but only

the nodes till limit 2 will be explored as we have limited the depth and have

reached the goal state.


This image explains the DLS implementation and could be referred to for better

understanding.

Depth-limited search can be terminated with two Conditions of failure:

1. Standard Failure: it indicates that the problem does not have any solutions.

2. Cutoff Failure Value: It defines no solution for the problem within a given depth

limit.

Advantages

• Depth-limited search is Memory efficient.

Disadvantages

• The DLS has disadvantages of completeness and is not optimal if it has more

than one goal state.

Verdict

• Complete: Complete (if solution > depth-limit)

• Time Complexity: O(bl) where, l -> depth-limit

• Space complexity: O(bl)

• Optimal: Yes (only if l > d)

Iterative Deepening Depth First Search (IDDFS)

It is a search algorithm that uses the combined power of the BFS and DFS

algorithms. It is iterative in nature. It searches for the best depth in each

iteration. It performs the Algorithm until it reaches the goal node. The algorithm is
set to search until a certain depth and the depth keeps increasing at every

iteration until it reaches the goal state.

In the above figure, let’s consider the goal node to be G and the start state to be

A. We perform our IDDFS from node A. In the first iteration, it traverses only

node A at level 0. Since the goal is not reached, we expand our nodes, go to the

next level, i.e., 1 and move to the next iteration. Then in the next iteration, we

traverse the node A, B, and C. Even in this iteration, our goal state is not

reached, so we expand the node to the next level, i.e., 2, and the nodes are

traversed from the start node or the previous iteration and expand the nodes A,

B, C, and D, E, F, G. Even though the goal node is traversed, we go through for

the next iteration, and the remaining nodes A, B, D, H, I, E, C, F, K, and G(BFS

& DFS) too are explored, and we find the goal state in this iteration. This is the

implementation of the IDDFS Algorithm.

Advantages

• It combines the benefits of BFS and DFS search algorithms in terms of fast

search and memory efficiency.


Disadvantages

• The main drawback of IDDFS is that it repeats all the work from the previous

phase.

Verdict

• Complete: Yes (by limiting the depth)

• Time Complexity: O(bd)

• Space complexity: O(bd)

• Optimal: Yes (if step cost is uniform)

• Systematic: It’s not systematic.

Bidirectional Search (BS)

Before moving into bidirectional search, let’s first understand a few terms.

Forward Search: Looking in front of the end from the start.

Backward Search: Looking from end to the start backward.

So Bidirectional Search, as the name suggests, is a combination of forwarding

and backward search. Basically, if the average branching factor going out of

node / fan-out, if fan-out is less, prefer forward search. Else if the average

branching factor going into a node/fan-in is less (i.e., fan-out is more), prefer

backward search. We must traverse the tree from the start node and the goal

node, and wherever they meet, the path from the start node to the goal through

the intersection is the optimal solution. The BS Algorithm is applicable when


generating predecessors is easy in both forward and backward directions, and

there exist only 1 or fewer goal states.

This figure provides a clear-cut idea of how BS is executed. We have node 1 as

the start/root node and node 16 as the goal node. The algorithm divides the

search tree into two sub-trees. So from the start of node 1, we do a forward

search, and at the same time, we do a backward search from goal node 16. The

forward search traverses nodes 1, 4, 8, and 9, whereas the backward search

traverses through nodes 16, 12, 10, and 9. We see that both forward and

backward search meets at node 9, called the intersection node. So the total path

traced by forwarding search and the path traced by backward search is the

optimal solution. This is how the BS Algorithm is implemented.


Advantages

• Since BS uses various techniques like DFS, BFS, DLS, etc., it is efficient and

requires less memory.

Disadvantages

• Implementation of the bidirectional search tree is difficult.

• In bidirectional search, one should know the goal state in advance.

Verdict

• Complete: Yes

• Time Complexity: O(bd/2)

• Space complexity: O(bd/2)

• Optimal: Yes (if step cost is uniform in both forward and backward directions)

Final Interpretations

The Uninformed Search strategy for searching is a multipurpose strategy that

combines the power of unguided search and works in a brute-force way. The

algorithms of this strategy can be applied to a variety of problems in computer

science as they don’t have the information related to state space and target

problems, and they do not know how to traverse trees.


Conclusion

This is the complete analysis of all the Uninformed Search Strategies. Each

search algorithm is no less than the other, and we can use any one of the search

strategies based on the problem. The term ‘uninformed’ means that they do not

have any additional information about states or state space. Thus we conclude

“uninformed algorithm” is an algorithm that doesn’t use any prior knowledge or

heuristics to solve a problem.

Key Takeaways

• Uninformed algorithms are used in search problems, where the goal is to find a

solution by exploring a large search space.

• Uninformed algorithms are often simple to implement and can be effective in

solving certain problems, but they may also be less efficient than informed

algorithms that use heuristics to guide their search.


Informed Search

What is Informed Search?


Informed search is a type of search algorithm in artificial intelligence that uses
additional information or heuristics to make more accurate decisions about which
paths to explore first. These heuristics provide estimates of how close a given state
is to the goal, guiding the search toward more promising solutions. Informed search
is particularly useful in solving complex problems efficiently, as it can significantly
reduce the search space and improve the speed of finding solutions.

Informed search algorithms can quickly reject irrelevant or less promising


alternatives, allowing the search to concentrate on the most reliable options, by
employing domain-specific knowledge to drive the search. Heuristics are used by
these kinds of AI search algorithms to increase the search’s effectiveness and
speed.

Don’t let data remain untapped potential. Enroll in our Artificial


Intelligence course and equip yourself with the skills to extract meaningful
patterns and knowledge from data.

What is the Need for Informed Search?


The need for informed search in artificial intelligence arises from several key factors
that make it a valuable approach for solving problems efficiently and effectively. Here
are some of the primary reasons why an informed search is essential:

• Domain Knowledge: Heuristics are a type of domain-specific knowledge that may be


used in informed search algorithms. With this information, the search process can be
directed in ways that are not possible with blind search techniques. For example, a
heuristic based on real-time traffic information can help avoid busy routes while
planning a trip.
• Pattern Recognition: In order to find patterns or characteristics in data more
effectively, informed search can be utilized in pattern recognition tasks. Heuristic-guided
search, for example, can enhance model training and feature selection in machine
learning.
• Efficiency: In general, informed search algorithms beat blind (uninformed) search
algorithms in terms of efficiency. They may reduce the search space and frequently find
solutions more rapidly by making well-informed selections about which paths to look at
first using heuristic knowledge. This effectiveness is crucial in general, complicated
problem fields.
• Complex Decision Making: Applications that require complicated decision-making
processes, such as playing games (like chess or go), are helped by informed search.
Machine learning robots can analyze future moves and strategies more effectively with
the use of heuristic knowledge.
• Problem Complexity: Many issues in the real world have large search areas and are
very difficult. Thanks to informed search, AI systems can more successfully navigate
these complex topographies by concentrating on the most promising areas. Blind
search algorithms might have trouble finding answers in an appropriate amount of time
without heuristics.

Heuristic Function

A heuristic function is a strategy for solving problems by determining the cost or


distance to a goal state in a search problem by making a “best guess” or using a rule
of thumb. A search algorithm can be directed in the right direction by using the
heuristic function, which calculates how far the objective state is from the present
state.

These features are used by intelligent search engines as an extra source of data to
decide which course to take. Heuristic functions are crucial in informed search
algorithms for this reason.

Example:
A player can begin the game of tic tac toe from a variety of positions, and each
position has a different chance of winning. The first player, however, has the best
chance of succeeding if they begin from the middle of the board. As a result, winning
chances can be used as a heuristic.

Pure Heuristic Function: The most basic type of heuristic search algorithm is pure
heuristic search. Nodes are expanded according to their heuristic value, h(n). It
keeps an OPEN list and a CLOSED list. It lists the nodes that have already
expanded in the CLOSED list and the nodes that haven’t expanded yet in the OPEN
list.

Each node n with the lowest heuristic value is expanded, producing all of its children,
and then n is added to the closed list. The algorithm keeps running until a goal state
is found.

The admissibility of the Heuristic function is given as


h(n) <= h*(n)

Here h(n) is the Heuristic cost, and h*(n) is the estimated cost. Hence, the heuristic
cost should be less than or equal to the estimated cost.

Best First Search

The path that appears to be the best at the time is always chosen by the greedy
best-first search algorithm. It combines techniques like depth-first search and
breadth-first search. It uses search and the heuristic function. We can benefit from
both algorithms’ advantages by using best-first search. We can select the most
promising node at each stage using a best-first search. The node that is nearest to
the goal node is expanded using the best first search technique, and the closest cost
is calculated using a heuristic function.

We expand the node that is closest to the goal node, and the closest cost is
estimated by a Heuristic function, i.e. f(n)= h(n).

Where, h(n)= estimated cost from node n to the goal.


Steps to perform in this algorithm:

• Step 1: The initial node should first be added to the OPEN list.
• Step 2: Stop and return failure if the OPEN list is empty.
• Step 3: Move the node n that has the lowest h(n) value out of the OPEN list and into the
CLOSED list.
• Step 4: Generate the successors of node n and expand node n.
• Step 5: Determine whether or not each successor of node n is a goal node. Return
success and end the search if any successor node is the goal node; otherwise, move on
to Step 6.
• Step 6: The method examines each successor node for the evaluation function f(n)
before determining whether it has ever been in the OPEN or CLOSED list. Add the node
to the OPEN list if it hasn’t already been there.
• Step 7: Return to Step 2.

Example:

Certainly, let’s use the Best-First Search algorithm with the given heuristic values for
nodes S, A, B, C, D, H, F, G, and E. We’ll explore how the algorithm works based on
these heuristics.

Here’s a table representing the nodes and their heuristic values:


Node Heuristic Value

S 10

A 9

B 7

C 8

D 8

H 6

F 6

G 3

E 0
Initialization:

Start with the initial state, which is node S.

Add S to the open list with a heuristic value of 10.

Node Expansion:

The algorithm selects the node from the open list with the lowest heuristic value. In
this case, it’s node B with a heuristic value of 7.

Expand node B and generate its successors (nodes H and A).

Add H and A to the open list with heuristic values of 6 and 9, respectively.

Continued Expansion:

The algorithm selects node H from the open list with a heuristic value of 6.

Expand node H and generate its successor G.

Add G to the open list with a heuristic value of 3.

Further Expansion:

The algorithm selects node G from the open list with a heuristic value of 3.

Expand node G and generate its successor E.

Add E to the open list with a heuristic value of 0.

Goal Reached:

The algorithm terminates upon reaching the goal state, which is node E with a
heuristic value of 0.

Result: The correct path found by the Best-First Search algorithm based on the
given heuristic values is indeed S -> B -> H -> G -> E.
A* Search

A* search is the most commonly known form of best-first search. The heuristic
function h(n), along with the distance from the initial state g(n) to the node n, is used.
Due to the combination of UCS and greedy best-first search features, the issue is
effectively solved. Using the heuristic function, the A* search method locates the
shortest route through the search space. This search algorithm produces the best
results more quickly and extends the search tree a little less. In contrast to UCS, the
A* algorithm utilizes g(n)+h(n) instead of g(n).

We use both the search heuristic and the node-reach cost in the A* search method.
Therefore, we can add both costs as follows; this total is known as the fitness
number.

f(n)=g(n)+h(n)

Steps to perform in this algorithm:

• Step 1: Place the beginning node in the OPEN list as the first step.
• Step 2: Verify whether or not the OPEN list is empty; if it is, return failure and stop.
• Step 3: Choose the node from the OPEN list that has the evaluation function (g+h) with
the least value. Return success and stop if node n is the destination node; otherwise,
continue.
• Step 4: Generate all of the successors for node n, expand it, and add it to the closed
list. Check to see if each successor, n’, is already in the OPEN or CLOSED list before
computing its evaluation function and adding it to the Open list.
• Step 5: If node n’ is not already in OPEN or CLOSED, it should be attached to the back
pointer, which represents the value with the lowest g(n’) value.
• Step 6: Return to Step 2 in Step 6.

Example: Given the heuristic values and distances between nodes, let’s use the A*
algorithm to find the optimal path from node S to node G.

Here’s the table representing the nodes, their heuristic values, and the distances
between nodes:
Node Heuristic Value

S 5

A 3

B 4

C 2

D 6

G 0

Initialization:

Start with the initial state, which is node S.

Create an open list and add S to it with a cost of 0 (initial cost) and a heuristic value
of 5 (estimated cost to reach G).

Node Expansion:
The algorithm selects the node from the open list with the lowest cost + heuristic
value. In this case, it’s node S with a cost of 0 + 5 = 5.

Expand node S and generate its successor nodes A and G.

Calculate the cost to reach A and G and add them to the open list.

Continued Expansion:

The algorithm selects node A from the open list with a cost of 1 (cost to reach A) + 3
(heuristic value of A) = 4.

Expand node A and generate its successor node C.

Calculate the cost to reach C and add it to the open list.

Goal Reached:

The algorithm terminates upon reaching the goal state, which is node G with a cost
of 10 (cost to reach G) + 0 (heuristic value of G).

Result:

The A* algorithm finds the optimal path from node S to node G: S -> A -> C -> G.
This path has the lowest cost among all possible paths, considering both the actual
distance and the heuristic values.

In this example, the A* algorithm efficiently finds the optimal solution, and the optimal
path is indeed S -> A -> C -> G with a cost of 10.

UNIT – II
Syllabus:
Problem Solving by Search-II and Propositional Logic:
Adversarial Search: Games, Optimal Decisions in Games, Alpha–Beta Pruning,
Imperfect Real-Time Decisions.
Constraint Satisfaction Problems: Defining Constraint Satisfaction Problems,
Constraint Propagation, Backtracking Search for CSPs, Local Search for CSPs, The
Structure of Problems.
Propositional Logic: Knowledge-Based Agents, The Wumpus World, Logic,
Propositional Logic,
Propositional Theorem Proving: Inference and proofs, Proof by resolution,
Horn clauses and definite clauses,
Forward and backward chaining,
Effective Propositional Model Checking,
Agents Based on Propositional Logic.
UNIT - III

Logic and Knowledge Representation

First-Order Logic: Representation, Syntax and Semantics of First-Order Logic, Using First-
Order Logic, Knowledge Engineering in First-Order Logic.

Inference in First-Order Logic: Propositional vs. First-Order Inference, Unification and


Lifting, Forward Chaining, Backward Chaining, Resolution.

Knowledge Representation: Ontological Engineering, Categories and Objects, Events.


Mental Events and Mental Objects,

Reasoning Systems for Categories, Reasoning with Default Information.

Introduction
Introduction
• How a knowledge-based agent could represent the world in which it operates and deduce
what actions to take showed.
• Propositional logic is used as our representation language because it sufficed to illustrate
the basic concepts of logic and knowledge- based agents. • Propositional logic is too puny a
language to represent knowledge of complex environments in a concise way. • First-order
logic, is sufficiently expressive to represent a good deal of our commonsense knowledge. • It
also either subsumes or forms the foundation of many other representation languages and
has been studied intensively for many decades. 6
• First-order logic is also known as Predicate logic or First-order predicate logic. First-order
logic is a powerful language that develops information about the objects in a more easy
way and can also express the relationship between those objects. 7
8
Inference engine: • The inference engine is the component of the intelligent system in
artificial intelligence, which applies logical rules to the knowledge base to infer new
information from known facts. The first inference engine was part of the expert system.
Inference engine commonly proceeds in two modes, which are: • Forward chaining •
Backward chaining 9
A. Forward Chaining • Forward chaining is also known as a forward deduction or forward
reasoning method when using an inference engine. Forward chaining is a form of reasoning
which start with atomic sentences in the knowledge base and applies inference rules
(Modus Ponens) in the forward direction to extract more data until a goal is reached. • The
Forward-chaining algorithm starts from known facts, triggers all rules whose premises are
satisfied, and add their conclusion to the known facts. This process repeats until the problem
is solved. 10
Properties of Forward-Chaining: • It is a down-up approach, as it moves from bottom to top. •
It is a process of making a conclusion based on known facts or data, by starting from the
initial state and reaches the goal state. • Forward-chaining approach is also called as data-
driven as we reach to the goal using available data. • Forward -chaining approach is
commonly used in the expert system, such as CLIPS, business, and production rule systems.
11
Example • "As per the law, it is a crime for an American to sell weapons to hostile nations.
Country A, an enemy of America, has some missiles, and all the missiles were sold to it by
Robert, who is an American citizen." • Prove that "Robert is criminal." 12
Facts Conversion into FOL: • It is a crime for an American to sell weapons to hostile
nations. (Let's say p, q, and r are variables) American (p) weapon(q) sells (p, q, r) hostile(r)
→ ∧∧∧Criminal(p) ...(1) • Country A has some missiles. Owns(A, p) Missile(p)∧. It can be
written in two definite clauses by using Existential Instantiation, introducing new Constant
T1. Owns(A, T1) ......(2) Missile(T1) .......(3) 13
• All of the missiles were sold to country A by Robert. Missiles(p) Owns (A, p) → Sells
(Robert, p, A) ......(4) ∧• Missiles are weapons. Missile(p) → Weapons (p) .......(5) • Enemy
of America is known as hostile. Enemy(p, America) →Hostile(p) ........(6) • Country A is an
enemy of America. Enemy (A, America) .........(7) • Robert is American American(Robert).
..........(8) 14
Forward chaining proof: • Step-1: In the first step we will start with the known facts and will
choose the sentences which do not have implications, such as: American(Robert), Enemy(A,
America), Owns(A, T1), and Missile(T1) 15
Step-2: 16• At the second step, we will see those facts which infer from available facts and
with satisfied premises. • Rule-(1) does not satisfy premises, so it will not be added in the first
iteration. • Rule-(2) and (3) are already added. • Rule-(4) satisfy with the substitution {p/T1},
so Sells (Robert, T1, A)is added, which infers from the conjunction of Rule (2) and (3). • Rule-
(6) is satisfied with the substitution(p/A), so Hostile(A) is added and which infers from Rule-
(7).
17
• Step-3: • At step-3, as we can check Rule-(1) is satisfied with the substitution {p/Robert,
q/T1, r/A}, so we can add Criminal(Robert)which infers all the available facts. And hence
we reached our goal statement. 18
Hence it is proved that Robert is Criminal using forward chaining approach. 19
B. Backward Chaining: • Backward-chaining is also known as a backward deduction or
backward reasoning method when using an inference engine. A backward chaining algorithm
is a form of reasoning, which starts with the goal and works backward, chaining through
rules to find known facts that support the goal. 20
Properties of backward chaining: • It is known as a top-down approach. • Backward-
chaining is based on modus ponens inference rule. • In backward chaining, the goal is
broken into sub-goal or sub-goals to prove the facts true. • It is called a goal-driven
approach, as a list of goals decides which rules are selected and used. • Backward -chaining
algorithm is used in game theory, automated theorem proving tools, inference engines,
proof assistants, and various AI applications. • The backward-chaining method mostly used
a depth-first searchstrategy for proof. 21
Example: • In backward-chaining, we will use the same above example, and will rewrite all
the rules. • American (p) weapon(q) sells (p, q, r) hostile(r) → Criminal(p) ... ∧∧∧(1)
Owns(A, T1) ........(2) • Missile(T1) • ?p Missiles(p) Owns (A, p) → Sells (Robert, p,A)
......(4) ∧• Missile(p) → Weapons (p) .......(5) • Enemy(p, America) →Hostile(p) ........(6) •
Enemy (A, America) .........(7) • American(Robert). ..........(8) 22
Backward-Chaining proof: • In Backward chaining, we will start with our goal predicate,
which is Criminal(Robert), and then infer further rules. • Step-1: • At the first step, we will
take the goal fact. And from the goal fact, we will infer other facts, and at last, we will prove
those facts true. So our goal fact is "Robert is Criminal," so following is the predicate of it. 23
Step-2: • At the second step, we will infer other facts form goal fact which satisfies the rules.
So as we can see in Rule-1, the goal predicate Criminal (Robert) is present with substitution
{Robert/P}. So we will add all the conjunctive facts below the first level and will replace p
with Robert. 24

You might also like