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

Artificial Intelligence Dhanya P.M, Lecturer in DCS, RASET

Artificial intelligence (AI) is the science and engineering of creating intelligent machines, especially computer programs. It is related to understanding human intelligence but is not confined to biologically observable methods. There are several branches of AI including logical AI, search, pattern recognition, representation, inference, commonsense reasoning, learning from experience, planning, epistemology, ontology, heuristics, and genetic programming. Key applications of AI include game playing, speech recognition, natural language understanding, computer vision, and expert systems.

Uploaded by

Blue Ray
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
69 views

Artificial Intelligence Dhanya P.M, Lecturer in DCS, RASET

Artificial intelligence (AI) is the science and engineering of creating intelligent machines, especially computer programs. It is related to understanding human intelligence but is not confined to biologically observable methods. There are several branches of AI including logical AI, search, pattern recognition, representation, inference, commonsense reasoning, learning from experience, planning, epistemology, ontology, heuristics, and genetic programming. Key applications of AI include game playing, speech recognition, natural language understanding, computer vision, and expert systems.

Uploaded by

Blue Ray
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 34

ARTIFICIAL INTELLIGENCE

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. Artificial Intelligence is the branch of computer science concerned with the
study and creation of computer systems
-that exhibit some form of intelligence .
-that learn new concepts and tasks.
-that can reason and draw useful conclusions about the world around us.
-systems that can understand a natural language or perceive and comprehend a
visual scene.

Intelligence is the ability to acquire ,understand and apply knowledge or the ability to
exercise thought and reason.

Knowledge can be defined


-as the body of facts and principles accumulated by human kind .
-as act,fact or state of knowing.
-having familiarity with language,concepts,procedures ,rules,ideas,places, and to use
these notions effectively in modeling different aspects of the world around us.

Knowledge can be divided in to 3 categories.


1)procedural knowledge-compiled knowledge related to some task.Eg:-Steps required
to solve some equations.
2)Declarative knowledge-passive knowledge expressed as statements of facts about the
world.
3)Heuristic knowledge-special type of knowledge used to solve complex problems.

Knowledge is different from data.A physician uses both knowledge and data.Data is the
patients record like his history,drugs,response to drugs,whereas knowledge is what
physician has learned in medical colleges.

Artificial Intelligence Dhanya P.M, lecturer in DCS, RASET 1


Branches of AI
.
logical AI
What a program knows about the world in general the facts of the specific situation in
which it must act, and its goals are all represented by sentences of some mathematical
logical language. The program decides what to do by inferring that certain actions are
appropriate for achieving its goals

search
AI programs often examine large numbers of possibilities, e.g. moves in a chess game
or inferences by a theorem proving program. Discoveries are continually made about
how to do this more efficiently in various domains.
pattern recognition
When a program makes observations of some kind, it is often programmed to
compare what it sees with a pattern. For example, a vision program may try to match
a pattern of eyes and a nose in a scene in order to find a face. More complex patterns,
e.g. in a natural language text, in a chess position, or in the history of some event are
also studied. These more complex patterns require quite different methods than do the
simple patterns that have been studied the most.
representation
Facts about the world have to be represented in some way. Usually languages of
mathematical logic are used.
inference
From some facts, others can be inferred.. For example, when we hear of a bird, we
man infer that it can fly, but this conclusion can be reversed when we hear that it is a
penguin
common sense knowledge and reasoning

Artificial Intelligence Dhanya P.M, lecturer in DCS, RASET 2


This is the area in which AI is farthest from human-level, in spite of the fact that it
has been an active research area since the 1950s. The Cyc system contains a large but
spotty collection of common sense facts.
learning from experience
Programs do that. The approaches to AI based on connectionism and neural nets
specialize in that. There is also learning of laws expressed in logic. Programs can only
learn what facts or behaviors their formalisms can represent, and unfortunately
learning systems are almost all based on very limited abilities to represent
information.
planning
Planning programs start with general facts about the world (especially facts about the
effects of actions), facts about the particular situation and a statement of a goal. From
these, they generate a strategy for achieving the goal. In the most common cases, the
strategy is just a sequence of actions.
epistemology
This is a study of the kinds of knowledge that are required for solving problems in the
world. Epistemology is the branch of philosophy that studies knowledge. It attempts
to answer the basic question: what distinguishes true (adequate) knowledge from false
(inadequate) knowledge?

ontology
Ontology is the study of the kinds of things that exist. In AI, the programs and
sentences deal with various kinds of objects, and we study what these kinds are and
what their basic properties are. Emphasis on ontology begins in the 1990s. An
ontology is an explicit specification of a conceptualization. The term is borrowed
from philosophy, where an Ontology is a systematic account of Existence. For AI
systems, what "exists" is that which can be represented. When the knowledge of a
domain is represented in a declarative formalism, the set of objects that can be
represented is called the universe of discourse. This set of objects, and the describable
relationships among them, are reflected in the representational vocabulary with which
a knowledge-based program represents knowledge. Thus, in the context of AI, we can
describe the ontology of a program by defining a set of representational terms. In
such an ontology, definitions associate the names of entities in the universe of
discourse (e.g., classes, relations, functions, or other objects) with human-readable
text describing what the names mean, and formal axioms that constrain the
interpretation and well-formed use of these terms. Formally, an ontology is the
statement of a logical theory
heuristics
A heuristic is a way of trying to discover something or an idea imbedded in a
program. The term is used variously in AI. Heuristic functions are used in some
approaches to search to measure how far a node in a search tree seems to be from a

Artificial Intelligence Dhanya P.M, lecturer in DCS, RASET 3


goal. Heuristic predicates that compare two nodes in a search tree to see if one is
better than the other, i.e. constitutes an advance toward the goal, may be more useful.
genetic programming
Geneting programming (GP) is an automated method for creating a working
computer program from a high level problem statement of a problem.GP delivers
high return,human competitive machine intelligence.Human competitive means that
the result should be equal to or better than the most recent human created solution to a
long standing problem.The result should win a regulated competition involving
human contestants.
Applications of AI
game playing
You can buy machines that can play master level chess for a few hundred dollars.
There is some AI in them, but they play well against people mainly through brute
force computation--looking at hundreds of thousands of positions. To beat a world
champion by brute force and known reliable heuristics requires being able to look at
200 million positions per second.

speech recognition
In the 1990s, computer speech recognition reached a practical level for limited
purposes. Thus United Airlines has replaced its keyboard tree for flight information
by a system using speech recognition of flight numbers and city names. It is quite
convenient. On the the other hand, while it is possible to instruct some computers
using speech, most users have gone back to the keyboard and the mouse as still more
convenient.
understanding natural language
Just getting a sequence of words into a computer is not enough. Parsing sentences is
not enough either. The computer has to be provided with an understanding of the
domain the text is about, and this is presently possible only for very limited domains.
computer vision
The world is composed of three-dimensional objects, but the inputs to the human eye
and computers' TV cameras are two dimensional. Some useful programs can work
solely in two dimensions, but full computer vision requires partial three-dimensional
information that is not just a set of two-dimensional views. At present there are only
limited ways of representing three-dimensional information directly, and they are not
as good as what humans evidently use.
expert systems
A ``knowledge engineer'' interviews experts in a certain domain and tries to embody
their knowledge in a computer program for carrying out some task. How well this
works depends on whether the intellectual mechanisms required for the task are
within the present state of AI. When this turned out not to be so, there were many
disappointing results. One of the first expert systems was MYCIN in 1974, which

Artificial Intelligence Dhanya P.M, lecturer in DCS, RASET 4


diagnosed bacterial infections of the blood and suggested treatments. It did better than
medical students or practicing doctors, provided its limitations were observed.
Namely, its ontology included bacteria, symptoms, and treatments and did not include
patients, doctors, hospitals, death, recovery, and events occurring in time. Its
interactions depended on a single patient being considered. Since the experts
consulted by the knowledge engineers knew about patients, doctors, death, recovery,
etc., it is clear that the knowledge engineers forced what the experts told them into a
predetermined framework. In the present state of AI, this has to be true. The
usefulness of current expert systems depends on their users having common sense.
heuristic classification
One of the most feasible kinds of expert system given the present knowledge of AI is
to put some information in one of a fixed set of categories using several sources of
information. An example is advising whether to accept a proposed credit card
purchase. Information is available about the owner of the credit card, his record of
payment and also about the item he is buying and about the establishment from which
he is buying it (e.g., about whether there have been previous credit card frauds at this
establishment).

AI PROBLEMS
1) TIC-TAC-TOE

TIE

O LOSES

BOARD :Consists of nine elements ,where the elements of the vector


corresponds to the board positions

Artificial Intelligence Dhanya P.M, lecturer in DCS, RASET 5


1 2 3
4 5 6
7 8 9

We store 2(indicating blank),3(indicating X),5 (indicating O).

Turn: An integer indicating which move the game is about to be played.


1-indicates the first move ,9 indicates the last move.

Method: Game is between two persons odd and even.Odd places X and even places
O.A person wins if his letter comes in all vertical ,horizontal and diagonal lines.

The algorithm make use of the procedures


1)make2:-returns 5 if the center square of the board is blank,that is board[5]=2.Otherwise
the function returns any blank non corner squares(2,4,6,8).

2)posswin(p):-returns 0 if the player p cannot win in his next move


Else
Returns the number of the square that constitute a winning
move.
If the product is 18 (3x3x2) then X will win
If the product is 50(5x5x2) then O will win.

3)Go(n)-makes a move in square n


Board[n]=3,if turn is odd.
Board[n]=5,if turn is even.
Turn=Turn+1.
Method
Turn=1 Go(1)(Upper left corner)
Turn=2 if Board[5]=blank;Go(5),else Go(1)
Turn=3 if Board[9]=blank;Go(9) else Go(3)
Turn=4 if posswin(X) # 0,then Go(posswin(X))(ie,block opponents win)
Else Go(make2)
Turn=5 if posswin(X) # 0 then
Go(posswin(X)) (ie win)
Else if posswin(O)# 0 then
Go(posswin(O))(ie block win)
Else if board[7]=blank then
Go(7)
Else Go(3).

Turn=6 if posswin(O) # 0 then Go(posswin(0))


Else if posswin(X) # 0 then Go(posswin(X))
Else Go(make2)

Artificial Intelligence Dhanya P.M, lecturer in DCS, RASET 6


Turn=7 if posswin(X)#0,then Go(posswin(X))
Else if posswin(O)# 0 then Go(posswin(O)
Else go any where that is blank
Turn=8 if posswin(O) # 0 then Go(posswin(O)
Else if posswin(X)# 0 then Go(posswin(X))
Else go any where that is blank.
Turn=9 same as Turn=7.

2) 8 Puzzle

An 8 puzzle is a simple game consisting of a 3 x 3 grid (containing 9 squares).


One of the squares is empty.
The object is to move to squares around into different positions and having the
numbers displayed in the "goal state".
The image to the left can be thought of as an unsolved initial state of the "3 x 3" 8
puzzle.

Here is the shortest solution generated by the 8 puzzle program for the initial state
given above. (The program animates through each game state)

Artificial Intelligence Dhanya P.M, lecturer in DCS, RASET 7


+-----+
|8 3 5|
|4 1 6|
|2 7 |
+-----+

+-----+
|8 3 5|
|4 1 |
|2 7 6|
+-----+

+-----+
|8 3 |
|4 1 5|
|2 7 6|
+-----+

+-----+
|8 3|
|4 1 5|
|2 7 6|
+-----+

+-----+
|8 1 3|
|4 5|
|2 7 6|
+-----+

+-----+
|8 1 3|
| 4 5|
|2 7 6|
+-----+

+-----+
|8 1 3|
|2 4 5|
| 7 6|
+-----+

+-----+
|8 1 3|
|2 4 |
|7 6 5|
+-----+

+-----+
|8 1 3|
|2 4|
|7 6 5|
+-----+

Artificial Intelligence Dhanya P.M, lecturer in DCS, RASET 8


+-----+
|8 1 3|
| 2 4|
|7 6 5|
+-----+

+-----+
| 1 3|
|8 2 4|
|7 6 5|
+-----+

+-----+
|1 3|
|8 2 4|
|7 6 5|
+-----+

+-----+
|1 2 3|
|8 4|
|7 6 5|
+-----+

Total Number of moves: 14


A search tree for 8-puzzle.

Artificial Intelligence Dhanya P.M, lecturer in DCS, RASET 9


3) 8-Queens Problem
This problem is to place 8 queens on the chess board so that they do not check each other.
For 8-queen, we have 92 solutions. If we exclude symmetry, there are 12 solutions.
8-queens problem n=8

7 X

6 X

5 X

4 X

3 X

2 X

1 X

0 X

0 1 2 3 4 5 6 7

Recursive solution for 8-queens


PlaceNextQueen(Column)

if (Column > 8) problem is solved;

else {

while (unconsidered squares exist in the column and problem is unsolved)

{ determine next square that is not under attack by queen in an


column;

if (such a square exists)

{ place queen; PlaceNextQueen(Column+1)

if (No queen is possible in column Column+1)

remove queen from column Column and consider next


square in the column.

Artificial Intelligence Dhanya P.M, lecturer in DCS, RASET 10


}//if

} //while

}//else

EIGHT QUEENS PROBLEM


Given:
• an 8 x 8 chess board
• 8 chess queen pieces

Objective:
• To find all 92 possible ways of placing 8 queens on a chess board such that no
two queens can cancel each other.
• Develop a recursive algorithm for finding the solution to this problem.
To solve the 8 queens problem, start by superimposing the chess board on a on a
cartesian coordinate plane.

Observe that the queen's move can be described mathematically and


represented by linear functions as follows:

MOVES FUNCTIONS RANGE OF VALUES

vertical moves: x=c 0 <= x <= 7


horizontal moves: y=c 0 <= y <= 7
left diagonal moves: y=–x+b 0 <= b <= 14
right diagonal moves: y=x+b – 7 <= b <= 7

One possible approach is to use arrays of boolean, say:


bool yvalue [ 8 ] ;
bool leftb [ 15 ] ;
bool rightb [ 15 ] ;
In addition, have say:
int position [ 8 ] ;
bool okay ;
To indicate that all squares on the chess board are initially available:

Artificial Intelligence Dhanya P.M, lecturer in DCS, RASET 11


for ( i = 0; i <= 7; i++ )
yvalue [ i ] = true;

for ( i = 0; i <= 14; i++ )


{
leftb [ i ] = true ;
rightb [ i ] = true ;
}
To check if ( x, y ) is an available position for the next queen:
okay = yvalue [ y ] + leftb [ y + x ] + rightb [ y - x + 7 ] ;
If okay, then place the next queen on the board:
yvalue [ y ] = false ;
leftb [ y + x ] = false ;
rightb [ y - x + 7 ] = false ;
To record the queen's position:
position [ x ] = y ;
When backtracking, a queen may have to be removed from the board as follows
yvalue [ y ] = true ;
leftb [ y + x ] = true;
rightb [ y - x + 7 ] = true;

Water –jug problem


Problem: You are given two jugs, a 4-gallon one and a 3-gallon
one. Neither has any measuring marks on it. There is a pump that can
be used to fill the jugs with water. How can you get exactly 2 gallons
of water in the 4-gallon jug?

A state in this problem may be represented as a two-tuple (x,y),


where
x stands for the amount of water in the 4-gallon jug, and
y denotes the amount of water in the 3-gallon jug.

The initial state is <0,0> and the goal state is (2,0)

An OPERATOR is knowledge of an action possible in the world.

This kind of world knowledge can be represented in the LANGUAGE of


PRODUCTION RULES.

Production rules offer one language for representing some kinds of


knowledge including that of operations (that is, knowledge of the
actions that can be performed in the world).

For this example, all ten basic operations can be represented in the
language of production rules as follows:

Artificial Intelligence Dhanya P.M, lecturer in DCS, RASET 12


R1: (x,y) --> (4,y)
if x < 4
R2: (x,y) --> (x,3)
if y < 3
R3: (x,y) --> (x-d,y)
if x > 0
R4: (x,y) --> (x,y-d)
if y > 0
R5: (x,y) --> (0,y)
if x > 0
R6: (x,y) --> (x,0)
if y > 0
R7: (x,y) --> (4,y-(4-x))
if x+y >= 4 and y > 0
R8: (x,y) --> (x-(3-y),y)
if x+y >= 3 and x > 0
R9: (x,y) --> (x+y,0)
if x+y =< 4 and y > 0
R10: (x,y) --> (0,x+y)
if x+y =< 3 and x > 0

A possible solution to the water jug problem is

x y Rule
applied

s1 0 0
R2
s2 0 3
R9
s3 3 0
R2
s4 3 3
R7
s5 4 2
R5
s6 0 2

Artificial Intelligence Dhanya P.M, lecturer in DCS, RASET 13


R9
s7 2 0

4. Problem Spaces and Representation of Problem Solving

Together the problem and the operators characterize the problem space
associated with the problem:

(i) the initial state,


(ii) the goal state,
(iii) the operators that can transform one state into another, and
(iv) the states of that can be generated by applying the operators

The problem space is a ``virtual'' space that can be generated by


applying the operators.

Problem solving, i.e., search through a problem space, can be


represented as a tree.

The problem solving in the water jug example can be represented as the
following tree:

<0, 0>
/ \
R1 R2
<0, 3>
/ |...\
/ |... \
R1 R4... R9
<3, 0>
/ | \
/ | \
R2 R3 R5
<3, 3>
/ |...\...
/ |... \...
R1 R3 R7
<4, 2>
/ |...\...
/ |... \...
R2 R3 R5
<0, 2>
/ | \
/ | \

Artificial Intelligence Dhanya P.M, lecturer in DCS, RASET 14


R1 R7 R9
<2, 0>

Problem Characteristics:-
Inorder to choose the most appropriate method for a particular problem,it is necessary to
analyze the problem along several key dimensions .

1)Is the problem decomposable into a set of independent smaller or easier sub problems.

Consider the problem of computing the solution for the expression.

∫ (x2 + 3x +sin2x.cos2x) dx

∫ ∫ ∫
x2dx 3xdx sin2xcos2xdx
X3/3 3 ∫ x dx ∫ (1-cos2x)cos2x dx

3x2/2 ∫ cos2x dx - ∫ cos4xdx

The problem can be solved by dividing it in to a no of sub problems and solving it.

2)Can the solution steps be undone or ignored?

Consider the 8 puzzle problem


2 8 3

1 6 4

7 5

2 3

8 4

Artificial Intelligence Dhanya P.M, lecturer in DCS, RASET 15


7 6 5

In attempting to solve the 8 puzzle,we might make a stupid move by moving tile 5 in to
the empty space .Now we backtrack and undo the first move sliding tile 5 back in
to the first move ,sliding tile 5 back to where it was.Then we can move tile 6.The
control mechanism for the 8 puzzle must keep track of the order in which
operations are performed so that the operations can be undone one at a time.

3)Is the universe predictable?

Consider the 8 puzzle problem.Every time we make a move we know exactly what
is happening.it is possible to plan the entire sequence of moves to avoid having to
undo it.But in case of chess we can’t plan the entire sequence because it depends on
how the other pklayer plays.

4)Is a good solution absolute or relative?

Consider the problem of answering questions based on database of simple facts,such as


the following

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 volcano erupted in 79 A.D.

6.No mortal lives longer than 150 years.

7.It is now 1991 A.D

Suppose we want to find the answer to the question Is marcus alive? It can be found in 2
ways.

Solution 1

1. Marcus was a man 1

2 All men are mortal. 4

3.Marcus is mortal 1,4

Artificial Intelligence Dhanya P.M, lecturer in DCS, RASET 16


4. marcus was born in 40 A.D. 3

5. It is now 1991 A.D 7

6.marcu’s age is 1951 years 3,7

7 No mortal lives longer than 150 years. 6.

8.marcus is dead 3,7,6.

Solution 2

1. It is now 1991 A.D 7

2. All pompeians died when volcano erupted in 79 A.D 5

3.All pompeians are dead now 7,5

4.Marcus was a Pompeian 2

5.Marcus is dead 7,5,2

Since we are interested in only answers to the question ,it doesnot matter which path we
follow.

But suppose we consider the traveling sales man problem ,our goal is to find out the
shortest city that visits each city exactly once.Suppose the cities to be visited and
their distances are ordered like this

Boston Newyork Miami Dallas S.F


Boston 250 1450 1700 3000
Newyork 250 1200 1500 2900
Miami 1450 1200 1600 3300
Dallas 1700 1500 1600 1700
S.F 3000 2900 3300 1700

Two paths the sales man can follow is

Artificial Intelligence Dhanya P.M, lecturer in DCS, RASET 17


Boston

S.F New york

Dallas Miami

newyork dallas

miami San
francisco
boston
boston

8850 7750

Total :3000+1700+1500+1200+1450=8850

Total: 250+1200+1600+1700+3000=7750

These 2 problems shows the difference between the any path problem and the best path
problem.

Search techniques
Having formulated the problems ,solution for them is found out by a search through the
state space.

Search tree

All the search techniques uses asearch tree that is generated by the initial state and the
successor function.When same state is reached from multiple paths the tree
becomes a graph.

Search node

The root of the search tree is a search node corresponding to the initial state.This is
checked against the goal state.If not then iit is expanded with the successor function
by generating a new set of states.The choice of which state to expand is determined
by the search strategy.

Search strategies can be divided in to 2

Artificial Intelligence Dhanya P.M, lecturer in DCS, RASET 18


i)Uninformed search(blind search)

2)Informed search(heuristic search)

Uninformed search

Means that they have no additional information regarding the states beyond that provided
in the problem definition.All they can do is to generate successors and distinguish a
goal state from a non goal state.it is blind search in which the nodes are explored in
the predefined order.An uninformed search is available with a start state,search
algorithm and a test for the goal state.

1)BFS

2)DFS

3)uniform cost search

4)depth limited search

5)iterative deepening search

6)bidirectional search

1)Breadth first search

Searches are performed by exploring all the nodes at a given depth before proceeding to
the next level.

Algorithm

1.Place the starting node S on the queue.

2.If the queue is empty ,return failure AND STOP.

3.If the first element on the queue is a goal node g return success and stop.

Else remove and expand the first element from the queue and place all the children at

the end of the queue in any order.

3.return to step 2.

LEVEL 1

Artificial Intelligence Dhanya P.M, lecturer in DCS, RASET 19


A

B C

LEVEL 3

B C

D E F G

Artificial Intelligence Dhanya P.M, lecturer in DCS, RASET 20


Advantages of BFS

1)If there is a path BFS is guaranteed to find it.Further if there is a multiple solution,then
a minimal solution will be found.

2)Longer paths are never explored until al shorter ones are examined.

2)Depth First Search

A child is generated from the most recently expanded node ,then generating the child’s
children and so on until a goal is found.

Artificial Intelligence Dhanya P.M, lecturer in DCS, RASET 21


Algorithm

1)Place the starting node S on the stack.

2)If the stack is empty,return failure and stop.

3)If the first element on the stack is a goal node g,return success and stop.

Artificial Intelligence Dhanya P.M, lecturer in DCS, RASET 22


Else

Remove and expand first element and place the children at the top of the stack.

4).return to step 2.

Advantages

1)requires only less memory since only the nodes on the current path are made.

2)By chance DFS may find a solution without examining much of the search space at all.

3)Uniform cost search

This method expands the node n with the lowest path cost.If all the step cost are
equal,then it is identical to the BFS.

Consider the following road map.

Artificial Intelligence Dhanya P.M, lecturer in DCS, RASET 23


O
71

Z 151
75

118 S

T
80
111
L
70
R
M
146
75

D C

120

Artificial Intelligence Dhanya P.M, lecturer in DCS, RASET 24


QUEUE
A A 0

A
75 QUEUE
118 Z 75
140
T 118
S 140
Z S T
75
140 118

A
75 QUEUE
140 118 T 118
S 140
Z S T O 146
A 150
75
140 118
A O

150 146

A
75
140 118

QUEUE
Z S T
S 140
111 O 146
140 118 A 150
L 229
A O A L A 236

236
150 146 229

Artificial Intelligence Dhanya P.M, lecturer in DCS, RASET 25


A
75
140 118

Z S T
111
118
QUEUE
O A L O 146
A A 150
236 L 229
146 229 A 236
150
R 220
R
A 280
O A O 291

291 280 220

Time complexity-O (bd)

Artificial Intelligence Dhanya P.M, lecturer in DCS, RASET 26


4)Depth limited searchThe nodes at depth l are treated as if they have no
successors.This solves the infinite path problem

Eg:-limit l =2

Not explored

5)Iterative deepening depth first search

Artificial Intelligence Dhanya P.M, lecturer in DCS, RASET 27


It is used in combination with depth first search that finds the best depth limit.It does this
by gradually increasing the limit-first 0,then 1,then 2 and so on. Until a goal is
found.

Algorithm

1.Set SEARCH-DEPTH=1.

2.Conduct a depth first search to depth of SEARCH-DEPTH .If a solution path is


found,then return it.

3.Otherwise increment SEARCH-DEPTH by 1 and go to step 2.

Limit=0

Limit=1

Limit=2

Here black nodes are the visited ones.

Artificial Intelligence Dhanya P.M, lecturer in DCS, RASET 28


Constraint satisfaction problem

Taking the following map coloring problem as an example, we can explain the constraint
satis faction problem

NT Q
WA
SA

NSW
V

Constraint graph

Artificial Intelligence Dhanya P.M, lecturer in DCS, RASET 29


N
T Q
W
T
S NS
A W

Back tracking search for CSP

WA=red WA=green WA=blue

WA=red WA=red
NT=green NT=blue

WA=red WA=red
NT=green NT=green
Q=red Q=blue

Forward checking
One way to make better use of constraints during search is called forward
checking.whenever a variable is assigned forward checking process looks at each
unassigned variable y that is connected to X by a constraint and deletes from Y’s domain
any value that is inconsistent with the value chosed for X

WA NT Q NSW V SA T
Initial RGB RGB RGB RGB RGB RGB RGB

Artificial Intelligence Dhanya P.M, lecturer in DCS, RASET 30


domain
After R G B RGB RGB RGB GB RGB
WA=red
After R B G R B RGB B RGB
Q=green
After R B G R B RGB
V=blue

Intelligent backtracking(conflict directed back jumping)

N
T Q red
W
T
S NS Green
A W

blue
V

T
red

Let the coloring order be {Q,NSW,V,T,SA,WA,NT}.Now when we try SA,we see that
every value violates a constraint .Now instead of backtracking upto T,we backtrack to the
set variables(conflict set) which caused the failure.here the conflict set is{Q,NSW,V}
So we jump over T and try a new value for V.

Tree –decomposition

R G
R G
W G R
NT
A
NT Q

B SA
SA
B

B R
Artificial Intelligence Dhanya P.M, lecturer in DCS, RASET 31
SA Q
R G
R G
W G R
NT
A
NT Q

B SA
SA
B

B R

SA Q

NS
W
G

B G
NS
SA
W

V T
R

Artificial Intelligence Dhanya P.M, lecturer in DCS, RASET 32


Cut set conditioning algorithm
1.Choose a subset S from variable [csp] such that the constraint graph becomes a tree
after removal of S.S is called cycle cut set e.g.:-SA.
2.For each possible assignment to the variable in S that satisfies all constraint on S,
a)remove from the domains of the remaining variables any values that are
inconsistent with assignment for S &
b)if the remaining CSP has a solution return it together with the assignment for S.

6) Bidirectional Search

Artificial Intelligence Dhanya P.M, lecturer in DCS, RASET 33


Artificial Intelligence Dhanya P.M, lecturer in DCS, RASET 34

You might also like