AI Unit-1
AI Unit-1
INTELLIGENCE
What is Artificial Intelligence?
• It is a branch of Computer Science that pursues creating the
computers or machines as intelligent as human beings.
• It is the science and engineering of making intelligent machines,
especially intelligent computer programs.
• It is related to the similar task of using computers to understand
human intelligence, but AI does not have to confine itself to methods
that are biologically observable
Definition: Artificial Intelligence is the study of how to make computers do things,
which, at the moment, people do better.
According to the father of Artificial Intelligence, John McCarthy, it is “The science
and engineering of making intelligent machines, especially intelligent computer
programs”.
Artificial Intelligence is a way of making a computer, a computer-controlled robot,
or a software think intelligently, in the similar manner the intelligent humans think.
AI is accomplished by studying how human brain thinks and how humans learn,
decide, and work while trying to solve a problem, and then using the outcomes of
this study as a basis of developing intelligent software and systems.
From a business perspective AI is a set of very powerful tools, and methodologies
for using those tools to solve business problems.
From a programming perspective, AI includes the study of symbolic programming,
problem solving, and search.
AI Vocabulary
1. Intelligence
2. Intelligent behaviour
3. Science based goals of AI
4. Engineering based goals of AI
5. AI Techniques
6. Learning
7. Applications of AI
Problems of AI
• Intelligence does not imply perfect understanding; every intelligent being has
limited perception, memory and computation. Many points on the spectrum of
intelligence versus cost are viable, from insects to humans. AI seeks to
understand the computations required from intelligent behavior and to produce
computer systems that exhibit intelligence. Aspects of intelligence studied by AI
include perception, communicational using human languages, reasoning,
planning, learning and memory.
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?
Branches of AI
• Logical AI
• Search
• Pattern Recognition
• Representation
• Inference
• Common sense knowledge and Reasoning
• Learning from experience
• Planning
• Epistemology
• Ontology
• Heuristics
AI Technique
Artificial Intelligence research during the last three decades has concluded that
Intelligence requires knowledge. To compensate overwhelming quality, knowledge
possesses less desirable properties.
A. It is huge.
B. It is difficult to characterize correctly.
C. It is constantly varying.
D. It differs from data by being organized in a way that corresponds to its
application.
E. It is complicated.
An AI technique is a method that exploits knowledge
that is represented so that:
• The knowledge captures generalizations that share properties, are grouped
together, rather than being allowed separate representation.
• It can be understood by people who must provide it—even though for many
programs bulk of the data comes automatically from readings.
• In many AI domains, how the people understand the same people must supply
the knowledge to a 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.
• It can be used to help overcome its own sheer bulk by helping to narrow the
range of possibilities that must be usually considered
Tic-Tac-Toe
• Let us consider Question Answering systems that accept input in English and
provide answers also in English. This problem is harder than the previous one as it
is more difficult to specify the problem properly. Another area of difficulty
concerns deciding whether the answer obtained is correct, or not, and further
what is meant by ‘correct’. For example, consider the following situation:
1.1 Text
• Rani went shopping for a new Coat.
• She found a red one she really liked. When she got home, she found that it went
perfectly with her favourite dress.
1.2 Question
1. What did Rani go shopping for?
2. What did Rani find that she liked?
3. Did Rani buy anything?
Method 1
Data Structures:
A set of templates that match common questions and produce patterns used to
match against inputs. Templates and patterns are used so that a template that
matches a given question is associated with the corresponding pattern to find the
answer in the input text. For example, the template who did x y generates x y z if a
match occurs and z is the answer to the question. The given text and the question
are both stored as strings.
Algorithm:
Answering a question requires the following steps to be followed:
• Compare the template against the questions and store all successful matches to
produce a set of text patterns.
• Pass these text patterns through a substitution process to change the person or
voice and produce an expanded set of text patterns.
• Apply each of these patterns to the text; collect all the answers and then print the
Example
In question 1 we use the template WHAT DID X Y which generates Rani go shopping
for z and after substitution we get Rani goes shopping for z and Rani went shopping
for z giving z [equivalence] a new coat.
The word ‘search’ refers to the search for a solution in a problem space.
• Search proceeds with different types of ‘search control strategies’.
• A strategy is defined by picking the order in which the nodes expand.
The Search strategies are evaluated along the following dimensions:
Completeness, Time complexity, Space complexity, Optimality (the search-
related terms are first explained, and then the search algorithms and control
strategies are illustrated next).
Search-related terms
Performance of an algorithm depends on internal and external factors.
Informed search algorithms use heuristic functions that are specific to the
problem, apply them to guide the search through the search space to try to
reduce the amount of time spent in searching.
A good heuristic will make an informed search dramatically outperform any
uninformed search where the goal is to find is a good solution instead of
finding the best solution
Some prominent intelligent search algorithms are stated below
1. Generate and Test Search
2. Best-first Search
3. Greedy Search
4. A* Search
5. Constraint Search
6. Means-ends analysis
There are some more algorithms. They are either improvements or combinations of these.
• Hierarchical Representation of Search Algorithms: A Hierarchical representation of most
search algorithms is illustrated below. The representation begins with two types of search:
• Uninformed Search: Also called blind, exhaustive or brute-force search, it uses no
information about the problem to guide the search and therefore may not be very
efficient.
• Informed Search: Also called heuristic or intelligent search, this uses information about
the problem to guide the search—usually guesses the distance to a goal state and is
therefore efficient, but the search may not be always possible
Different Search Algorithm
• Search Technique Require
The first requirement is that it causes motion
In a game playing program, it moves on the board and in the water jug
problem, filling water is used to fill jugs.
The second requirement is that it is systematic
It corresponds to the need for global motion as well as for local motion. This is
a clear condition that neither would it be rational to fill a jug and empty it
repeatedly, nor it would be worthwhile to move a piece round and round on
the board in a cyclic way in a game.
Breadth-first search
• A Search strategy, in which the highest layer of a decision tree is
searched completely before proceeding to the next layer is called
Breadth-first search (BFS).
• In this strategy, no viable solutions are omitted and therefore it is
guaranteed that an optimal solution is found.
• This strategy is often not feasible when the search space is large.
Algorithm
1. Create a variable called LIST and set it to be the starting state.
2. Loop until a goal state is found or LIST is empty, Do
a. Remove the first element from the LIST and call it E. If the LIST is
empty, quit.
b. For every path each rule can match the state 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 LIST.
Advantages
1. Guaranteed to find an optimal solution (in terms of shortest number of steps to
reach the goal).
2. Can always find a goal node if one exists (complete).
Disadvantages
1. High storage requirement: exponential with tree depth.
Depth-first search
• A search strategy that extends the current path as far as possible
before backtracking to the last choice point and trying the next
alternative path is called Depth-first search (DFS).
• This strategy does not guarantee that the optimal solution has been
found.
• In this strategy, search reaches a satisfactory solution more rapidly
than breadth first, an advantage when the search space is large.
Algorithm
• Depth-first search applies operators to each newly generated state, trying to drive
directly toward the goal.
1. If the starting state is a goal state, quit and return success.
2. Otherwise, do the following until success or failure is signalled:
a. Generate a successor E to the starting state. If there are no more successors,
then signal failure.
b. Call Depth-first Search with E as the starting state.
c. If success is returned signal success; otherwise, continue in the loop.
Advantages
1. Low storage requirement: linear with tree depth.
2. Easily programmed: function call stack does most of the work of maintaining
state of the search.
Disadvantages
2. May find a sub-optimal solution (one that is deeper or more costly than the
best solution).
3. Incomplete: without a depth bound, may not find a solution even if one exists.
Bounded depth-first search
Depth-first search can spend much time (perhaps infinite time) exploring a very
deep path that does not contain a solution, when a shallow solution exists. An
easy way to solve this problem is to put a maximum depth bound on the
search. Beyond the depth bound, a failure is generated automatically without
exploring any deeper.
Problems:
1. It’s hard to guess how deep the solution lies.
2. If the estimated depth is too deep (even by 1) the computer time used is
dramatically increased, by a factor of bextra.
3. If the estimated depth is too shallow, the search fails to find a solution; all
that computer time is wasted.
Heuristics
A heuristic is a method that improves the efficiency of the search process.
These are like tour guides. Heuristics may not find the best solution every time
but guarantee that they find a good solution in a reasonable time.
These are particularly useful in solving tough and complex problems, solutions
of which would require infinite time, i.e. far longer than a lifetime for the
problems which are not solved in any other way.
Heuristic search
To find a solution in proper time rather than a complete solution in unlimited
time we use heuristics. ‘A heuristic function is a function that maps from
problem state descriptions to measures of desirability, usually represented as
numbers’.
These heuristic search methods use heuristic functions to evaluate the next
state towards the goal state.
• Finding a route from one city to another city is an example of a search
problem in which different search orders and the use of heuristic knowledge
are easily understood.