State Space
State Space
Prepared By:
Dr. Muhanad Tahrir Younis
1
02/07/1441
Introduction
• A graph consists of nodes and a set of arcs or links
connecting pairs of nodes.
• Nodes are used to represent discrete states.
– A configuration of a game board. (tic-tac-toe)
• Arcs are used to represent transitions between
states.
– Legal moves of a game
• Leonhard Euler invented graph theory to solve the
“bridge of Königsberg problem”
– Is there a walk around the city that crosses each bridge
exactly once.
3
2
02/07/1441
Definition of Graph(1)
A graph consists of nodes and arcs
– A set of nodes N1, N2, …, Nn … need not be finite.
– A set of arcs connects pairs of nodes.
A directed graph has an indicated direction for
traversing each arc
If a directed arc connects Nj and Nk, then Nj is
called the parent of Nk and Nk is called the child
of Nj.
A rooted graph has a unique node Ns from which
all paths in the graph originate
A tip or leaf node is a node without children.
An ordered sequence of nodes [N1, N2, N3, … Nn]
is called a path of length n-1 in the graph 6
3
02/07/1441
4
02/07/1441
5
02/07/1441
11
12
6
02/07/1441
13
14
7
02/07/1441
8
02/07/1441
Goal-Driven Search is
Suggested(1)
• A goal or hypothesis is given in the problem
statement or can easily be formulated.
– Mathematics theorem prover, diagnostic systems
• Early selection of a goal can eliminate most
branches, making goal-driven search more
effective in pruning the space.
• Mathematics theorem prover.
• Problem data are not given but must be acquired.
– A medical diagnosis program.
17
Goal-Driven Search is
Suggested(2)
18
9
02/07/1441
Data-driven Search is
Appropriate
All or most of the data are given in the initial problem
statement.
– PROSPECTOR interpreting geological data.
There are only a few ways to use the facts and given
information.
– DENDRAL finding the molecular structure of organic compounds.
For any organic compound, enormous number of possible
structures. The mass spectrographic data on a compound allow
DENDRAL to eliminate most of possible structures.
Branching factor, availability of data, and ease of
determining potential goals are carefully analyzed to
determine the direction of search.
19
20
10
02/07/1441
Search Example
21
11
02/07/1441
Breadth-First Search(2)
1. open=[A]; closed=[]
2. open=[B,C,D]; closed=[A]
3. open=[C,D,E,F]; closed=[B,A]
4. open=[D,E,F,G,H]; closed=[C,B,A]
5. open=[E,F,G,H,I,J]; closed=[D,C,B,A]
6. open=[F,G,H,I,J,K,L]; closed=[E,D,C,B,A]
7. open=[G,H,I,J,K,L,M](as L is already on open);
closed=[F,E,D,C,B,A]
8. open=[H,I,J,K,L,M,N]; closed=[G,F,E,D,C,B,A]
9. And so on until either U is found or open=[]
23
24
12
02/07/1441
13
02/07/1441
28
14
02/07/1441
29
30
15
02/07/1441
31
16