You are on page 1of 300

Unit 1

Module I

Introduction
Definition of Computing, Conventional Computing vs. Intelligent
Computing, Necessity of
Intelligent Computing, Current trends in Intelligent Computing
AI Concepts
Introduction to AI, AI problems and Solution approaches,
Fundamentals of problem solving using
Search and Heuristics, Overview of Knowledge-base creation, and
Intelligent Agents, Classification of AI
Computing
Computing is any goal-oriented activity requiring, benefiting from,
or creating computing machinery.
It includes the study and experimentation of algorithmic processes,
and development of both hardware and software.
Computing has scientific, engineering, mathematical, technological and social
aspects.
Major computing disciplines include computer engineering, computer science,
cybersecurity, data science, information systems, information technology, digital
art and software engineering.
Computing
• Computing is the process of using computers and computer technology to
solve problems, perform tasks, and create new products and services.
• It encompasses a broad range of activities, including software development,
hardware design, data analysis, networking, and artificial intelligence.
• At its core, computing involves the use of algorithms and programming
languages to create instructions that computers can follow.
• These instructions are used to perform a wide range of tasks, from simple
calculations to complex data analysis and machine learning.
Computational Intelligence
• It is the study of the design of intelligent agents.
• An agent is something that act in an environment- if does something.
• Agent include worms, dogs, thermostats, airplanes, humans,
organization and society.
• Intelligent agent is a system that acts intelligently:
Computational Intelligence
• its actions are appropriate for its goals and circumstances
• it is flexible to changing environments and goals
• it learns from experience
• it makes appropriate choices given perceptual limitations and finite
computation
Artificial or Computational Intelligence?
• Computational Intelligence is a subset of Artificial Intelligence
• CI is based on Fuzzy Logics, Probabilistic, Mechanisms, Natural Swarm
Intelligence, Neural Networks and Evolutionary Computing approches
• The field is often called Artificial Intelligence.
• Scientific goal: to understand the principles that make intelligent
behavior possible, in natural or artificial systems.
• Engineering goal: to specify methods for the design of useful,
intelligent artifacts.
Computational Intelligence Paradigms

• Artificial Neural Network


• evolutionary computing
• swarm intelligence
• fuzzy systems
Intelligent computing
Intelligent computing targets computational tasks with the minimum
cost according to the specific actual needs, matching adequate
computational power, invoking the finest algorithm, and obtaining
optimal results.
Intelligent computing
The basic elements of intelligent computing include human
intelligence, machine capabilities, and the physical world composed
of all things.
Intelligent Abilities
meta intelligence (Natural Intelligence): human being is the core of
intelligent computing and the source of wisdom, representing the
original and inherent intelligence
Generic intelligence : intelligence of computers .
All intelligent systems are designed and built by humans
Meta intelligence (Natural Intelligence)
• Expression • They perform highly complex cognitive tasks.
• Adaption • accomplish difficult learning, understand abstract concepts, do
logical reasoning, and extract meaningful patterns.
• Introspection • They have self-awareness.
• Perception • It is brain intelligence (learning, discovering, and creating are clear
manifestations of intelligence)
• Calculation • it is swarm intelligence (insects or animals usually generate
• Memory through aggregation, coordination, adaptation, and
• Study other simple behaviors)

• intellection
Generic intelligence (Machine Intelligence)
Generic intelligence represents the ability of computers to solve complex
problems with the wide extension, including image recognition , natural
language processing , speech recognition , target detection and tracking
etc.
Biological intelligence can be transplanted to a computer on the following
four levels
Data Intelligence : Math expression, calculation, storage
Perceptual Intelligence: Vision, hearing , touch, taste
automatic driving utilizes light detection and ranging methods , other
sensing devices, and AI algorithms for driving information computation
Generic intelligence (Machine Intelligence)
Cognitive (Machine) Intelligence : learning, thinking, decision, reasoning
It denotes machines with human-like logical thinking and cognition abilities,
especially to actively learn, think, understand, summarize, interpret, plan,
and apply knowledge
Autonomous Intelligence :
Autonomous intelligence implies that the machine can act like a human
Why we need highly efficient
and intelligent computing devices.
Rise in demand of the following
• internet of things,
• big data,
• and artificial intelligence
Features of Intelligent Computing
• self-learning and evaluability
• high computing capability
• high energy efficiency in architecture
• security and reliability
• automation and precision in operational
• collaboration and ubiquity in serviceability
self-learning and evaluability
• Self-learning refers to obtaining experiences by mining rules and
knowledge from massive amounts of data and optimizing the
calculation paths with the usable results.
• While evaluability represents a heuristic self-optimization ability that
simulates the evolutionary process of organisms in nature,
• where the machines learn from the environment and subsequently
make self-adjustments to adapt to the environment
High computing capability and high energy efficiency.
• Aiming to exceed the traditional Von Neumann’s architecture,
intelligent computing evolves to new computing architectures with
respect to the
• processing-in-memory,
• heterogeneous integration,
• and wide-area collaboration.
• High computing power refers to the computing capability that meets
the needs of an intelligent society
• high energy efficiency is to maximize computing efficiency and reduce
energy consumption as much as possible to ensure efficient processing
of big data.
Security and reliability.
• high security means network security, storage security, content security,
• High trust refers to the trust of identity, data, computing process, and
computing environment through trusted hardware, operating system,
software, network, and private computing.
Automation and precision.
• automatic resource management and scheduling, automatic service
creation and provision, and automatic management of the task life
cycle, availability, and service of intelligent computing.
• The precision :
fast processing of computing tasks and timely matching of computing
resources.
Collaboration and ubiquity.
• Collaboration between humans and machines improves intelligence
levels in intelligent tasks,
• and ubiquity enables computing to be conducted everywhere through
combining intelligent computing theoretical methods, architectural
systems, and technical approaches together.
Fusion of Intelligence and Computation
• The intelligence improves the performance and efficiency of computing
systems through intelligent technology.
• new computing mechanisms, such as hardware and software refactoring
and cooperative evolution, to deal with different types of tasks.
• New computing architectures, such as human-computer interaction,
combine human perception and cognitive ability with the operation and
storage ability of computer.
• And such new architectures are effective in improving the sensing and
reasoning ability of the computers.
• Machines can have high computing speed and accuracy, and also efficiently
obtain information from the physical environment through various sensors.
Fusion of Intelligence and Computation
• New distributed computing architectures such as end-to-end cloud and
wide-area collaboration are adopted to effectively integrate
supercomputing, cloud computing, edge computing, and terminal
computing resources.
• A new secure and trusted intelligent computing system is established by
constructing secure methods and trusted computing mechanisms.
• It ensures the security and trust of the computing process, identity, data,
and results
Computing by Intelligence
Another critical point of intelligent computing is how to improve the
intellectual level of computing.
we all need to learn from intelligent creatures in nature with no exception
for the computation, such as the three classical intelligence methods:
artificial neural network,
fuzzy system,
and evolutionary computing.
Artificial Neural Network

ANN BNN

Input Dendrites
Weight Synapses
Output Axon
Hidden layer Cell body

neurons must be able to


communicate with each
other, and they do this
through structures called
synapse
Artificial Neural Network
Since the 1980s, engineering techniques have been used to simulate the
structure and function of the human brain nervous system to constructed
artificial neural networks.
The artificial neural network imitates the connection of brain neurons
through many nonlinear processors.
W. S. McCulloch of psychology and W. Pitts of mathematical logic
developed the neural network and mathematical model known as the MP
model in 1943.
Artificial Neural Network
Artificial neural network research was founded on their discovery that a
single neuron could carry out logical operations.
The BP algorithm was created by Rumelhart, Hinton, and Williams
back in 1986 .
The back propagation of loss and the forward propagation of signals
make up the BP algorithm.
Because the multi-layer feedforward network is often trained by the
back propagation algorithm, multi-layer feedforward networks are
often referred to as BP networks.
Artificial Neural Network
After decades of development, nearly 40 artificial neural network
models have been proposed, including back propagation networks,
perceptron, self-organizing maps, Hopfield networks, Boltzmann
machines, etc.
In recent years, many classical models, such as convolutional neural
networks (CNNs) ,recurrent neural networks (RNNs) ,and long short-
term memory networks (LSTMs) ,have been widely used in various
classification and prediction tasks in the fields of image, voice, text,
graph, and so on.
The training of artificial neural network models depends heavily on the
amount of data
Artificial Neural Network
Models are pre-trained based on large datasets offline, saved, and
then applied to the problems using the technique of transfer learning
for quick solution.
BERT, proposed by Google AI Research Institute, and GPT-3,
developed by OpenAI, are the two most well-known pre-trained
models.
They have achieved great success in the field of natural language pro-
cessing.
Fuzzy Systems
• The idea of fuzzy logic was initially presented by Dr. Lutfi Zadeh in the
1960s.
• Although 0 and 1 are considered the two extreme examples of truth,
fuzzy logic also considers middle states of truth.
• Human brains function similarly to fuzzy logic.
• Approximate reasoning is an approach to imitate human thinking and
inference.
• Unlike Boolean logic, which the contemporary computer is founded
on and only allows for true or false statements, a statement may be
true “with some degree of truth”
Fuzzy Systems
• Their primary feature is the representation of symbolic information as
fuzzy conditional (if-then) rules.
• A fuzzy system may take both crisp (numerical) data and linguistic
values (defined by fuzzy sets) as inputs.
• Expert knowledge is represented as a set of fuzzy conditional rules
(knowledge base).
Fuzzy Systems
• Fuzzy systems have practical applications in situations when it is very
costly or difficult to use a precise (non-fuzzy) model.
• A fuzzy system is a great tool to process incomplete data, for example,
for signal and image processing , system identification , decision
support , and control processes.
Evolutionary Computation
• Genetic Algorithm
• Evolutionary Programming
• Genetic Programming
• Evolutionary computing
• evolutionary computing refers to the entire field;
Perceptual Intelligence
• Typical examples include smart city management, automatic diving
system, smart defense system and autonomous robots.
• human-like five-sense capabilities including vision, hearing,
smelling, tasting, and tactile(touch) sense.
Perceptual Intelligence
• Applications include safety and security monitoring in public and private
structures
• observation of the behavior and health of elderly or physically or
psychologically impaired individuals in nursing homes and hospitals .
• it may enable seniors to remain in their own homes for longer .
• autonomous robots that must traverse their surroundings and control
things in it,
Perceptual Intelligence
• Use of pattern recognition and deep learning technologies,
machines have grown more perceptually intelligent than humans in
recent years, making significant advances in voice, visual and touch
recognition.
• Ordinary sensors have become smart sensors because of the
integration of computers and IoT in manufacturing, giving them the
ability to do very complicate computations with the data gathered.
Perceptual Intelligence
• These sensors are designed as IoT components that transform live data
into digital data that can be sent to a gateway.
• light sensor that measures light intensity and color temperature.
• Smart sensors can also foresee, monitor, and immediately respond to
remedy situations.
• The primary tasks of intelligent sensors include raw data collection, and
filtering adjustments, motion detection, analysis, and communication.
Perceptual Intelligence

• Additionally, data from several sensors may be used to draw


inferences about a problem already present;
• for example, temperature and pressure sensor data might be used to
predict the beginning of a mechanical breakdown.
Cognitive Intelligence or understanding and thinking
• Data recognition is the core function of perceptual intelligence, which
requires collecting large-scale data as well as feature extraction of images,
videos, sounds, and other types of data to complete structured processing.
• cognitive intelligence requires understanding the relationship and logic
between data based on the processing of structured data, and then
analyzing and making decisions based on that knowledge.
• Through heuristic research on neurobiological process and cognitive
mechanism of the human brain, a machine can improve its cognition level
enabling it to assist, understand, make decisions, gain insight, and
discover.
Cognitive Intelligence or understanding and thinking
• It can realize self-learning without any prior human programming,
purposeful reasoning, and natural interaction.
• It can adapt to a complex environment and possess higher cognitive
skills, like interpretation and planning.
• Cognitive intelligence, or “understanding and thinking”, is used to
describe the ability to process complex facts and situations.
• Natural language processing converts human language into machine
language so that machines can understand and calculate.
Intelligent and Conventional Computing
Sno Intelligent computing Conventional computing
1 It does not guarantee a solution to a It guarantees a solution to a given problem.
given problem.
2 results may not be reliable and results are consistent and reliable
consistent
3 a programmer does not tell the programmer tells the system exactly how
system how to solve the given to solve the problem.
problem
4 can solve a range of problems in a can solve only one problem at a time in a
given domain. given domain.
5 Can handle noisy data Cannot handle noisy data
Intelligent and Conventional Computing
Conventional:
• Based on algorithms whose instructions are stored in memory and
executed in sequential way.
AI Computing:
• Not based on algorithms but based on:
• Knowledge base (symbolic representation)
• Uses reasoning and inferencing over the knowledge base to search
and perform pattern matching.
Application of Computation Intelligence
• Air Traffic Control • Resource Allocation
• Path Planning
• Scheduling • System Modeling
• Machine Learning • Network Security
• Pattern recognition • Medical diagnosis
• Job Shop Scheduling • Robots for hazardous
• Earthquake Prediction environment
• Chess playing
• Market Forecasting • Autonomous vehicle
• Data-Mining • Natural language
translation systems
Artificial Intelligence
Artificial Intelligence is composed of two words Artificial and Intelligence,
where Artificial defines "man-made," and intelligence defines "thinking
power",
hence AI means "a man-made thinking power."
• Systems that think like humans
• Systems that act like humans
• Systems that think rationally
• Systems that act rationally
Artificial Intelligence
AI is generally associated with Computer Science, but it has many
important links with other fields such as Maths, Psychology, Cognition,
Biology and Philosophy, among many others.
Our ability to combine knowledge from all these fields will ultimately
benefit our progress in the quest of creating an intelligent artificial being.
What is AI?
Thinking Humanly Thinking Rationally
The exciting new effort to make “The study of mental faculties
computers think ... machines with through the use of
minds, in the full and literal sense.” computational models.”
(Haugeland, 1985) (Charniak and McDermott,
1985)
“[The automation of] activities that “The study of the computations
we associate with human thinking, that make it possible to
activities such as decision-making, perceive, reason, and act.”
problem solving, learning ...” (Winston, 1992)
(Bellman, 1978
What is AI?
Acting Humanly Acting Rationally
“The art of creating machines that “Computational Intelligence is the
perform functions that require study of the design of intelligent
intelligence when performed by people.” agents.” (Poole et al., 1998)
(Kurzweil, 1990)
“The study of how to make computers “AI . . . is concerned with intelligent
do things at which, at the moment, behavior in artifacts.” (Nilsson, 1998)
people are better.” (Rich and Knight,
1991)
Acting humanly: The Turing Test approach
• .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 pattern
Acting humanly: The Turing Test approach

The questions and answers can be like:


Interrogator: Are you a computer?
PlayerA (Computer): No
Interrogator: Multiply two large
numbers such as
(256896489*456725896)
Player A: Long pause and give the
wrong answer.
WHY AI?
• With the help of AI, you can create such software or devices which
can solve real-world problems very easily and with accuracy such as
health issues, marketing, traffic issues, etc.
• With the help of AI, you can create your personal virtual Assistant,
such as Cortana, Google Assistant, Siri, etc.
• With the help of AI, you can build such Robots which can work in an
environment where survival of humans can be at risk.
• AI opens a path for other new technologies, new devices, and new
Opportunities
Problems of AI:
• Intelligence does not imply perfect understanding;
• every intelligent being has limited perception, memory and computation.
• Aspects of intelligence studied by AI include perception,
communicational using human languages, reasoning, planning, learning
and memory
Problems of AI:
The following questions are to be considered before we can step
forward:
1. What are the underlying assumptions about intelligence?
2. What kinds of techniques will be useful for solving AI problems?
3. At what level human intelligence can be modelled?
4. When will it be realized when an intelligent program has been built?
Advantages of Artificial Intelligence
• High Accuracy with less error:
AI machines or systems are prone to less errors and high accuracy as it
takes decisions as per pre-experience or information.
• High-Speed:
AI systems can be of very high-speed and fast-decision making;
because of that AI systems can beat a chess champion in the Chess
game.
• High reliability:
AI machines are highly reliable and can perform the same action
multiple times with high accuracy
Advantages of Artificial Intelligence
• Useful for risky areas:
AI machines can be helpful in situations such as defusing a bomb, exploring
the ocean floor, where to employ a human can be risky.
• Digital Assistant:
AI can be very useful to provide digital assistant to the users such as AI
technology is currently used by various E-commerce websites to show the
products as per customer requirement.
• Useful as a public utility:
AI can be very useful for public utilities such as a selfdriving car, facial
recognition for security purpose, Natural language processing to
communicate with the human in human-language, etc.
Disadvantages of AI
• High Cost: The hardware and software requirement of AI is very costly
as it requires lots of maintenance to meet current world
requirements.
• Can't think out of the box: Even we are making smarter machines
with AI, but still they cannot work out of the box, as the robot will
only do that work for which they are trained, or programmed.
• No feelings and emotions: AI machines can be an outstanding
performer, but still it does not have the feeling so it cannot make any
kind of emotional attachment with human, and may sometime be
harmful for users if the proper care is not taken.
Disadvantages of AI
• Increase dependency on machines: With the increment of
technology, people are getting more dependent on devices and hence
they are losing their mental capabilities.
• No Original Creativity: As humans are so creative and can imagine
some new ideas but still AI machines cannot beat this power of
human intelligence and cannot be creative and imaginative
AI Techniques
Intelligence requires knowledge but knowledge possesses less
desirable properties such as
• It is voluminous
• it is difficult to characterize accurately
• it is constantly changing
• it differs from data by being organised in a way that corresponds to its
application
AI Techniques
An AI technique is a method that exploits knowledge that is represented so
that
• situations that share properties, are grouped together, rather than being
allowed separate representation.
• It can be understood by people who must provide it;
• In many AI domains people must supply the knowledge to programs in a
form the people understand and in a form that is acceptable to the
program.
- It can be easily modified to correct errors and reflect changes in real
conditions.
- - It can be widely used even if it is incomplete or inaccurate
Goal of AI
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. Creating some system which can exhibit intelligent behavior, learn new
things by itself, demonstrate, explain, and can advise to its user.
Problem Spaces and Search
• Building a system to solve a problem requires the following steps –
• Define the problem precisely including detailed specifications and what
constitutes an acceptable solution;
• Analyse the problem thoroughly for some features may have a dominant
affect on the chosen method of solution;
• Isolate and represent the background knowledge needed in the solution
of the problem;
• Choose the best problem solving techniques in the solution.
Defining the Problem as state Search
• Problems dealt with in artificial intelligence generally use a common term
called 'state'.
• A state represents a status of the solution at a given step of the problem
solving procedure.
• The solution of a problem, thus, is a collection of the problem states.
• The problem solving procedure applies an operator to a state to get the
next state.
• Then it applies another operator to the resulting state to derive a new
state.
Defining the Problem as state Search
• The process of applying an operator to a state and its subsequent transition to
the next state, thus, is continued until the goal (desired) state is derived.
• Such a method of solving a problem is generally referred to as state space
approach.
• For example, in order to solve the problem play a game, which is restricted to
two person table or board games, we require the rules of the game and the
targets for winning as well as a means of representing positions in the game.
• The opening position can be defined as the initial state and a winning position
as a goal state, there can be more than one.
• legal moves allow for transfer from initial state to other states leading to the
goal state.
Formal description of a problem
• Define a state space that contains all possible configurations of the
relevant objects, without enumerating all the states in it.
• A state space represents a problem in terms of states and operators
that change states.
• Define some of these states as possible initial states;
• Specify one or more as acceptable solutions, these are goal states;
• Specify a set of rules as the possible actions allowed.
This involves thinking about the generality of the rules, the
assumptions made in the informal presentation and how much work
can be anticipated by inclusion in the rules.
Example- The water jug problem
The water jug problem :There are two jugs called four and three ;
four holds a maximum of 4 gallons and three a maximum of 3 gallons.
How can we get 2 gallons in the jug four.
The state space is a set of ordered pairs giving the number of gallons in
the pair of jugs at any time i.e (four, three) where four = 0, 1, 2, 3, 4
and three = 0, 1, 2, 3.
The start state is (0,0) and the goal state is (2,n)
where n is a don't care but is limited to three holding from 0 to 3
gallons.
Example- The water jug problem- Rules
1 (x,y) if x<4  (4,y) Fill the 4-gallon jug
2 (x,y) if y<3 (x, 3) Fill the 3-gallon jug

3 (x,y) if x>0 (x-d, y) Pour some water out of the 4-gallon jug
4 (x,y) if y>0 (x, y-d) Pour some water out of the 4-gallon jug

5 (x,y) if x>0 (0, y) Empty the 4-gallon jug on the ground

6 (x,y) if y>0 (x,0) Empty the 3-gallon jug on the ground


Example- The water jug problem- Rules
7 (x, y) (4, y-(4-x)) Pour water from the
If x+y >=4 and y>0 3 gallon jug into the
4 gallon jug until the
4 gallon jug is full
8 (x, y) (x-(3-y), 3) Pour water from the
If x+y >=3 and x>0 4 gallon jug into the
3 gallon jug until the
3 gallon jug is full
Example- The water jug problem- Rules
9 (x, y) (x+y, 0) Pour all the water
If x+y <=4 and from the 3- gallon jug
y>0 Into the 4-gallon jug

10 (x, y) (0, x+y) Pour all the water


If x+y <=3 and x>0 from the 4-gallon jug
Into the 3-gallon jug
Example- The water jug problem- Rules
11 (0, 2) (2, 0) Pour the 2 gallons
From the 3-gallon jug
Into the 4-gallon jug
12 (2, y) (0, y) Empty the 2 gallons in the
4-gallon jug on the ground
Gallons in the Gallons in the Rules Applied
4-Gallon Jug 3-Gallon Jug

0 0 Start State
0 3 2 (Fill the 3-gallon jug)
3 0 9 (Pour all the water from the 3- gallon jug Into the 4-
gallon jug)
3 3 2 (Fill the 3-gallon jug)
4 2 7 (Pour water from the 3 gallon jug into the 4 gallon
jug until the 4 gallon jug is full )
0 2 5 or 12 Empty the 4-gallon jug on the ground

2 0 9 or 11 Pour all the water from the 3- gallon jug


Into the 4-gallon jug
One solution to Water Jug Problem
Gallons in Gallons in the Rules Applied
the 4- 3-Gallon Jug
Gallon Jug
0 0 Start State
4 0 1 (Fill the 4-gallon jug)
1 3 8 (Pour water from the 4 gallon jug into the 3 gallon
jug until the 3 gallon jug is full)
1 0 6(Empty the 3-gallon jug on the ground)
0 1 10(Pour all the water from the 4-gallon jug Into the 3-
gallon jug)
4 1 1 (Fill the 4-gallon jug)
2 3 8
Another solution to Water Jug Problem
PROBLEM CHARACTERISTICS
A problem may have different aspects of representation and
explanation.
In order to choose the most appropriate method for a particular
problem, it is necessary to analyze the problem along several key
dimensions.
Some of the main key features of a problem are given below.
• Is the problem decomposable into set of sub problems?
• Can the solution step be ignored or undone?
• Is the problem universally predictable?
PROBLEM CHARACTERISTICS
• Is a good solution to the problem obvious without comparison to all
the possible solutions?
• Is the desire solution a state of world or a path to a state?
• Is a large amount of knowledge absolutely required to solve the
problem?
• Will the solution of the problem required interaction between the
computer and the person?
• The above characteristics of a problem are called as 7-problem
characteristics under which the solution must take place.
PROBLEM CHARACTERISTICS
Example: In this case, the problem is divided into smaller problems.
The smaller problems are solved independently. Finally, the result is
merged to get the final result.
• But there are certain problems which cannot be decomposed into
sub-problems.
• For example Blocks world problem in which, start and goal state are
given as,

• Here, solution can be achieved by moving blocks in a sequence such


that goal state can be derived.
• Solution steps are interdependent and cannot be decomposed in sub
problems.
PROBLEM CHARACTERISTICS
• In the Theorem Proving problem, a lemma that has been proved can
be ignored for the next steps.
Such problems are called Ignorable problems.
• In which solution steps can be ignored (e.g., Theorem Proving).
• Suppose we are trying to prove a mathematical theorem. First we
proceed with proving a lemma that we think will be useful. Later we
realize that it is not useful.
• Still we can prove the theorem, only we need to ignore the first
approach and start with another one to prove the theorem.
PROBLEM CHARACTERISTICS

• In the 8-Puzzle, Moves can be undone and backtracked.


• Such problems are called Recoverable problems.
PROBLEM CHARACTERISTICS
In Playing Chess, moves can be retracted.
• Such problems are called Irrecoverable problems.

Ignorable problems can be solved using a simple control structure that


never backtracks.

Recoverable problems can be solved using backtracking.

Irrecoverable problems can be solved by recoverable style methods via


planning.
PROBLEM CHARACTERISTICS
Is the universe of the problem is predictable?
• In Playing Bridge, We cannot know exactly
• where all the cards are or what the other players will do on their turns.
• Uncertain outcome!
• For certain-outcome problems, planning can be used to generate a
sequence of operators that is guaranteed to lead to a solution.
• Example 8 Puzzle
• For uncertain-outcome problems, a sequence of generated operators can
only have a good probability of leading to a solution. Example Bridge
PROBLEM CHARACTERISTICS
Is a good solution to the problem is absolute or relative?
• Any path problem can be solved using heuristics that suggest good
paths to explore. (relative Solution)
• Example
• The Travelling Salesman Problem, we have to try all paths to find the
shortest one .
• For best-path problems, a much more exhaustive search will be
performed. (Absolute solution)
PROBLEM CHARACTERISTICS
Consider the following set of facts, again involving Marcus:
1) Marcus was a man.
2) Marcus was a Pompeian.
3) Marcus was born in 40 A.D.
4) All men are mortal.
5) All Pompeians died when the volcano erupted in 79 A.D.
6) No mortal lives longer than 150 years.
7) It is now 1991 AD.
Question “IS Marcus Alive”
PROBLEM CHARACTERISTICS
Solution 1 Solution 2
1) Marcus was a man. (given) 7) It is now 1991 AD (given)
4) All men are mortal. (given) 5) All Pompeians died when the volcano
8) Marcus is Mortal (new from rule 1 , 4) erupted in 79 A.D. (given)
3) Marcus was born in 40 A.D. (given) 11) All Pompeians are dead
7) It is now 1991 AD (new rule from 7, 5)
9) Marcus age is 1951 years 2) Marcus was a Pompeian. (given)
( new rule from 3, 7) 12) Marcus is dead (new rule from 11, 2)
6) No mortal lives longer than 150 years.
10) Now Marcus is dead
(new rule from 8, 6, 9)
This problem is absolute since it doesnot depends on other. You will
get same answer form both the solution
PROBLEM CHARACTERISTICS
Is the solution to the problem a state or a path
• The Water Jug Problem, TSP
the path that leads to the goal must be reported. (Path Problem),
• Consider the problem of natural language processing.
• Finding a consistent interpretation for the sentence
• “The bank president ate a dish of pasta salad with the fork”.
• We need to find the interpretation but not the record of the processing
by which the interpretation is found.
• Here solution is statement
PROBLEM CHARACTERISTICS
What is the role of knowledge in solving a problem using artificial
intelligence?
• Playing Chess
• Suppose you had unlimited computing power available.
• How much knowledge would be required by a perfect program?
• rules for determining legal moves and some simple control mechanism that
implements an appropriate search procedure.
Additional knowledge about such things as good strategy and tactics could of
course help considerably to constrain the search and speed up the execution
of the program.
• Knowledge is important only to constrain the search for a solution.
PROBLEM CHARACTERISTICS
What is the role of knowledge in solving a problem using artificial
intelligence?
• Reading Newspaper
• Now consider the problem of scanning daily newspapers to decide which
are supporting the BJP and which are supporting the Congress in some
upcoming election.
• Again assuming unlimited computing power, how much knowledge would
be required by a computer trying to solve this problem?
• This time the answer is a great deal. This would require enormous amount
of knowledge.
PROBLEM CHARACTERISTICS
Does the task of solving a problem require human interaction?
• Sometimes it is useful to program computers to solve problems in ways that
the majority of people would not be able to understand.
• The solitary problem, in which there is no intermediate communication and
no demand for an explanation of the reasoning process.
• Solitary in which the computer will be given a problem description and will
produce an answer, with no intermediate communication
• Simple theorem proving falls under this category . given the basic rules and
laws, the theorem could be proved, if one exists.

• The conversational problem, in which intermediate communication is to


provide either additional assistance to the computer or additional
information to the user.
• Problems such as medical diagnosis
PRODUCTION SYSTEM AND ITS CHARACTERISTICS
• The production system is a model of computation that can be applied to
implement search algorithms and model human problem solving.
• A production is a rule consisting of a situation recognition part and an action
part.
• A production is a situation-action pair in which the left side is a list of things
to watch for and the right side is a list of things to do so.
PRODUCTION SYSTEM AND ITS CHARACTERISTICS

A production system consists of following components.


(a) A set of production rules, which are of the form A→B.
Each rule consists of left hand side constituent that represent the
current problem state and a right hand side that represent an output
state.
A rule is applicable if its left hand side matches with the current
problem state.
PRODUCTION SYSTEM AND ITS CHARACTERISTICS

b) A database, which contains all the appropriate information for the


particular task.
Some part of the database may be permanent while some part of this
may pertain only to the solution of the current problem.
c) A control strategy that specifies order in which the rules will be
compared to the database of rules and a way of resolving the conflicts
that arise when several rules match simultaneously.
d) A rule applier, which checks the capability of rule by matching the
content state with the left hand side of the rule and finds the appropriate
rule from database of rules.
PRODUCTION SYSTEM AND ITS CHARACTERISTICS
A production system not only represents knowledge but also action.
It acts as a bridge between AI and expert systems.
Production system provides a language in which the representation of expert
knowledge is very natural.
We can represent knowledge in a production system as a set of rules of the
form
If (condition) THEN (condition)
along with a control system and a database.
Control Strategies
• How to decide which rule to apply next during the process of
searching for a solution to a problem.
• The first requirement of a good control strategy is that it causes
motion.
Example : Water Jug Problem
Suppose we implemented the simple control strategy of starting each
time at the top of the list rules and choosing first applicable one.
If we did that, we would never solve the problem.
We would continue indefinitely filling the 4-gallon jug with water that
donot cause motion will never lead to a solution.
Control Strategies
• The second requirement of a good control strategy is that it be
systematic.
• Control strategy for water jug problem
• On each cycle, chose at random from among the applicable rules. It
causes motion. It will lead to solution eventually. But we are likey to
arrive at the same state several times before we finally find a solution.
• One systemetic control strategy : contruct a tree with the initial state
as its root. Generate all the offspring of the root by applying each of
the applicables rules to the initial state as its root. Continue this
process until some rule produces a goal state.
Control Strategies
Features of Production System
• Some of the main features of production system are
• The production rules essentially tell us what to do in a given situation.
1. Simplicity:
• The structure of each sentence in a production system is unique and
uniform as they use “IF-THEN” structure.
• This structure provides simplicity in knowledge representation. This
feature of production system improves the readability of production
rules.
Features of Production System
2. Modularity:
Information can be treated as a collection of independent facts which
may be added or deleted from the system with essentially no
deletetious side effects.
3. Modifiability: This means the facility of modifying rules.
4. Knowledge intensive: The knowledge base of production system
stores pure knowledge.
Each production rule is normally written as an English sentence; the
problem of semantics is solved by the very structure of the
representation.
Disadvantages of production system
1. Opacity: This problem is generated by the combination of production rules.
Communication between the rule interpreter and the production rules creates
difficulty for the understanding of the control system and its strategies.
There exist difficulties in understanding the hierarchy of operations.
2. Inefficiency: During execution of a program several rules may active.
it requires some forms of complex search through all the production rules for each
cycle of control program.
3. Absence of learning: Rule based production systems do not store the result of
the problem for future use.
4. Conflict resolution: When a new rule is added to a database, it should ensure
that it does not have any conflicts with the existing rules.
ALGORITHM OF PROBLEM SOLVING
Any one algorithm for a particular problem is not applicable over all
types of problems in a variety of situations.
So there should be a general problem solving algorithm, which may
work for different strategies of different problems.
Algorithm (problem name and specification)
Step 1 :Analyze the problem to get the starting state and goal state.
Step 2: Find out the data about the starting state, goal state
Step 3: Find out the production rules from initial database for
proceeding the problem to goal state.
ALGORITHM OF PROBLEM SOLVING
Step 4: Select some rules from the set of rules that can be applied to data.
Step 5: Apply those rules to the initial state and proceed to get the next state.
Step 6: Determine some new generated states after applying the rules.
Accordingly make them as current state.
Step 7: Finally, achieve some information about the goal state from the
recently used current state and get the goal state.
Step 8: Exit.
Problem : Boat man, Tiger, Goat, Grass
Let us take an example. Initially a boatman, Grass, Tiger and Goat is present
at the left bank of the river and want to cross it.
The only boat available is one capable of carrying 2 objects of portions at a
time.
The condition of safe crossing is that at no time the tiger present with goat,
the goat present with the grass at the either side of the river.
How they will cross the river?
Problem : Boat man, Tiger, Goat, Grass
The objective of the solution is to find the sequence of their transfer
from one bank of the river to the other using the boat sailing through
the river satisfying these constraints.
Let us use different representations for each of the missionaries and
Carnivals as follows.
B: Boat
T: Tiger
G: Goat
Gr: Grass
Problem : Boat man, Tiger, Goat, Grass
Problem : Boat man, Tiger, Goat, Grass
Problem : Boat man, Tiger, Goat, Grass
Problem : Boat man, Tiger, Goat, Grass
Problem : Boat man, Tiger, Goat, Grass
Problem : Boat man, Tiger, Goat, Grass
• This problem requires a lot of space for its state implementation.
• It takes a lot of time to search the goal node.
• The production rules at each level of state are very strict.
3 x 3 chessboard with move rules for the simplified
knight tour problem.
Production rules for the 3 x 3 knight problem.
A production system solution to the 3 x 3
knight’s tour problem.
The recursive path algorithm as production system.
3 x 3 chessboard with move rules for the
simplified knight tour problem.
• In this game a lots of production rules are applied for each move of
the square on the chessboard.
• A lots of searching are required in this game.
• Implementation of algorithm in the knowledge base is very
important.
4 – Queens’ problem
4 – Queens’ problem is to place 4 – queens on a 4 x 4 chessboard in
such a manner that no queens attack each other by being in the same
row, column, or diagonal.

Here we have to place 4


queens say Q1, Q2, Q3, Q4 on
the 4 x 4 chessboard such that
no 2 queens attack each other
Q1
4 – Queens’ problem Q2
• Let’s suppose first queen Q1 at position (1, 1) Q3 Q3 Q3 Q3
• now for Q2 we can’t put it in 1 row( because they will conflict
• So for Q2 we will have to consider row 2. In row 2 we can
place it in column 3 I.e at (2, 3) but then there will be no
option for placing Q3 in row 3.
• So we backtrack one step and place Q2 at (2, 4) then
we find the position for placing Q3 is (3, 2) but by this,
Q1
no option will be left for placing Q4. Q2
• Then we have to backtrack till ‘Q1’ and put it to (1, 2) instead
of (1, 1) and then all other queens can be placed safely by Q3
moving Q2 to the position (2, 4), Q3 to (3, 1), and Q4 to (4, 3). Q4 Q4 Q4 Q4
4 – Queens’ problem
• For all the positions(columns) in the current row:
• Check for all the previous rows is there a queen or not?
• Check for all the previous diagonal columns is there a queen or not?
• If any of these conditions are true, then backtrack to the previous row
and move the previous queen 1 step forward.
• Otherwise, put the current queen in the position and move to the
next row
Possible Solution

solution as (2, 4, 1, 3), solution as (3, 1, 4, 2),


4-Queens
4-Queens-Assign value to unassigned variable
4-Queens-Forward Check
4-Queens-Assign value to unassigned variable
4-Queens-Forward check and then
BACKTRACK!
4-Queens-Assign value to unassigned variable
4-Queens-Forward check!
4-Queens-Assign value to unassigned variable
4-Queens-Forward check!
4-Queens-Assign value to unassigned variable
4-Queens-Forward Check
4-Queens-Assign value to unassigned variable
8-Queens-Assign value to unassigned variable
• This pseudocode uses a backtracking algorithm to find a solution to the 8
Queen problem, which consists of placing 8 queens on a chessboard in
such a way that no two queens threaten each other.
• The algorithm starts by placing a queen on the first column, then it
proceeds to the next column and places a queen in the first safe row of
that column.
• If the algorithm reaches the 8th column and all queens are placed in a safe
position, it prints the board and returns true.
If the algorithm is unable to place a queen in a safe position in a certain
column, it backtracks to the previous column and tries a different row.
• The function checks if it is safe to place a queen on a certain row and
column by checking if there are any queens in the same row, diagonal or
anti-diagonal.
8-Queens-Assign value to unassigned variable
Tower of Hanoi
The tower of Hanoi is one of the main applications of
recursion.
It says, ‘if you can solve n–1 cases, then you can easily
solve the nth case’.
Figure shows three rings mounted on pole A.
The problem is to move all these rings from pole A to
pole C while maintaining the same order.
The main issue is that the smaller disk must always
come above the larger disk.
Tower of Hanoi
To summarize, the solution to our problem of moving n rings
from A to C using B as spare can be given as:
Base case: if n=1
• Move the ring from A to C using B as spare
Recursive case:
• Move n – 1 rings from A to B using C as spare
• Move the one ring left on A to C using B as spare
• Move n – 1 rings from B to C using A as spare
Tower of Hanoi
The Blocks World

• The blocks world has two kinds of components:


• A table top with three places p, q, and r
• A variable number of blocks A, B, C, etc., that can be arranged in
places on the table or stacked on one another
• A legal move is to transfer a block from one place or block onto
another place or block, with these restrictions:
• The moved block must not have another block on top of it
• No other blocks are moved in the process
The Blocks World
Cryptarithmatic Problem
• It is an arithmetic problem which is represented in letters.
• It involves the decoding of digit represented by a character.
• It is in the form of some arithmetic equation where digits are distinctly
represented by some characters.
• The problem requires finding of the digit represented by each character.
• Assign a decimal digit to each of the letters in such a way that the answer to
the problem is correct.
• If the same letter occurs more than once, it must be assigned the same digit
each time.
• No two different letters may be assigned the same digit.
Cryptarithmatic Problem
Cryptarithmatic Problem
Cryptarithmatic Problem
Cryptarithmatic Problem
Cryptarithmatic Problem
Cryptarithmatic Problem
Cryptarithmatic Problem
Cryptarithmatic Problem
Cryptarithmatic Problem
Cryptarithmatic Problem
Cryptarithmatic Problem
Cryptarithmatic Problem
Cryptarithmatic Problem
8 Puzzle Problem
• It has set off a 3x3 board having 9 block spaces out of which 8 blocks
having tiles bearing number from 1 to 8.
• One space is left blank.
• The tile adjacent to blank space can move into it.
• We have to arrange the tiles in a sequence for getting the goal state.
8 Puzzle Problem

We also know the eight puzzle problem by the name of N puzzle problem or sliding
puzzle problem.
N-puzzle that consists of N tiles (N+1 titles with an empty tile) where N can be 8, 15, 24
and so on.
In our example N = 8. (that is square root of (8+1) = 3 rows and 3 columns).
The puzzle can be solved by moving the tiles one by one in the single empty space and
thus achieving the Goal state.
8 Puzzle Problem

The empty space can only move in four directions (Movement of empty space)
• Up
• Down
• Right or
• Left
The empty space cannot move diagonally and can take only one step at a time.
8 Puzzle Problem

Let's solve the problem without Heuristic Search that is Uninformed Search or
Blind Search ( Breadth First Search and Depth First Search)
Breath First Search to solve Eight puzzle problem
Note: If we solve this problem with depth first search, then it will go to depth instead
of exploring layer wise nodes.
Time complexity:
In worst case time complexity in BFS is O(b^d) know as order of b raise to power d.
In this particular case it is (3^20).
b-branch factor
d-depth factor
8 Puzzle Problem
8 Puzzle Problem

D
L R U
8 Puzzle Problem

R
L
8 Puzzle Problem
Comments:
• This problem requires a lot of space for saving the different trays.
• Time complexity is more than that of other problems.
• The user has to be very careful about the shifting of tiles in the trays.
• Very complex puzzle games can be solved by this technique.
8 Puzzle Problem
Travelling Salesman Problem
You are given-
• A set of some cities
• Distance between every pair of cities

• Travelling Salesman Problem states-


• A salesman has to visit every city exactly once.
• He has to come back to the city from where he starts his journey.
• What is the shortest possible route that the salesman must follow to
complete his tour?
• State is represented as pair of any two cities and distance between them
Travelling Salesman Problem

B
20 30
Starting 13
Point 22
A D

40 12
C
State Space : Initial State (State A)

{ (AB), (AC), (AD) }


20 40 22
Possible Routes
ABCDA (20+13+12+22) 67
ABDCA (20+30+12+40) 102
ADBCA (22+30+13+40) 105
ADCBA (22+12+13+20) 67
ACDBA (40+12+30+20) 102
ACBDA (40+13+30+22) 105
Monkey Banana Problem
A monkey is in a room. A bunch of bananas is hanging from the ceiling.
The monkey cannot reach the bananas directly.
There is a box in the corner of the room.
How can the monkey get the bananas?”

C B A
Monkey Banana Problem
Initially, the monkey is at location ‘A’,
the banana is at location ‘B’
and the box is at location ‘C’.
The monkey and box have height “low”;
but if the monkey climbs onto the box will have height “High”,
the same as the bananas.
Monkey Banana Problem
The action available to the monkey include:
“GO” from one place to another.
“PUSH” an object from one place to another.
“Climb” onto an object.
“Grasp” an object.
Grasping results in holding the object if the monkey and the object
are in the same place at the same height.
Monkey Banana Problem
So the solution to the planning problem may be of following
• GO(A,C)
• PUSH (Box, C, B, Low)
• Climb Up(Box , B)
• Grasp(banana, B, High)
• Climb down(Box)
• Push(Box, B, C, Low)
Search Algorithm
• Search is the systematic examination of states to find path from the
start/root state to the goal state.
• Many traditional search algorithms are used in AI applications.
• For complex problems, the traditional algorithms are unable to find the
solution within some practical time and space limits.
• Consequently, many special techniques are developed; using heuristic
functions. The algorithms that use heuristic functions are called heuristic
algorithms.
• Heuristic algorithms are not really intelligent; they appear to be
intelligent because they achieve better performance.
• Heuristic algorithms are more efficient because they take advantage of
feedback from the data to direct the search path.
Search Algorithm
• A search algorithm takes a problem as input and returns the solution
in the form of an action sequence.
• Once the solution is found, the actions it recommends can be carried
out.
• This phase is called as the execution phase.
• After formulating a goal and problem to solve the agent cells a search
procedure to solve it.
Search Algorithm
• A problem can be defined by 5 components.
• The initial state: The state from which agent will start.
• The goal state: The state to be finally reached.
• The current state: The state at which the agent is present after
starting from the initial state.
• Successor function: It is the description of possible actions and their
outcomes.
• Path cost: It is a function that assigns a numeric cost to each path.

• However, generally searching can be classified into two types i.e.


uninformed searching and informed searching
uninformed search (also called blind search).
strategies have no additional information about states .
All they can do is generate successors and distinguish a goal state from
a non-goal state.
Strategies that know whether one non-goal state is “more promising”
than another are called informed search or heuristic search strategies
uninformed search (also called blind search).
Types
• Breadth-first search
• Uniform cost search
• Depth-first search
• Iterative deepening depth-first search
• Bidirectional Search
Breadth-first search
• in which the root node is expanded first, then all the successors of the
root node are expanded next, then their successors, and so on.
• In general, all the nodes are expanded at a given depth in the search
tree before any nodes at the next level are expanded.
• This is achieved very simply by using a FIFO queue for the frontier.
• Thus, new nodes (which are always deeper than their parents) go to
the back of the queue, and old nodes, which are shallower than the
new nodes, get expanded first.
Breadth-first search

Breadth-first search on a simple binary tree. At each stage, the node to be expanded next is
indicated by a marker.
Breadth-first search : Algorithm:
1. Create a variable called NODE-LIST and set it to initial state
2. Until a goal state is found or NODE-LIST is empty do
a. Remove the first element from NODE-LIST and call it E.
If NODE-LIST was empty, quit
b. For each way that each rule can match the state described in E do:
i. Apply the rule to generate a new state
ii. If the new state is a goal state, quit and return this state
iii. Otherwise, add the new state to the end of NODE-LIST
Breadth-first search : Algorithm:
In the below tree structure, we have shown the traversing of the tree using
BFS algorithm from the root node S to goal node K.
BFS search algorithm traverse in layers, so it will follow the path which is
shown by the dotted arrow, and the traversed path will be:
1. S---> A--->B---->C--->D---->G--->H--->E---->F---->I---->K
Breadth-first search : Algorithm:

. S---> A--->B---->C--->D---->G--->H--->E---->F---->I---->K
Breadth-first search : Algorithm:
Breadth first search is: .
• Time complexity : O(b^d )
• Space complexity : O(b^d )
• Optimality :Yes
• b - branching factor(maximum no of successors of any node),
• d – Depth of the shallowest goal node
• Maximum length of any path (m) in search space
Breadth-first search : Algorithm:
Advantages:
• BFS will provide a solution if any solution exists.
• If there are more than one solutions 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
into memory to expand the next level.
• BFS needs lots of time if the solution is far away from the root node.
Depth-first search : Algorithm:

• Depth-first search is a recursive algorithm for traversing a tree or graph data


structure.
• It is called the depth-first search because it starts from the root node and follows
each path to its greatest depth node before moving to the next path.
• DFS uses a stack data structure for its implementation.
• The process of the DFS algorithm is similar to the BFS algorithm
Depth-first search : Algorithm:

Advantage:
• DFS requires very less memory as it only needs to store a stack of the nodes on the path
from root node to the current node.
• It takes less time to reach to the goal node than BFS algorithm
• Disadvantage:
• There is the possibility that many states keep re-occurring, and there is no guarantee of
finding the solution.
• DFS algorithm goes for deep down searching and sometime it may go to the infinite loop.
Depth-first search : Algorithm:

In the below search tree, we have shown the flow of depth-first search,
and it will follow the order as:
Root node--->Left node ----> right node.
Depth-first search : Algorithm:
Depth-first search : Algorithm:

Root node--->Left node ----> right node.


It will start searching from root node S, and traverse A, then B, then D and E, after
traversing E, it will backtrack the tree as E has no other successor and still goal node is not
found.
After backtracking it will traverse node C and then G, and here it will terminate as it found
goal node.
Depth-first search : Algorithm:

1. The algorithm takes exponential time.


2. If N is the maximum depth of a node in the search space, in the worst case the
algorithm will take time O(b^ d ).
3. The space taken is linear in the depth of the search tree, O(bN).
Depth-Limited Search Algorithm:
• A depth-limited search algorithm is similar to depth-first search with a
predetermined limit.
• Depth-limited search can solve the drawback of the infinite path in the
Depth-first search.
• In this algorithm, the node at the depth limit will treat as it has no
successor nodes further.
• Depth-limited search can be terminated with two Conditions of failure:
• Standard failure value: It indicates that problem does not have any
solution.
• Cutoff failure value: It defines no solution for the problem within a given
depth limit.
Depth-Limited Search Algorithm:
• Advantages: Depth-limited search is Memory efficient.
• Disadvantages:
• Depth-limited search also has a disadvantage of incompleteness.
• It may not be optimal if the problem has more than one solution
Depth-Limited Search Algorithm:

Completeness:
DLS search algorithm is complete if the solution is above the depth-limit.
Uniform-cost Search Algorithm:
• Uniform-cost search is a searching algorithm used for traversing a weighted
tree or graph.
• This algorithm comes into play when a different cost is available for each
edge.
• The primary goal of the uniform-cost search is to find a path to the goal
node which has the lowest cumulative cost.
• Uniform-cost search expands nodes according to their path costs form the
root node. It can be used to solve any graph/tree where the optimal cost is
in demand.
• A uniform-cost search algorithm is implemented by the priority queue. It
gives maximum priority to the lowest cumulative cost.
• Uniform cost search is equivalent to BFS algorithm if the path cost of all
edges is the same.
Uniform-cost Search Algorithm:
• Advantages:
• Uniform cost search is optimal because at every state the path with
the least cost is chosen.
• Disadvantages:
• It does not care about the number of steps involve in searching and
only concerned about path cost. Due to which this algorithm may be
stuck in an infinite loop.
Uniform-cost Search Algorithm:
Iterative deepening depth-first Search:
• The iterative deepening algorithm is a combination of DFS and BFS
algorithms.
• This search algorithm finds out the best depth limit and does it by gradually
increasing the limit until a goal is found.
• This algorithm performs depth-first search up to a certain "depth limit",
and it keeps increasing the depth limit after each iteration until the goal
node is found.
• This Search algorithm combines the benefits of Breadth-first search's fast
search and depth-first search's memory efficiency.
• The iterative search algorithm is useful uninformed search when search
space is large, and depth of goal node is unknown
Iterative deepening depth-first Search:
• Advantages:
• It combines the benefits of BFS and DFS search algorithm in terms of
fast search and memory efficiency.
• Disadvantages:
• The main drawback of IDDFS is that it repeats all the work of the
previous phase.
Iterative deepening depth-first Search:
• 1'st Iteration-----> A
2'nd Iteration----> A, B, C
3'rd Iteration------>A, B, D, E, C, F, G
4'th Iteration------>A, B, D, H, I, E, C, F, K, G
In the fourth iteration, the algorithm will
find the goal node.
Bidirectional Search Algorithm:

• Bidirectional search algorithm runs two simultaneous searches, one


form initial state called as forward-search and other from goal node
called as backward-search, to find the goal node.
• Bidirectional search replaces one single search graph with two small
subgraphs in which one starts the search from an initial vertex and
other starts from goal vertex.
• The search stops when these two graphs intersect each other.
• Bidirectional search can use search techniques such as BFS, DFS,
DLS, etc
Bidirectional Search Algorithm:

• Advantages:
• Bidirectional search is fast.
• Bidirectional search requires less memory
• Disadvantages:
• Implementation of the bidirectional search tree is difficult.
• In bidirectional search, one should know the goal state in advance.
Bidirectional Search Algorithm:
Informed(Heuristic) search
informed search strategy—one that uses problem-specific knowledge
beyond the definition of the problem itself—can find solutions more
efficiently than can an uninformed strategy.
informed search algorithm contains an array of knowledge such as how
far we are from the goal, path cost, how to reach to goal node, etc.
This knowledge helps agents to explore less to the search space and
find more efficiently the goal node.
The informed search algorithm is more useful for large search space.
Informed search algorithm uses the idea of heuristic, so it is also called
Heuristic search
Informed(Heuristic) search
Heuristics function: Heuristic is a function which is used in Informed
Search, and it finds the most promising path. It takes the current state
of the agent as its input and produces the estimation of how close
agent is from the goal.
Generate and Test Search
• Generate and Test Search is a heuristic search technique based on
Depth First Search with Backtracking which guarantees to find a
solution if done systematically and there exists a solution. In this
technique, all the solutions are generated and tested for the best
solution. It ensures that the best solution is checked against all
possible generated solutions.
• It is also known as British Museum Search Algorithm as it’s like
looking for an exhibit at random or finding an object in the British
Museum by wandering randomly.
Generate and Test Search
• Generate a possible solution. For example, generating a particular
point in the problem space or generating a path for a start state.
• Test to see if this is a actual solution by comparing the chosen point
or the endpoint of the chosen path to the set of acceptable goal
states
• If a solution is found, quit. Otherwise go to Step 1
Hill Climbing Algorithm
Simple hill climbing is the simplest way to implement a hill climbing algorithm.
It only evaluates the neighbor node state at a time and selects the first one
which optimizes current cost and set it as a current state.
It only checks it's one successor state, and if it finds better than the current
state, then move else be in the same state.
This algorithm has the following features:
• Less time consuming
• Less optimal solution and the solution is not guaranteed
Hill Climbing Algorithm
Step 1: Evaluate the starting state. If it is a goal state then stop and return success.
Step 2: Else, continue with the starting state as considering it as a current state.
Step 3: Continue step-4 until a solution is found i.e. until there are no new states left
to be applied in the current state.
Step 4: a) Select a state that has not been yet applied to the current state and apply it
to produce a new state.
b) Procedure to evaluate a new state.
i. If the current state is a goal state, then stop and return success.
ii. If it is better than the current state, then make it current state and proceed
further.
iii. If it is not better than the current state, then continue in the loop until a
solution is found.
Step 5: Exit.
Hill Climbing Algorithm
Advantages:
It is also helpful to solve pure optimization problems where the objective is to find the best
state according to the objective function.
It requires much less conditions than other search techniques.
Disadvantages :
Local Maxim
A local maxima is a state that is better than each of its neighbouring states, but not better
than some other states further away. Generally this state is lower than the global maximum.
At this point, one cannot decide easily to move in which direction.
This difficulties can be extracted by the process of backtracking i.e. backtrack to any of one
earlier node position and try to go on a different event direction.
To implement this strategy, maintaining in a list of path almost taken and go back to one of
them. If the path was taken that leads to a dead end, then go back to one of them.
Hill Climbing Algorithm
Hill Climbing Algorithm
• Ridges: A ridge is a special form of the local maximum. It has an area
which is higher than its surrounding areas, but itself has a slope, and
cannot be reached in a single move.
• Solution: With the use of bidirectional search, or by moving in
different directions, we can improve this problem
Hill Climbing Algorithm
Plateau:
A plateau is the flat area of the search space in which all the neighbor
states of the current state contains the same value, because of this
algorithm does not find any best direction to move.
A hill-climbing search might be lost in the plateau area.
Solution: The solution for the plateau is to take big steps or very little
steps while searching, to solve the problem.
Steepest-Ascent hill climbing
• The steepest-Ascent algorithm is a variation of simple hill climbing
algorithm.
• This algorithm examines all the neighboring nodes of the current
state and selects one neighbor node which is closest to the goal state.
This algorithm consumes more time as it searches for multiple
neighbor.
• Algorithm for Steepest-Ascent hill climbing:
• Step 1: Evaluate the initial state, if it is goal state then return success
and stop, else make current state as initial state
Steepest-Ascent hill climbing
• Step 2: Loop until a solution is found or the current state does not
change.
• a. Let SUCC be a state such that any successor of the current state will be better
than it.
• b. For each operator that applies to the current state:
a. Apply the new operator and generate a new state.
b. Evaluate the new state.
c. If it is goal state, then return it and quit, else compare it to the SUCC.
d. If it is better than SUCC, then set new state as SUCC.
e. If the SUCC is better than the current state, then set current state to SUCC.
Stochastic hill climbing:
• Stochastic hill climbing does not examine for all its neighbor before
moving.
• Search algorithm selects one neighbor node at random and decides
whether to choose it as ae current state or examine another stat
Simulated Annealing Algorithm
• SA is a techniques to find solutions to optimization problems.
• It is less likely to get stuck in a local minimum, where the solution is
not the best possible but is good enough
• Simulated annealing is not a guaranteed method of finding the best
solution to an optimization problem, but it is a powerful tool that can
be used to find good solutions in many cases.
Simulated Annealing Algorithm

Upon a large number of iteration, SA


converges to this solution
Simulated Annealing Algorithm
Advantages :
• Find an Optimal Solution
• Escape from local optima
• Easy to code even for complex problem
• Generally gives good solution
• ability to find solutions to problems that are difficult or impossible to
solve using other methods.
• SA are generally better than greedy algorithm, when it comes to
problems that have numerous locally optimum solution.
• SA guarantees a convergence upon running large number of iteration
Simulated Annealing Algorithm
Disdvantages :
Simulated annealing can be slow and may not always find the best
solution.
Additionally, it can be difficult to tune the parameters of the algorithm,
which can lead to sub-optimal results.
Simulated Annealing Algorithm
• Simulated annealing is a technique used in AI to find the global
optimum of a function. It is based on the idea of annealing in
metallurgy, where a metal is heated and then cooled slowly in order
to reduce the amount of defects in the metal. In the same way,
simulated annealing can be used to find the global optimum of a
function by slowly changing the values of the variables in the
function.
• The basic idea behind simulated annealing is to start with a random
solution and then slowly change the values of the variables in the
solution. The changes are made in such a way that the solution
always remains close to the current optimum. The goal is to find the
global optimum by making small changes to the solution.
Greedy best-first search
Greedy best-first search algorithm always selects the path which
appears best at that moment.
It is the combination of depth-first search and breadth-first search
algorithms.
It uses the heuristic function and search.
Best-first search allows us to take the advantages of both algorithms.
With the help of best-first search, at each step, we can choose the most
promising node.
In the best first search algorithm, we expand the node which is closest
to the goal node and the closest cost is estimated by heuristic function,
i.e. f(n)= g(n). Were, h(n)= estimated cost from node n to the goal.
Greedy best-first search
The greedy best first algorithm is implemented by the priority queue.
Best first search algorithm:
Step 1: Place the starting node into the OPEN list.
Step 2: If the OPEN list is empty, Stop and return failure.
Step 3: Remove the node n, from the OPEN list which has the lowest
value of h(n), and places it in the CLOSED list.
Step 4: Expand the node n, and generate the successors of node n.
Step 5: Check each successor of node n, and find whether any node is a
goal node or not.
If any successor node is goal node, then return success and terminate
the search, else proceed to Step 6.
Greedy best-first search
Step 6: For each successor node, algorithm checks for evaluation
function f(n), and then check if the node has been in either OPEN or
CLOSED list. If the node has not been in both list, then add it to the
OPEN list.
Step 7: Return to Step 2.
Greedy best-first search
Greedy best-first search
Greedy best-first search
Initialization: Open [A, B], Closed [S]
Iteration 1: Open [A], Closed [S, B]
Iteration2:
Open[E,F,A],Closed[S,B]
: Open [E, A], Closed [S, B, F]
Iteration3:
Open[I,G,E,A],Closed[S,B,F]
: Open [I, E, A], Closed [S, B, F, G]

Hence the final solution path will be: S----> B----->F----> G


Greedy best-first search
we use the straightline distance heuristic, which we will call hSLD .
To find a path from Arad to Bucharest.
Goal is Bucharest.
For example, hSLD (In(Arad)) = 366.
The worst-case time and space complexity for the tree version is
O(b^m), where m is the maximum depth of the search space.
With a good heuristic function, however, the complexity can be
reduced substantially.
The amount of the reduction depends on the particular problem and
on the quality of the heuristic.
Greedy best-first search
Greedy best-first search
Greedy best-first search
Greedy best-first search
A* Algorithm
A* search is the most commonly known form of best-first search.
It uses heuristic function h(n), and cost to reach the node n from the start
state g(n).
It has combined features of UCS(uniform Cost Search) and greedy best-first
search, by which it solve the problem efficiently.
A* becomes UCS if heuristic cost of every node is 0.
A* search algorithm finds the shortest path through the search space using
the heuristic function.
A* algorithm is similar to UCS except that it uses g(n)+h(n) instead of g(n).
A* Algorithm
In A* search algorithm, we use search heuristic as well as the cost to reach the
node.
Hence we can combine both costs as following, and this sum is called as
a fitness number.
F(n) = g(n) + h(n)
F(n) = Estimated Cost of the cheapest solution
g(n) = cost to each node n from start state
h(n) = Cost to reach from node n to goal node
A* Algorithm
• Step1: Place the starting node in the OPEN list.
• Step 2: Check if the OPEN list is empty or not, if the list is empty then return failure
and stops.
• Step 3: Select the node from the OPEN list which has the smallest value of
evaluation function (g+h), if node n is goal node then return success and stop,
otherwise
• Step 4: Expand node n and generate all of its successors, and put n into the closed
list. For each successor n', check whether n' is already in the OPEN or CLOSED list,
if not then compute evaluation function for n' and place into Open list.
• Step 5: Else if node n' is already in OPEN and CLOSED, then it should be attached to
the back pointer which reflects the lowest g(n') value.
• Step 6: Return to Step 2.
A* Algorithm
• Advantages:
• A* search algorithm is the best algorithm than other search algorithms.
• A* search algorithm is optimal and complete.
• This algorithm can solve very complex problems.
• Disadvantages:
• It does not always produce the shortest path as it mostly based on heuristics
and approximation.
• A* search algorithm has some complexity issues.
• The main drawback of A* is memory requirement as it keeps all generated
nodes in the memory, so it is not practical for various large-scale problems.
A* Algorithm
A* Algorithm Solution
A* Algorithm Solution
• Initialization: {(S, 5)}
• Iteration1: {(S--> A, 1+3=4), (S-->G, 10+0=10)}
• Iteration2: {(S--> A-->C, 1+1+2=4), (S--> A-->B, 1+2+4=7), (S-->G, 10)}
• Iteration3: {(S--> A-->C--->G, 1+1+4+0=6),
• (S--> A-->C--->D, 1+1+3+6=11),
• (S--> A-->B, 1+2+4=7),
• (S-->G, 10)}
• Iteration 4
• (S--> A-->C--->D->G, 1+1+3+2+0=7),
• (S--> A-->BDG, 1+2+5+2=10),
• Iteration 4 will give the final result, as S--->A--->C--->G it provides the
optimal path with cost 6.
AO* Algorithm
AO* is a heuristic search algorithm in AI

The AO* method divides any given difficult problem into a smaller
group of problems that are then resolved using the AND-OR graph
concept.
AND OR graphs are specialized graphs that are used in problems that can
be divided into smaller problems.
The AND side of the graph represents a set of tasks that must be
completed to achieve the main goal, while the OR side of the graph
represents different methods for accomplishing the same main goal.
AO* Algorithm
The evaluation function in AO* looks like this:
f(n) = g(n) + h(n)
f(n) = Actual cost + Estimated cost here,
f(n) = The actual cost of traversal.
g(n) = the cost from the initial node to the current node.
h(n) = estimated cost from the current node to the goal state.
AO* Algorithm
AO* Algorithm
We have two ways for A to D or A
to B-C (becauase of and condition)
Cost
F(A-D) = 1+10 =11
F(A-BC) = 1+1+6+12=20

Since F(A->D) < F(A-BC)


We choose the path F(A-D)
AO* Algorithm
From D we have one choice F-E
F(A-D-FE) = 1+1 + 4+4 =10
10 is the cost of reaching FE from D
New heuristic value of D =10
Cost from A-D remain same
That is 11
AO* Algorithm
F(A-BC)
From B we have two path G and H
F(B-G) = 5+1=6
F(B-H) = 7+1=8

F(B-H) > F(B-G)


So we will take path B-G
AO* Algorithm
F(A-BC)
From B we have two path G and H
F(B-G) = 5+1=6
F(B-H) = 7+1=8

F(B-H) > F(B-G)


So we will take path B-G
AO* Algorithm
Heuristic value of G to I is 1
Cost from G to I
F(GI) =1+1=2 which is less than
heuristic value 5.
So new heuristic value from G to I is 2
AO* Algorithm
A is associated with both B and C
C has only one choice
Heuristic value of C =12
Cost
F(CJ) = 1+1 =2 < heuristic value =12
New heuristic value is =2
AO* Algorithm
New Cost from ABC
F(ABC) = 1+1+2+3=7
Which is less than F(AD) =11
So choosing path from ABC is more
cost effective than that of AD

Since heuristic value is not zero for I


and j so we have not got the solution
Classification of AI
Weak AI or Narrow AI:
• able to perform a dedicated task with intelligence.
• Narrow AI cannot perform beyond its field or limitations, as it is only trained for one
specific task.
• Hence it is also termed as weak AI.
Example
Apple Siriis,
playing chess,
purchasing suggestions on e-commerce site,
self-driving cars,
speech recognition,
and image recognition.
Classification of AI
General AI:
• type of intelligence which could perform any intellectual task with efficiency like
a human.
• System which could be smarter and think like a human by its own.
• Currently, there is no such system exist .
• researchers are now focused on developing machines with General AI.
• Super AI:
• can perform any task better than human with cognitive properties.
• strong AI include capability include the ability to think, to reason,solve the
puzzle, make judgments, plan, learn, and communicate by its own
Based on functionality

• Reactive Machines
• most basic types of Artificial Intelligence
• do not store memories or past experiences for future actions.
• These machines only focus on current scenarios and react on it as per
possible best action
• Example
• IBM's Deep Blue system
• Google's AlphaGo
Based on functionality

• Limited Memory
• machines can store past experiences or some data for a short period
of time.
• Example
• Self-driving cars .
• These cars can store recent speed of nearby cars, the distance of
other cars, speed limit, and other information to navigate the road.
Based on functionality

• Theory of Mind
• Theory of Mind AI should understand the human emotions, people,
beliefs, and be able to interact socially like humans.
• Example
• This type of AI machines are still not developed, but researchers are
making lots of efforts and improvement for developing such AI
machines.
Based on functionality

• Self-Awareness
• Self-awareness AI is the future of Artificial Intelligence.
• These machines will be super intelligent, and will have their own
consciousness, sentiments, and self-awareness.
• These machines will be smarter than human mind.

• Self-Awareness AI does not exist in reality still and it is a hypothetical


concept
Agent
• An agent is anything that can be viewed as perceiving its environment
through sensors and acting upon that environment through actuators.
• A human agent has eyes, ears, and other organs for sensors and hands,
legs, vocal tract, and so on for actuators.
• A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators.
• percept to refer to the agent’s perceptual inputs at any given instant.
• agent’s percept sequence is the complete history of everything the agent
has ever perceived
Agent

Agents interact with environments through sensors and actuators.


Agent
A vacuum-cleaner world with just
two locations.

Partial tabulation of a
simple agent function
for the vacuum-cleaner
world
Agent
A rational agent is one that does the right thing.
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.
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.
Task environment
PEAS
(Performance, Environment, Actuators, Sensors)

PEAS description of the task environment for an automated taxi.


actuators
The actuators for an automated taxi include those available to a human
driver.
control over the engine through the accelerator and control over
steering 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
Agent types and their PEAS descriptions-Example
Agent types and their PEAS descriptions-Example
Agent
• Fully observable : If an agent’s sensors give it access to the complete
state of the environment at each point in time
• Partially observable because of noisy and inaccurate sensors or
because parts of the state are simply missing from the sensor data—
for example, a vacuum agent with only a local dirt sensor cannot tell
whether there is dirt in other squares, and an automated taxi cannot
see what other drivers are thinking
• If the agent has no sensors at all then the environment is
unobservable
Agent
• an agent solving a crossword puzzle by itself is clearly in a single-agent
environment,
• whereas an agent playing chess is in a two agent environment.
• If the next state of the environment is completely determined by the current state
and the action executed by the agent, then we say the environment is
deterministic;
• otherwise, it is stochastic.
• Taxi driving is clearly stochastic in this sense, because one can never predict the
behavior of traffic exactly;
• environment is uncertain if it is not fully observable or not deterministic.
• a nondeterministic environment is one in which actions are characterized by their
possible outcomes, but no probabilities are attached to them
• require the agent to succeed for all possible outcomes of its actions.
Agent
• In each episode the agent receives a percept and then performs a single action.
• The next episode does not depend on the actions taken in previous episodes.
Many classification tasks are episodic.
• For example, an agent that has to spot defective parts on an assembly line bases
each decision on the current part, regardless of previous decisions; moreover, the
current decision doesn’t affect whether the next part is defective.
• In sequential environments, on the other hand, the current decision could affect
all future decisions.
• Chess and taxi driving are sequential:
• Episodic environments are much simpler than sequential environments because
the agent does not need to think ahead
Agent
• If the environment can change while an agent is deliberating, then we say the
environment is dynamic for that agent; otherwise, it is static.
• Static environments are easy to deal with because the agent need not keep looking
at the world while it is deciding on an action, nor need it worry about the passage
of time.
• Taxi driving is clearly dynamic: the other cars and the taxi itself keep moving.
• Crossword puzzles are static.
• Discrete vs. continuous:
• applies to the state of the environment, to the way time is handled, and to the
percepts and actions of the agent.
• Chess also has a discrete set of percepts and actions
• Taxi driving is a continuous-state
• Input from digital cameras is discrete
Examples of task environments and their characteristics
Structure 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 .
• If the program is going to recommend actions like Walk, the
architecture had better have legs.
• The architecture might be just an ordinary PC, or it might be a robotic
car with several onboard computers, cameras, and other sensors.
Structure of Agents
• In general, the architecture makes the percepts from the sensors
available to the program, runs the program, and feeds the program’s
action choices to the actuators as they are generated.
• four basic kinds of agent programs
• Simple reflex agents;
• Model-based reflex agents;
• Goal-based agents; and
• Utility-based agents.
Structure of Agents
• In general, the architecture makes the percepts from the sensors
available to the program, runs the program, and feeds the program’s
action choices to the actuators as they are generated.
• four basic kinds of agent programs
• Simple reflex agents;
• Model-based reflex agents;
• Goal-based agents; and
• Utility-based agents.
The agent program for a simple reflex agent in
the two-state vacuum environment.
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

simple reflex agent, because its decision is


based only on the current location and on
whether that location contains dirt.
Simple reflex agents
• These agents select actions on the basis of the current percept, ignoring
the rest of the percept history.
• If the car in front brakes and its brake lights come on, then you should
notice this and initiate braking.
• In other words, some processing is done on the visual input to establish
the condition we call “The car in front is braking.”
• Then, this triggers some established connection in the agent program to
the action “initiate braking.”
• if car-in-front-is-braking then initiate-braking.
• car-in-front-is-braking can be determined from the current percept—a
single frame of video
Simple reflex agents-Schematic diagram of a
simple reflex agent.
Simple reflex agents-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
Simple reflex agents
Suppose that a simple reflex vacuum agent is deprived of its location
sensor and has only a dirt sensor.
Such an agent has just two possible percepts: [Dirty] and [Clean].
It can Suck in response to [Dirty]; what should it do in response to
[Clean]?
Moving Left fails (forever) if it happens to start in square A, and moving
Right fails (forever) if it happens to start in square B.
Infinite loops are often unavoidable for simple reflex agents operating
in partially observable environments.
Simple reflex agents
Escape from infinite loops is possible if the agent can randomize its
actions.
For example, if the vacuum agent perceives [Clean], it might flip a coin
to choose between Left and Right.
It is easy to show that the agent will reach the other square in an
average of two steps.
Then, if that square is dirty, the agent will clean it and the task will be
complete.
Hence, a randomized simple reflex agent might outperform a
deterministic simple reflex agent
Model-based reflex agents
• most effective way to handle partial observability
• agent should maintain some sort of internal state that depends on the
percept history and thereby reflects at least some of the unobserved
aspects of the current state.
• For the braking problem, the internal state is not too extensive— just the
previous frame from the camera, allowing the agent to detect when two
red lights at the edge of the vehicle go on or off simultaneously.
• For other driving tasks such as changing lanes, the agent needs to keep
track of where the other cars are if it can’t see them all at once.
• And for any driving to be possible at all, the agent needs to keep track of
where its keys are
Model-based reflex agents
• First, we need some information about how the world evolves
independently of the agent—
• for example, that an overtaking car generally will be closer behind than it
was a moment ago.
• Second, we need some information about how the agent’s own actions
affect the world
• —for example, that when the agent turns the steering wheel clockwise, the
car turns to the right, or that after driving for five minutes northbound on
the freeway, one is usually about five miles north of where one was five
minutes ago.
• This knowledge about “how the world works”—whether implemented in
simple Boolean circuits or in complete scientific theories—is called a model
of the world.
Model-based reflex agents
Model-based reflex agents-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

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 ← UPDATE-STATE(state, action, percept, model)
rule ← RULE-MATCH(state, rules)
action ← rule.ACTION
return action
Goal-based agents

It keeps track of the world state as well as a set of goals it is trying to achieve, and
chooses an action that will (eventually) lead to the achievement of its goals
Goal-based agents
• Expansion of Model Reflex agent based
• Desirable situation(Goal)
• Searching and planning
Goal-based agents
A goal-based agent, in principle, could reason that if the car in front has its
brake lights on, it will slow down.
Given the way the world usually evolves, the only action that will achieve
the goal of not hitting other cars is to brake.
If it starts to rain, the agent can update its knowledge of how effectively its
brakes will operate;
this will automatically cause all of the relevant behaviors to be altered to
suit the new conditions.
For the reflex agent, on the other hand, we would have to rewrite many
condition–action rules.
The goal-based agent’s behavior can easily be changed to go to a different
destination, simply by specifying that destination as the goal.
Utility-based agents
• Focus on Utility not goal
• Utility function
• Deals with happy and unhappy state
Utility-based agents
• Goals alone are not enough to generate high-quality behavior in most
environments.
• For example, many action sequences will get the taxi to its destination
(thereby achieving the goal) but some are quicker, safer, more
reliable, or cheaper than others.
• Goals just provide a crude binary distinction between “happy” and
“unhappy” states.
• A more general performance measure should allow a comparison of
different world states according to exactly how happy they would
make the agent.
• Because “happy” does not sound very scientific, economists and
computer scientists use the term utility instead
Utility-based agents
• An agent’s utility function is essentially an internalization of the
performance measure.
• If the internal utility function and the external performance measure
are in agreement, then an agent that chooses actions to maximize its
utility will be rational according to the external performance measure.
Utility-based agents
A model-based, utility-
based agent. 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
Learning agents
Learning agents
learning element, which is responsible for making improvements, and the
performance element, which is responsible for selecting external actions.
it takes in percepts and decides on actions.
learning element uses feedback from the critic on how the agent is doing and
determines how the performance element should be modified to do better in the
future.
The design of the learning element depends very much on the design of the
performance element.
When trying to design an agent that learns a certain capability, the first question is not
“How am I going to get it to learn this?” but “What kind of performance element will
my agent need to do this once it has learned how?” Given an agent design, learning
mechanisms can be constructed to improve every part of the agent.
Learning agents
The critic tells the learning element how well the agent is doing with
respect to a fixed performance standard.
The critic is necessary because the percepts themselves provide no
indication of the agent’s success.
For example, a chess program could receive a percept indicating that it has
checkmated its opponent, but it needs a performance standard to know
that this is a good thing;
The last component of the learning agent is the problem generator. It is
responsible for suggesting actions that will lead to new and informative
experiences
Learning agents
The critic observes the world and passes information along to the learning
element. For example, after the taxi makes a quick left turn across three
lanes of traffic, the critic observes the shocking language used by other
drivers. From this experience, the learning element is able to formulate a
rule saying this was a bad action, and the performance element is
modified by installation of the new rule.
Knowledge Base
• A knowledge base is a database used for knowledge sharing and
management.
• It promotes the collection, organization and retrieval of knowledge.
Many knowledge bases are structured around artificial intelligence
and not only store data but find solutions for further problems using
data from previous experience stored as part of the knowledge base.
• Knowledge management systems depend on data management
technologies ranging from relational databases to data warehouses.
Some knowledge bases are little more than indexed encyclopedic
information; others are interactive and behave/respond according to
the input prompted from the user.
Knowledge Base
• A knowledge base is not merely a space for data storage, but can be
an artificial intelligence tool for delivering intelligent decisions.
Various knowledge representation techniques, including frames and
scripts, represent knowledge. The services offered are explanation,
reasoning and intelligent decision support.
• Knowledge-based computer-aided systems engineering (KB-CASE)
tools assist designers by providing suggestions and solutions, thereby
helping to investigate the results of design decisions. The knowledge
base analysis and design allows users to frame knowledge bases, from
which informative decisions are made.
Knowledge Base
• The two major types of knowledge bases are human readable and machine
readable.
• Human readable knowledge bases enable people to access and use the
knowledge. They store help documents, manuals, troubleshooting information
and frequently answered questions.
• They can be interactive and lead users to solutions to problems they have, but
rely on the user providing information to guide the process.
• Machine readable knowledge bases store knowledge, but only in system readable
forms.
• Solutions are offered based upon automated deductive reasoning and are not so
interactive as this relies on query systems that have software that can respond to
the knowledge base to narrow down a solution.
• This means that machine readable knowledge base information shared to other
machines is usually linear and is limited in interactivity, unlike the human
interaction which is query based.
knowledge-based agent
The central component of a knowledge-based agent is its knowledge
base, or KB.
Knowledge base is a set of sentences. (It is related but not identical to
the sentences of English and other natural languages.)
Each sentence is expressed in a language called a knowledge
representation language and represents some assertion about the
world.
There must be a way to add new sentences to the knowledge base and
a way to query what is known. The standard names for these
operations are TELL and ASK, respectively
knowledge-based agent
Both operations may involve inference—that is, deriving new sentences
from old.
Inference must obey the requirement that when one ASKs a question
of the knowledge base, the answer should follow from what has been
told (or TELLed) to the knowledge base previously.
Like all our agents, it takes a percept as input and returns an action.
The agent maintains a knowledge base, KB, which may initially contain
some background knowledge
knowledge-based agent
Each time the agent program is called, it does three things.
First, it TELLs the knowledge base what it perceives.
Second, it ASKs the knowledge base what action it should perform.
In the process of answering this query, extensive reasoning may be
done about the current state of the world, about the outcomes of
possible action sequences, and so on.
Third, the agent program TELLs the knowledge base which action was
chosen, and the agent executes the action
knowledge-based agent
function KB-AGENT(percept) returns an action
persistent: KB, a knowledge base t, a counter, initially 0, indicating time
TELL(KB, MAKE-PERCEPT-SENTENCE(percept,t))
action ← ASK(KB, MAKE-ACTION-QUERY(t))
TELL(KB, MAKE-ACTION-SENTENCE(action,t))
t←t+1
return action

A generic knowledge-based agent. Given a percept, the agent adds the percept
to its knowledge base, asks the knowledge base for the best action, and tells
the knowledge base that it has in fact taken that action
By observing the environment,
Knowledge based Architecture the knowledge-based agent
(KBA) receives input from it.
The input is taken by the agent's
inference engine, which also
communicates with KB to make
decisions based on the
knowledge store in KB.
KBA's learning component
keeps the KB up to date by
learning new information.
Why use a knowledge base?

• For an agent to learn from experiences and take action based on the
knowledge, a knowledge base is required.
• Inference system
• Inference is the process of creating new sentences from existing ones.
We can add a new sentence to the knowledge base using the
inference mechanism.
• A proposition about the world is a sentence. The inference system
uses logical rules to deduce new information from the KB.
Why use a knowledge base?

• For an agent to learn from experiences and take action based on the
knowledge, a knowledge base is required.
• Inference system
• Inference is the process of creating new sentences from existing ones.
We can add a new sentence to the knowledge base using the
inference mechanism.
• A proposition about the world is a sentence. The inference system
uses logical rules to deduce new information from the KB.
• he inference system generates new facts for an agent to update the
knowledge base
Various levels of knowledge-based agent:
• Knowledge level
• where we must explain what the agent knows and what the agent's goals are.
• Let's say an automated taxi agent needs to get from station A to station B, and he
knows how to get there, so this is a knowledge problem.
• Logical level:
• how the knowledge representation of knowledge is stored at this level. Sentences are
encoded in various logics at this level.
• At the logical level, knowledge is encoded into logical statements.
• We can expect the automated taxi agent to arrive at destination B on a rational level.
• Implementation level:
• Physical representation of logic and knowledge (implementation level). Agents at the
implementation level take actions based on their logical and knowledge levels. At this
phase, an autonomous cab driver puts his knowledge and logic into action in order to
go to his destination.
Approaches to designing a knowledge-based agent:
• Building a knowledge-based agent can be done in one of two ways:
• 1.Declarative approach:
• A knowledge-based agent can be created by starting with an empty
knowledge base and informing the agent all the sentences we wish to
start with.
Declarative approach is the name given to this method.
• 2. Procedural technique:
• We directly express desired behavior as a program code in the
procedural approach.
• develop a program that already has the intended behavior or agent
encoded in it.
Techniques of knowledge representation

Four ways of knowledge representation


• Logical Representation
• Semantic Network Representation
• Frame Representation
• Production Rules
Techniques of knowledge representation

• Logical Representation
• It's made up of well-defined syntax and semantics that facilitate sound
inference. Each sentence could be translated into logics using the syntax
and semantics.
• Semantic Network Representation
• We can express our knowledge in Semantic Networks as graphical
networks.
• This network is made up of nodes that represent things and arcs that
describe their relationships.
• Semantic networks may classify objects in a variety of ways and link them
together.
Techniques of knowledge representation

• Jerry is a cat.
• Jerry is a mammal.
• Jerry is owned by Priya.
• Jerry is brown colored.
• All Mammals are animal.
Techniques of knowledge representation

• Jerry is a cat.
• Jerry is a mammal.
• Jerry is owned by Priya.
• Jerry is brown colored.
• All Mammals are animal.
Frame Representation
• A frame is a record-like structure that contains a set of properties and
their values to describe a physical thing. Frames are a sort of artificial
intelligence data structure that splits knowledge into substructures.
• It is made up of a set of slots and slot values
Production Rules
• Production rules system consists of (condition, action) pairs which
means, "If condition then action“.
Example:
IF (at bus stop AND bus arrives) THEN action (get into the bus)
• Working memory stores a description of the present state of
problem-solving, and rules can be used to write knowledge to it.
Other rules may be triggered by this knowledge.

If a new scenario (state) arises, numerous production rules will be


fired at the same time, which is known as a conflict set. In this case,
the agent must choose a rule from among these sets, and it is called a
recognize-act cycle.
References
Artificial Intelligence, A Modern Approach, Third Edition, Stuart J. Russell and Peter Norvig ,
Intelligent Computing: The Latest Advances, Challenges and Future, Shiqiang Zhu∗ et al
Computational Intelligence A Logical Approach by David Poole, Alan Mackworth, Randy Goebel.
P.J.M van Laarhoven, E.H.L, Arts, Simulated Annealing: Theory and Application
Rich Elaine, Knight Kevin, Nair S.B. Artificial Intelligence, 3rd Edition, Tata Mc. Graw Hill.
Padhy N.P. Simon S.P. Soft Computing: with Matlab Programming, Oxford University Press, 2015.

Online:
https://en.wikipedia.org/wiki/Computing.
https://www.cs.ubc.ca/~poole/ci/slides/ch1/html.html
http://www.cs.mun.ca/~oram/cs3754/AI6.pdf
https://courses.engr.illinois.edu/cs440/fa2018/Lectures/Bonnie-Dorr-4queens.pdf
https://www.javatpoint.com/ai-uninformed-search-algorithms#:~:text=Uniform%2Dcost%20search%20is%20a,has%20the%20lowest%20cumulative%20cost.
https://www.javatpoint.com/ai-informed-search-algorithms#:~:text=But%20informed%20search%20algorithm%20contains,useful%20for%20large%20search%20space.
https://www.brainkart.com/article/Hill-Climbing-Search-Algorithm--Concept,-Algorithm,-Advantages,-Disadvantages_8885/
https://www.aiforanyone.org/glossary/simulated-annealing
https://www.javatpoint.com/types-of-artificial-intelligence
https://www.youtube.com/watch?v=mtSn_Lh750g
https://www.techopedia.com/definition/2511/knowledge-base-klog
https://tutorialforbeginner.com/knowledge-based-agent-in-ai
https://www.javatpoint.com/ai-informed-search-algorithms

You might also like