Chapter3 State Space Search
Chapter3 State Space Search
Chapter 3
Structures and Strategies For State
Space Search
Contents
• Introduction
• Structures for State Space search
•Graph Theory
•The Finite State Machine
•State representation of problems
• Strategies for Space State Search
•Data driven – Goal driven search
•Depth Search – Breadth search
•Depth First search with Iterative
Deepening
• Using the State Space to represent
Reasoning with the propositional and
predicate calculus
•And /Or Graphs
•Examples
Introduction
The importance of the problem space
Graph theory
Nodes rb - i
Linkes arcs - b
EULER noted WALK WAS IMPOSSIBLE UNLESS A GRAPH HAS
EXACTLY ZERO OR TWO NODES OF ODD DEGREES
Degree no of arcs joining a node
Representing Königsberg bridge
system- using predicate calculus
b is
parent (b , c , d )
of( e f) are
siblings
(e f g h I j) Leaves or
(g, h , i) children
b,e) are( tips
of c
connected
Finite State Machine
Finite-state machines can solve a large number of problems, among which
electronic design automation, communication protocol design, parsing and other
engineering applications. In biology and artificial intelligence research, state machines or
hierarchies of state machines are sometimes used to describe neurological systems and
in linguistics — to describe the grammars of natural languages.
http://en.wikipedia.org/wiki/Finite-state_machine
)Finite State Machine (FSM
Flip Flop FSM
Starting
Accepting
state
Complexity = (n-1)!
Order of search : A , B , C , D , E , F , G
The breadth-first search algorithm
A trace of breadth-first search
The graph at iteration 6 of breadth-first search.
States on open and closed are highlighted
Breadth-first search of the 8-puzzle, showing
order in which states were removed from open
Depth-first search
Depth-first search
When a state is examined, all of its children and
their descendants are examined before any of
its siblings
Go deeper into the search space where possible
Stack structure descendant states are added and
removed from the left of (open) list- LIFO
Depth-first search5
4
3
…….
The depth-first search algorithm
A trace of depth-first search
The graph at iteration 6 of depth-first search.
States on open and closed are highlighted
Depth-first search of 8-puzzle with a depth bound of 5
) Evaluation Criteria (Russel – Norvig
completeness
Is the problem solver guaranteed to find a solution?
time complexity
how long does it take to find the solution?
space complexity
memory required for the search
optimality
When the solution is found is it guranteed to be optimal?
Depth-first
More efficient (gets quickly into a deep search space) suitable for graphs
with many branches
Complexity B*N (open contains just the children of a single state)
May get lost missing shorter path or stuck with infinite long path does not
lead to goal
Depth – first Search with Iterative
Deepening
Not Negation
¬
And Conjunction
∧
Or Disjunction
∨
If… Then/Implies Conditional →
If and only if Biconditional ↔
The Truth Table
P Q NOT AND OR Implies Biconditional
)¬(P P^Q PvQ PQ P Q
T T F T T T T
T F F F T F F
F T T F T T F
F F T F F T T
Predicate Calculus Logic
Basic idea : operator (variables_1, variables_2,…)
Example: “She likes chocolate” likes (she,
chocolate).
Universal quantifier (∀X) to show all object is
true [Eg: All students (∀X (student (X))]
Existential quantifier (∃ X) to show existence /
partial object is true [ Eg: Some people ( ∃ X
(people (X))]
And/Or graphs
If the premises of an implication are connected
by an ∧ operator, they are called AND nodes, and
the arcs from this node are joined by a curved
link.
• And/or graph of
expression q ∨r → p
Or – separate arcs
∧ , ∨ :operators
HYPERGRAGH
And/or graph of a set of propositional
calculus expressions.
a
b
c
a ∧b d
b∧ df
a∧ c e
f g
a ∧e h
•Is h true? Example for goal directed strategy
And/Or graph Search
∧ operator(and nodes) indicates a problem
decomposition in which the problem is
broken into subproblems such that all of
the subproblems must be solved to solve
the original problem.
∨ operator indicates a selection, a point at
which a choice may be made between
alternative problem-solving strategies.
Examples and Applications for
and/or graph searching
Macsyma
“Where is fred?”
An English Language Parser and Sentence
Generator
The Financial Advisor Revisited
MACSYMA : An Example for goal
directed- and/or graph
And/or graph of part of the state space for integrating a function (goal directed)
“Where is fred?”: Example for Checking
English sentences Goal-directed and/or graph
The facts and rules of this example are given as English sentences
followed by their predicate calculus equivalents:
The solution subgraph showing that Fred is at
the museum.
An English Language Parser
and Sentence Generator
Rewrite rules and transform it into another
the pattern on one site of the ↔ with the
pattern on the other side :
For changing expression from language to
another
Determine if sentences are well-formed
sentences
Rules for a simple subset of English grammar are:
An English Language Parser and
Sentence Generator:
A parser needs :
Grammar rules
Terminals : dictionary of words in the language ( a , the , man , dog ,
likes , bites)
And/or graph for the grammar. Some of the nodes (np, art, etc) have
been written more than once to simplify drawing the graph.
Parse tree for the sentence “The dog
bites the man.”
A
1 10
5 5
S B G
The goal state is achieved and the
15 path S-B-G is returned. In relation to
C path cost, UCS has found the optimal
route. Press space to end.
Press space to begin the search