Vous êtes sur la page 1sur 46

Chapter 2: Problems, Problem Spaces and Search

The objective of this lesson is to provide an overview of


problem representation techniques i.e.
Representing AI problems as a mathematical model
Representing AI problems as a production system
Defining AI problems as a state space search
BFS and DFS search algorithm with advantages

Digital Notes by Yogesh Ingale, Assistant Professor, Dr. D. Y. Patil ACS College, Pimpri
Setps Used to solve AI Problems
To solve different types of AI problems, there are different
types of AI techniques. These techniques use following steps
1. Define the problem : This definition must include precise
specifications of what the initial situation(s) will be as well
as what final situations constitute. By defining it properly,
one can convert it into the real workable states.
2. Analyze the problem: Identify the techniques to be used to
solve the given problem. A few important features can
have different techniques for solving the problem
3. Isolate and represent the task knowledge that is necessary
to solve the problem
4. Choose the best problem solving technique and apply on
particular problem

Digital Notes by Yogesh Ingale, Assistant Professor, Dr. D. Y. Patil ACS College, Pimpri
Defining AI Problem as State Space Search
A set of all possible states for a given problem is known as state
space of the problem.
Representation of states is highly beneficial in AI because they
provide all possible states, operations and the goals.
If the entire sets of possible states are given, it is possible to
trace the path from the initial state to the goal state and identify
the sequence of operators necessary for doing it.
Representation allows for a formal definition of a problem using
a set of permissible operations as the need to convert some
given situation into some desired situation.
We are free to define the process of solving a particular problem
as a combination of known techniques, each of which are
represented as a rule defining a single step in the space, and
search, the general technique of exploring the space to try to
find some path from the current state to a goal state.
Digital Notes by Yogesh Ingale, Assistant Professor, Dr. D. Y. Patil ACS College, Pimpri
Water Jug Problem
Statement :- We are given 2 jugs, a 4 liter one and a 3-
liter one. Neither has any measuring markers on it. There
is a pump that can be used to fill the jugs with water. we
can pour water out of a jug to the ground. We can pour
water from one jug to another. How can we get exactly 2
liters of water in to the 4-liter jugs?
Solution:-The state space for this problem can be defined
as
x -represents the number of liters of water in the 4-liter jug
y -represents the number of liters of water in the 3-liter jug
Therefore, x =0,1,2,3 or 4 and y=0,1,2 or 3
The initial state is ( 0,0) .The goal state is to get ( 2,n) for
any value of n.
Digital Notes by Yogesh Ingale, Assistant Professor, Dr. D. Y. Patil ACS College, Pimpri
The various Production Rules that are available to solve this
problem may be stated as given in the following table .
Rule No Production Rule Action
1 (x,y) if x<4 => (4,y) Fill the 4 Liter jug
2 (x,y) if y<3 => (x,3) Fill the 3 Liter jug
3 (x,y) if x>0 =>(0,y) Empty 4 Liter jug on ground
4 (x,y) if y>0 =>(x,0) Empty 3 Liter jug on ground
5 (x,y) if x+y<=4 =>(x+y,0) Pour all the water from 3 liter jug into 4 liter jug
6 (x,y) if x+y<=3 =>(0,x+y) Pour all the water from 4 liter jug into 3 liter jug
7 (x,y) if x+y>=4 => (4,y- Pour water from 3 liter jug to 4 liter jug until 4
(4-x) liter jug is full
8 (x,y) if x+y>=3 =>(x-(3- Pour water from 4 liter jug to 3 liter jug until 3
y),3) liter jug is full
9 (0,2) =>(2,0) Pour 2 liter from 3 liter jug to 4 liter jug
Digital Notes by Yogesh Ingale, Assistant Professor, Dr. D. Y. Patil ACS College, Pimpri
One solution to water jug problem is given as

Liter in 4 Liter Liter in 3 Liter Rule Applied


Jug Jug
0 0
0 3 2
3 0 5
3 3 2
4 2 7
0 2 3
2 0 5
Solution 1
Digital Notes by Yogesh Ingale, Assistant Professor, Dr. D. Y. Patil ACS College, Pimpri
Solution 2 for water jug problem

Liter in 4 Liter Liter in 3 Liter Rule Applied


Jug Jug
0 0
4 0 1
1 3 8
1 0 4
0 1 6
4 1 1
2 3 8

Solution 2
Digital Notes by Yogesh Ingale, Assistant Professor, Dr. D. Y. Patil ACS College, Pimpri
Solution 3 for water jug problem
Liter in 4 Liter Jug Liter in 3 Liter Jug Rule Applied

0 0
4 0 1
1 3 8
0 3 3
3 0 5
3 3 2
4 2 7
0 2 3
2 0 5

Solution 3
Digital Notes by Yogesh Ingale, Assistant Professor, Dr. D. Y. Patil ACS College, Pimpri
Water Jug Problem of 8,5 and 3 Liter Jug
Solution:-
The state space for this problem can be defined as
x -represents the number of liters of water in the 8-liter jug
y -represents the number of liters of water in the 5-liter jug
z represent the number of liters of water in he 3-liter jug
Therefore, x =0,1,2,3,5,6,70r 8
y=0,1,2 ,3,4 or 5
z=0,1,2 or 3
The initial state is ( 8,0,0) .The goal state is to get 4 liter of
water in any jug.
The goal state can be defined as (4,n,n) or (n,4,n) for any
value of n Digital Notes by Yogesh Ingale, Assistant Professor, Dr. D. Y. Patil ACS College, Pimpri
8,5,3 Liter water jug problem
Rule
The variousProduction
Production Rule Action
Rules that are available to solve this
1 (x,y,z) if x+y<=5 =>(0,x+y,z) Pour all water from 8 liter jug to 5 liter jug
problem may be stated as given in the following table .
2 (x,y,z) if x+z<=3 =>(0,y,x+z) Pour all water from 8 liter jug to 3 liter jug
3 (x,y,z) if x+y<=8 =>(x+y,0,z) Pour all water from 5 liter jug to 8 liter jug
4 (x,y,z) if y+z<=3 =>(x,0,y+z) Pour all water from 5 liter jug to 3 liter jug
5 (x,y,z) if x+z<=8 =>(x+z,y,0) Pour all water from 3 liter jug to 8 liter jug
6 (x,y,z) if y+z<=5 =>(x,y+z,0) Pour all water from 3 liter jug to 5 liter jug
7 (x,y,z) if x+y>=5 => (x-(5-y),5,z) Pour water from 8 liter jug to 5 liter jug
until 5 liter jug is full
8 (x,y,z) if x+z>=3 => (x-(3-z),y,3) Pour water from 8 liter jug to 3 liter jug
until 3 liter jug is full
9 (x,y,z) if y+z>=3 => (x,y-(3-z),3) Pour water from 5 liter jug to 3 liter jug
until 3 liter jug is full
10 (x,y,z) if y+z>=5 => (x,5,z-(5-y)) Pour water from 3 liter jug to 5 liter jug
until 5 liter jug is full
Digital Notes by Yogesh Ingale, Assistant Professor, Dr. D. Y. Patil ACS College, Pimpri
8,5,3 Liter water jug problem
One solution to water jug problem is given as

Liter in 8 Liter in 5 Liter in 3 Rule


Liter Jug Liter Jug Liter Jug Applied
8 0 0
3 5 0 7
3 2 3 9
6 2 0 5
6 0 2 4
1 5 2 7
1 4 3 9

Digital Notes by Yogesh Ingale, Assistant Professor, Dr. D. Y. Patil ACS College, Pimpri
Thus, to solve any difficult, unstructured problems, we have to
provide a formal description to solve a problem and for that we
have to do following
1. Specify one or more states within that space that describes
possible situations from which the problem solving process
may start, called as initial state
2. Specify one or more states that would be acceptable as
solution to the problem. These states are called as goal state
3. Define a state space that contains all the possible
configuration of the relevant objects
4. Specify a set of rules that describes the action available
Thus the problem can be solved by using the rules and also
with appropriate control strategy.

Digital Notes by Yogesh Ingale, Assistant Professor, Dr. D. Y. Patil ACS College, Pimpri
Tiger, Goat and Grass Problem
Statement:
A Farmer has a tiger, a goat and a bundle of grass. He is
standing at one side of the river with a very week boat which
can hold only one of his belongings at a time. His goal is to
take all three of his belongings to the other side. The constraint
is that the farmer cannot leave either goat and tiger, or goat and
grass, at any side of the river unattended because one of them
will eat the other
Formalize the above problem in terms of state space search.
You should
i. Suggest a suitable representation for the problem
ii. State the initial state and final state
iii. List the actions for getting from one state to another state

Digital Notes by Yogesh Ingale, Assistant Professor, Dr. D. Y. Patil ACS College, Pimpri
Solution:
Let F represent Farmer, T represent Tiger, G represent Goat, Gr
represent Grass, A and B represent sides of the river
respectively
Initial State: Side A(T, G, Gr) Side B( )
Goal State: Side A( ) SideB(T,G,Gr)
One possible solution is
1. The F takes G from Side A to side B of the river
Side A(T, Gr) Side B(G)
2. The F crosses the river from side B to side A
Side A(T, Gr) Side B(G)
3. The F takes Gr from Side A to Side B of the river
Side A(T) Side B(G, Gr)
Digital Notes by Yogesh Ingale, Assistant Professor, Dr. D. Y. Patil ACS College, Pimpri
4. The F takes G from Side B to Side A of the river
Side A(T, G) Side B(Gr)
5. The F takes T from Side A to Side B of the river
Side A(G) Side B(Gr, T)
6. The F crosses the river from Side B to Side A
Side A(G) Side B(Gr, T)
7. The F takes G from Side A to Side B of the river
Side A( ) Side B(Gr, T, G)

Digital Notes by Yogesh Ingale, Assistant Professor, Dr. D. Y. Patil ACS College, Pimpri
Production System
A production system is a system that adapts a system with production
rules.
A production system consists of:
A set of rules, each consisting of a left side and a right hand side. Left
hand side or pattern determines the applicability of the rule and a
right side describes the operation to be performed
One or more knowledge/databases that contain whatever information
is appropriate for the particular task.
A control strategy that specifies the order in which the rules will be
compared to the database and a way of resolving the conflicts that
arise when several rules match at once.
A rule applier.
Following systems provide the overall architecture of a production system
and allow the programmer to write rules that define particular problems to
be solved.
Basic production system languages, such as OPS5 and ACT*
General problem-solving architectures like SOAR
Digital Notes by Yogesh Ingale, Assistant Professor, Dr. D. Y. Patil ACS College, Pimpri
Search and Control Strategies
AI problem can be solved by searching for a path through the
space. i.e. from initial state to goal state.
So it is necessary to choose the appropriate control structure
such that the search can be as efficient as possible.
The next step is to decide which rule to apply next during the
process of searching for a solution to a problem. This decision
is critical since often more than one rule (and sometimes fewer
than one rule) will have its left side match the current state.
The features of good control strategy
1. A good control strategy is that which causes motion
2. A good control strategy must be systematic: A control
strategy is not systematic; we may explore a particular
useless sequence of operators several times before we
finally find a solution.
Digital Notes by Yogesh Ingale, Assistant Professor, Dr. D. Y. Patil ACS College, Pimpri
Depth First Search (DFS)
Concept:
Step 1: Traverse the root node.
Step 2: Traverse any neighbour of the root node.
Step 3: Traverse any neighbour of neighbour of the root node.
Step 4: This process will continue until we are getting the goal
node.
Algorithm:
Step 1: PUSH the starting node into the stack.
Step 2: If the stack is empty then stop and return failure.
Step 3: If the top node of the stack is the goal node, then stop and
return success.
Step 4: Else POP the top node from the stack and process it. Find all its
neighbours that are in ready state and PUSH them into the stack
in any order.
Step 5: Go to step 3.
Step 6: Exit.

Digital Notes by Yogesh Ingale, Assistant Professor, Dr. D. Y. Patil ACS College, Pimpri
Consider A as root node and L as goal node in given tree.
Digital Notes by Yogesh Ingale, Assistant Professor, Dr. D. Y. Patil ACS College, Pimpri
Step 1: PUSH the starting node into stack i.e A
Step 2: Now the stack is not empty and A is not our goal node.
Hence move to next step
Step 3: POP the top node from stack i.e A and PUSH
neighbour of A i.e. B C
Step 4: POP the top node from stack i.e C which is not our goal
node, hence PUSH its neighbour i.e. F, G B F G
Step 5: POP the top node from stack i.e G which is not our goal
node, hence PUSH its neighbour i.e. M B F M
Step 6: POP the top node from stack i.e M which is not our
goal node, but no there is no neighbour of M so POP it
so stack is B F
Step 7: POP the top node from stack i.e F which is not our goal
node, hence PUSH its neighbour i.e. K, L B K L
Digital Notes by Yogesh Ingale, Assistant Professor, Dr. D. Y. Patil ACS College, Pimpri
Step 8: POP the top node from stack i.e L which is our goal
node
Also you can traverse the graph starting from the root A and then
insert in the order C and B into the stack.
Advantages of DFS:
DFS consumes very less memory space.

Disadvantages of DFS
When succeeds, the goal node found is not necessarily
minimum depth
DFS does not guarantee to find a minimal solution, if more than
one solution exists.
Large tree, may take excessive long time to find even nearby
goal node
Digital Notes by Yogesh Ingale, Assistant Professor, Dr. D. Y. Patil ACS College, Pimpri
Breadth First Search (BFS)
Concept:
Step 1: Traverse the root node
Step 2: Traverse all neighbours of root node.
Step 3: Traverse all neighbours of neighbours of the root node.
Step 4: This process will continue until we are getting the goal
node.
Algorithm:
Step 1: Place the root node inside the queue.
Step 2: If the queue is empty then stops and return failure.
Step 3: If the FRONT node of the queue is a goal node then stop and
return success.
Step 4: Remove the FRONT node from the queue. Process it and find all
its neighbours that are in ready state then place them inside the queue
in any order.
Step 5: Go to Step 3.
Step 6: Exit.

Digital Notes by Yogesh Ingale, Assistant Professor, Dr. D. Y. Patil ACS College, Pimpri
Consider A as root node and F as goal node in given tree.
Digital Notes by Yogesh Ingale, Assistant Professor, Dr. D. Y. Patil ACS College, Pimpri
Step 1: Place the root node in queue i.e A A
Step 2: Now the queue is not empty and also the FRONT node
i.e. A is not our goal node. So move to step 3.
Step 3: Remove FRONT node from queue i.e. A and add
neighbours of A i.e B, C at the end of queue B C
Step 4: Remove FRONT node of Q i.e B which is not our goal
node. So add its neighbour at end of Q C D
Step 5: Remove FRONT node of Q i.e C which is not our goal
node. So add its neighbour at end of Q D E
Step 6: Remove FRONT node of Q i.e D which is not our goal
node. So add its neighbour at end of Q E F
Step 7: Remove FRONT node of Q i.e E which is not our goal
node. So add its neighbour at end of Q F

Digital Notes by Yogesh Ingale, Assistant Professor, Dr. D. Y. Patil ACS College, Pimpri
Step 8: Finally FRONT node of Q is F which is our goal node.

Advantages of BFS:
If there is a solution then BFS is guaranteed to find it out
If there are multiple solutions then BFS can find minimal
solution(i.e. one that requires the minimum number of
steps)
It does not follow a single unfruitful path for a long time.

Disadvantages BFS:
BFS consumes large memory space.
If solution is far away then it consumes time.

Digital Notes by Yogesh Ingale, Assistant Professor, Dr. D. Y. Patil ACS College, Pimpri
Problem characteristics
To choose an appropriate method for a particular problem their
key dimension should analyze with respect to following
characteristics of the problem
1. Is the problem decomposable?
Can the problem be broken down to smaller problems to be
solved independently?
Decomposable problem can be solved easily.
Eg.
(x2+3x+sin2x.cos2x)dx
x2 dx + 3x dx + sin2x.cos2x dx
X3/3 + 3 x dx + (1- cos2x )cos2x dx
X3/3 + 3 X2/2 + cos2x dx - cos4x dx
and so on
Digital Notes by Yogesh Ingale, Assistant Professor, Dr. D. Y. Patil ACS College, Pimpri
2. Can solution steps be ignored or undone?
Problem fall under three classes ignorable , recoverable and
irrecoverable.
i. Ignorable, in which solution steps can be ignored.
Eg: Theorem Proving. Suppose we are trying to prove a mathematical
theorem: We proceed using method first. Later we realize that it is not at all
useful. We start with another one to prove the theorem. Here we simply
ignore the first method.
ii. Recoverable, in which solution steps can be undone.
Eg: 8-Puzzle. Consider the 8-puzzle problem to solve: we make a
wrong move and realize that mistake then we can backtrack to the initial state
and start with some new move.
iii. Irrecoverable, in which solution steps cannot be undone.
Eg: Chess. Consider the problem of playing chess. Here, once we make a
move we never recover from that step. If a wrong move is made, it can
neither be ignored nor be recovered.
Digital Notes by Yogesh Ingale, Assistant Professor, Dr. D. Y. Patil ACS College, Pimpri
3. Is a good solution is absolute or relative?
Absolute solution: once you get a solution you need not to
bother about another possible solution
Relative Solution: once you get a solution you have to find
another possible solution to check which solution is best
4. Does the task require human-interaction?
There are two types of problems
Solitary: In which the computer is given a problem description
and produces an answer with no intermediate communication
Conventional: In which there is intermediate communication
between a person and the computer, either to provide additional
assistance to the computer or to provide additional information
to the user or both
Digital Notes by Yogesh Ingale, Assistant Professor, Dr. D. Y. Patil ACS College, Pimpri
Sr Problem/ Is problem Can Is Does task
No Characteristics Decomposable solution solution require
steps absolute/ human
ignored relative interaction?
/undone
1 Chess No No Relative No
2 Water Jug No Yes Absolute Yes
3 8- Puzzle No Yes Absolute No
4 Missionary & No Yes Absolute Yes
Cannibals

Digital Notes by Yogesh Ingale, Assistant Professor, Dr. D. Y. Patil ACS College, Pimpri
Missionaries and Cannibals Problem
Statement:
Three missionaries and three cannibals find themselves on one
side of a river. They have would like to get to the other side,
such that the number of missionaries on either side of the river
should never less than the number of cannibals who are on the
same side. The only boat available can holds only two at a
time. How can everyone cross the river without the
missionaries risking being eaten?
Formalize the above problem in terms of state space search.
You should
i. Suggest a suitable representation for the problem
ii. State the initial state and final state
iii. List the actions for getting from one state to another state

Digital Notes by Yogesh Ingale, Assistant Professor, Dr. D. Y. Patil ACS College, Pimpri
Solution:-The state space for this problem can be defined as

Let, i represents the number missionaries in one side of a river


Therefore i=0,1,2 or 3

j represents the number of cannibals in the same side of river


Therefore j=0,1,2 or 3

The initial state (i,j) is (3,3) i.e. three missionaries and three
cannibals on side A of a river and ( 0,0) on side B of the river .

The goal state is to get (3,3) at Side B and (0,0) at Side A.

Digital Notes by Yogesh Ingale, Assistant Professor, Dr. D. Y. Patil ACS College, Pimpri
The various Production Rules that are available to solve this
problem may be stated as given in the following table .
Rule Production Rule Action
No
1 (i,j) if i-1>=j on one side and One missionary can cross the river
i+1>=j on other side
2 (i,j) if j-1<=i or i=0 on one side One cannibal can cross the river
and j+1<=i or j=0 on other side
3 (i,j) if i-2>=j or i-2=0 on one side Two missionary can cross the river
and i+2>=j on other side
4 (i,j) if j-2<=i or i=0 on one side Two cannibals can cross the river
and j+2<=i or i=0 on other side
5 (i,j) if i-1>=j-1 or i=0 on one side One missionary and one cannibal
and i+1>=j+1 or i=0 on other side can cross the river
Digital Notes by Yogesh Ingale, Assistant Professor, Dr. D. Y. Patil ACS College, Pimpri
Solution of Missionary Canibal Problem
Side A Boat Side B Rule Applied
(3,3) Empty (0,0)
(3,1) (0,2) (0,2) 4
(3,2) (0,1) (0,1) 2
(3,0) (0,2) (0,3) 4
(3,1) (0,1) (0,2) 2
(1,1) (2,0) (2,2) 3
(2,2) (1,1) (1,1) 5
(0,2) (2,0) (3,1) 3
(0,3) (0,1) (3,0) 2
(0,1) (0,2) (3,2) 4
(0,2) (0,1) (3,1) 2
(0,0) (0,2) (3.3) 4
Digital Notes by Yogesh Ingale, Assistant Professor, Dr. D. Y. Patil ACS College, Pimpri
Cryptarithmetic Problem
A Cryptarithmetic is a mathematical puzzle in which the digits
are replaced by alphabet.

Consider an arithmetic problem represented in alphabets.


Assign a digit to each of the alphabet in a such way that the
answer to the problem is correct. If the same alphabet occurs
more than once, it must be assigned the same digit each time.
No two different alphabets may be assigned the same digit.

Eg.

Digital Notes by Yogesh Ingale, Assistant Professor, Dr. D. Y. Patil ACS College, Pimpri
Since the result is one digit more than the numbers, it is quite
obvious that there is a carry over and therefore M must be equal
to 1. Hence M=1.
Now S+M=O, as M=1 S can not be less than or equal to 8 as
there is carry over next level. Therefore S=9 and hence O=0
E+O=N i.e E+0=N is not possible as E !=N, Therefore it should
be 1+E+0=N where 1 is carry from N+E=R. Hence E=N-1
Now for N+R=E ,the possible cases are,
N + R = 10 + E - - - (1) or
1 + N + R = 10 + E - - - (2)
Substituting E = N -1 in the first equation, N + R = 10 + N - 1,
we get R = 9 which is not possible as S=9.
Substituting E = N - 1 in the second equation,
1 + N + R = 10 + N - 1, we get R = 8.

Digital Notes by Yogesh Ingale, Assistant Professor, Dr. D. Y. Patil ACS College, Pimpri
Now E=N-1 means that N and E are consecutive numbers
and N is larger
Taking (N,E)=(6,5) satisfies the condition of 1+N+R=10+E
and 1+E+0=N Hence N=6 and E=5
Now D+E=10+Y As E=5, D must be greater than 5
Therefore D=7 as 6,8,9 are already assigned to N,R,S resp.
Y=D+E-10
=7+5-10 Therefore Y=2. Hence the result is

Digital Notes by Yogesh Ingale, Assistant Professor, Dr. D. Y. Patil ACS College, Pimpri
Q.) Solve the following crypt arithmetic problem

Solution:
From first row of multiplication it is clear that B=1 as
JE*B=JE
As in the multiplication, second row should start from 0 at
tenth's place. So A = 0.
Now in the hundred's place, J + Something = 10. When
you add something to the single digit number that results in
10. So J = 9.
Digital Notes by Yogesh Ingale, Assistant Professor, Dr. D. Y. Patil ACS College, Pimpri
Now J+E=10+D i.e 9+E=10+D . Here E can not be 0,1 as
these digits are assigned to A and B resp.
Assume E=2 which gives 9+2=11 means D=1 which is not
possible therefore E can not be 2
Assume E=3 which gives 9+3=12 hence D=2
Hence the solution is

Digital Notes by Yogesh Ingale, Assistant Professor, Dr. D. Y. Patil ACS College, Pimpri
Q.) Solve the following crypt arithmetic problem

Solution:
From the first row of multiplication, H =1 is clear, As HE x H = HE.
Now, H+A=M i.e 1+A=10+M as there is carry over next level
Therefore A=9 ,M=0 and N=2
Now, HE*E=HHA i.e 1E*E=119 so by trial and error we get E=7

Digital Notes by Yogesh Ingale, Assistant Professor, Dr. D. Y. Patil ACS College, Pimpri
n Queen Problem
Problem Definition:
This problem consists of n queens which are to be arranged on
n*n chess board such that, no two queen can attack each other

Q. Give state space representation of n queen problem

Initial state: Initially the board is empty

Goal State: All queen should be arranged in a manner such


that no two queens should attack each other

Digital Notes by Yogesh Ingale, Assistant Professor, Dr. D. Y. Patil ACS College, Pimpri
Solution of n queen problem:

* *
*
*

* *
* *
*
*
Digital Notes by Yogesh Ingale, Assistant Professor, Dr. D. Y. Patil ACS College, Pimpri
8 Puzzle Problem
Problem Definition:
In 8 puzzle problem there are 9 squares arranged in 3*3 matrix
format. Out of the 9 squares, 8 squares contain the values from
1-8 and one square is empty. We can slide the numbers in
empty square from left, right, top, bottom of empty square.
Initially the numbers are arranged in random order and we
have to arrange them as

1 2 3
8 4
7 6 5

Digital Notes by Yogesh Ingale, Assistant Professor, Dr. D. Y. Patil ACS College, Pimpri
Sate space representation for 8 puzzle problem:
Initial state: Initially the numbers are placed in random order

2 8 3
1 6 4
7 5

Goal State: We have to place the numbers is following order

1 2 3
8 4
7 6 5

Digital Notes by Yogesh Ingale, Assistant Professor, Dr. D. Y. Patil ACS College, Pimpri
2 8 3 2 3
1 6 4 1 8 4
7 5 7 6 5

2 8 3 1 2 3
1 4 8 4
7 6 5 7 6 5

2 3 1 2 3
1 8 4 8 4
7 6 5 7 6 5

Digital Notes by Yogesh Ingale, Assistant Professor, Dr. D. Y. Patil ACS College, Pimpri
BFS Tree for 8 Puzzle Problem

Digital Notes by Yogesh Ingale, Assistant Professor, Dr. D. Y. Patil ACS College, Pimpri
Thank You

Digital Notes by Yogesh Ingale, Assistant Professor, Dr. D. Y. Patil ACS College, Pimpri

Vous aimerez peut-être aussi