Download as pdf or txt
Download as pdf or txt
You are on page 1of 1

Search Techniques 35

Bidirectional search still guarantees optimal solu-


tions. Assuming that the comparisons for identifying
a common state between the two frontiers can be
done in constant time per node, by hashing for ex-
ample, the time complexity of bidirectional search is
O(bd/2) since each search need only proceed to half
the solution depth. Since at least one of the searches
must be breadth first in order to find a common state,
the space complexity of bidirectional search is also
O(bd/2). As a result, bidirectional search is space
Figure 4 Order of node generation for depth-first. bound in practice.

nodes generated by DFID to those generated by breadth- F. Combinatorial Explosion


first search on a tree is approximately b/(b  1). In fact,
DFID is asymptotically optimal in terms of time and The problem with all brute-force search algorithms is
space among all brute-force shortest-path algorithms on that their time complexities grow exponentially with
a tree. problem size. This is called combinatorial explosion, and
If the edge costs differ from one another, then one as a result, the size of problems that can be solved
can run an iterative deepening version of uniform- with these techniques is quite limited. For example,
cost search, where the depth cutoff is replaced by a while the Eight Puzzle, with about 105 states, is easily
cutoff on the g(n) cost of a node. At the end of each solved by brute-force search, the Fifteen Puzzle con-
iteration, the threshold for the next iteration is set to tains over 1013 states, and hence cannot be solved
the minimum cost of all nodes generated but not ex- with any brute-force search techniques on current
panded on the previous iteration. machines. Faster machines will not have a significant
On a graph with cycles, however, breadth-first search impact on this problem, since the 5  5 Twenty-Four
may be much more efficient than any depth-first Puzzle contains almost 1025 states, for example.
search. The reason is that a breadth-first search can
easily detect all duplicate nodes, whereas a depth-first
search can only check for duplicates along the current IV. HEURISTIC SEARCH
search path. Thus, the complexity of breadth-first
search grows only as the number of states at a given To solve larger problems, domain-specific knowledge
depth, while the complexity of depth-first search de- must be added to improve search efficiency. In AI,
pends on the number of paths of a given length. For heuristic search has a general meaning, and a more spe-
example, in a square grid, the number of nodes within cialized technical meaning. In a general sense, the
a radius r of the origin is O(r 2), whereas the number term heuristic is used for any advice that is often ef-
of paths of length r is O(3r), since there are three chil- fective, but is not guaranteed to work in every case.
dren of every node, not counting its parent. Thus, in Within the heuristic search literature, however, the
a graph with a large number of very short cycles, term heuristic usually refers to the special case of a
breadth-first search is preferable to depth-first search, heuristic evaluation function.
if sufficient memory is available to store all the nodes.

A. Heuristic Evaluation Functions


E. Bidirectional Search
In a single-agent path-finding problem, a heuristic
Bidirectional search is a brute-force search algorithm evaluation function estimates the cost of an optimal
that requires an explicit goal state instead of simply a path between a pair of states. For example, Euclidean
test for a goal condition. The main idea is to simulta- or airline distance is an estimate of the highway dis-
neously search forward from the initial state, and tance between a pair of locations. A common heuris-
backward from the goal state, until the two search tic function for the sliding-tile puzzles is called Man-
frontiers meet. The path from the initial state is then hattan distance. It is computed by counting the
concatenated with the inverse of the path from the number of moves along the grid that each tile is dis-
goal state to form the complete solution path. placed from its goal position, and summing these

You might also like