02 ProbSolveSearch
02 ProbSolveSearch
Search Techniques
1
Introduction
2
Introduction (cont.)
Example: playing a chess game
Each board configuration can be thought of
representing a different state of the game.
A change of state occurs when one of the
player moves a piece.
A goal state is any of the possible board
configurations corresponding to a
checkmate.
3
Introduction (cont.)
4
Introduction (cont.)
Other examples using search techniques
To understand a natural language, a program
must search to find matching words from a
dictionary, sentence constructions, and matching
contexts.
To perceive an image, program searches must be
performed to find model patterns that match input
scenes.
etc
5
Preliminary Concepts
Programs can be characterized as a space
consisting of a set of states, and a set of
operators that map from one state to other
states.
Three types of states:
one or more initial states
a number of intermediate states
one or more goal states
6
Preliminary Concepts (cont.)
A solution to a problem is a sequence of
operations that map an initial state to a goal
state.
A good solution is one that requires the
fewest operations or the least cost to map
from an initial state to a goal state.
The performance of a particular method is
judged by the amount of time and memory
required to complete the mapping.
7
Preliminary Concepts (cont.)
A solution based on some algorithm A1 is
considered better than one using algorithm A2 if
the time and space complexity of A1 is less than
that of A2.
8
Preliminary Concepts:
Time and space complexity
Time and space complexities of an algorithms
may be defined in terms of their best, their
average, or their worst-case performance in
completing some task.
9
Preliminary Concepts:
Graph and Tree representation
Traditionally a search space is represented as a
diagram of a directed graph or a tree.
Each node or vertex in the graph
corresponds to a problem state.
10
Preliminary Concepts:
Graph and Tree representation (cont.)
The immediate successors of a node are
referred to as children, sibling or offspring.
11
Preliminary Concepts:
Graph and Tree representation (cont.)
A tree is a graph which each node has at most
one parent.
12
Preliminary Concepts:
Graph and Tree representation (cont.)
The number of successors emanating from a
node is called the branching degree of that
node (denoted as b)
13
Preliminary Concepts:
Graph and Search Tree
A Search Procedure is a strategy for selecting
the order in which nodes are generated and a
given path selected.
14
Preliminary Concepts:
Graph and Search Tree (cont.)
Blind Search:
No preference is given to the order of
successor node generation and selection.
15
Preliminary Concepts:
Graph and Search Tree (cont.)
Informed Search:
Some information about the problem
space is used to compute a preference
among the children for exploration and
expansion.
16
Examples of Search Problems
Eight Puzzle
17
Examples of Search Problems:
Eight Puzzle
3 8 1 1 2 3
6 2 5 8 4
4 7 7 6 5
19
Examples of Search Problems:
Eight Puzzle (cont.)
20
Examples of Search Problems:
Eight Puzzle (cont.)
21
Examples of Search Problems:
Eight Puzzle (cont.)
23
Examples of Search Problems:
Traveling Salesman Problem (cont.)
Start
24
Examples of Search Problems:
Traveling Salesman Problem (cont.)
25
Uninformed or Blind Search
Breadth-First Search
Depth-First Search
26
Informed or Direct Search
Best-First Search
Branch-and-Bound Search
A* Search
27
Blind Search
28
Blind Search:
Breadth-First Search
30
Blind Search:
Depth-First Search (cont.)
31
Blind Search:
Depth-First Search (cont.)
32
Blind Search:
Depth-First Iterative Deepening Search
33
Blind Search:
Depth-First Iterative Deepening Search (cont.)
34
Blind Search:
Depth-First Iterative Deepening Search (cont.)
Heuristic Information
Information about the problem such as
the nature of the states,
the cost of transforming from one state to
another,
the promise of taking a certain path,
etc.
It can be used to help guide the search more
efficiently.
36
Informed Search (cont.)
Heuristic Information
This information can be expressed in the form
of a heuristic evaluation function f(n,g), a
function of the nodes n and/or the goals g.
37
Informed Search (cont.)
Heuristic Information
A heuristic is a rule of thumb or judgmental
technique that leads to a solution some of the
time, but provides no guarantee of
success.
38
Informed Search (cont.)
Heuristic Information
Heuristics play an important role in search
strategies because they help to reduce the
number of alternatives from an exponential
number to a polynomial number to obtain a
solution in a tolerable amount of time.
39
Informed Search:
Hill Climbing Method
40
Informed Search:
Hill Climbing Method (cont.)
41
Informed Search:
Hill Climbing Method (cont.)
42
Informed Search:
Hill Climbing Method (cont.)
43
Informed Search:
Best-First Search
44
Informed Search:
Best-First Search (cont.)
45
Informed Search:
Best-First Search (cont.)
46
Informed Search:
Branch-and-Bound Search
47
Informed Search:
Branch-and-Bound Search (cont.)
48
Informed Search:
Branch-and-Bound Search (cont.)
49
Informed Search:
*
A search
*
A algorithm is a specialization of best-first
search.
At each node, the A* algorithm generates all
successor nodes and computes an estimate
of distance (cost) from the start node to a
goal node through each of successors.
Then, it chooses the successor with the
shortest estimated distance for expansion.
50
Informed Search:
A* search (cont.)
*
Heuristic estimation function for A is
* * *
f (n) = g (n) + h (n),
where the two components are as follows:
*
g (n) is the estimate of cost or distance from
the start node to node n,
*
h (n) is the estimate of cost or distance from
node n to a goal node.
51