Bidirectional search

From HandWiki

Bidirectional search is a graph search algorithm that finds a shortest path from an initial vertex to a goal vertex in a directed graph. It runs two simultaneous searches: one forward from the initial state, and one backward from the goal, stopping when the two meet. The reason for this approach is that in many cases it is faster: for instance, in a simplified model of search problem complexity in which both searches expand a tree with branching factor b, and the distance from start to goal is d, each of the two searches has complexity O(bd/2) (in Big O notation), and the sum of these two search times is much less than the O(bd) complexity that would result from a single search from the beginning to the goal. Andrew Goldberg and others explained the correct termination conditions for the bidirectional version of Dijkstra’s Algorithm.[1]

As in A* search, bi-directional search can be guided by a heuristic estimate of the remaining distance to the goal (in the forward tree) or from the start (in the backward tree).

Ira Pohl (1971) was the first one to design and implement a bi-directional heuristic search algorithm. Search trees emanating from the start and goal nodes failed to meet in the middle of the solution space. The BHFFA algorithm fixed this defect Champeaux (1977).

A solution found by the uni-directional A* algorithm using an admissible heuristic has a shortest path length; the same property holds for the BHFFA2 bidirectional heuristic version described in de Champeaux (1983). BHFFA2 has, among others, more careful termination conditions than BHFFA.

Description

A Bidirectional Heuristic Search is a state space search from some state [math]\displaystyle{ s }[/math] to another state [math]\displaystyle{ t }[/math], searching from [math]\displaystyle{ s }[/math] to [math]\displaystyle{ t }[/math] and from [math]\displaystyle{ t }[/math] to [math]\displaystyle{ s }[/math] simultaneously. It returns a valid list of operators that if applied to [math]\displaystyle{ s }[/math] will give us [math]\displaystyle{ t }[/math].

While it may seem as though the operators have to be invertible for the reverse search, it is only necessary to be able to find, given any node [math]\displaystyle{ n }[/math], the set of parent nodes of [math]\displaystyle{ n }[/math] such that there exists some valid operator from each of the parent nodes to [math]\displaystyle{ n }[/math]. This has often been likened to a one-way street in the route-finding domain: it is not necessary to be able to travel down both directions, but it is necessary when standing at the end of the street to determine the beginning of the street as a possible route.

Similarly, for those edges that have inverse arcs (i.e. arcs going in both directions) it is not necessary that each direction be of equal cost. The reverse search will always use the inverse cost (i.e. the cost of the arc in the forward direction). More formally, if [math]\displaystyle{ n }[/math] is a node with parent [math]\displaystyle{ p }[/math], then [math]\displaystyle{ k_1(p,n) = k_2(n,p) }[/math], defined as being the cost from [math]\displaystyle{ p }[/math] to [math]\displaystyle{ n }[/math].(Auer Kaindl 2004)

Terminology and notation

[math]\displaystyle{ b }[/math]
the branching factor of a search tree
[math]\displaystyle{ k(n,m) }[/math]
the cost associated with moving from node [math]\displaystyle{ n }[/math] to node [math]\displaystyle{ m }[/math]
[math]\displaystyle{ g(n) }[/math]
the cost from the root to the node [math]\displaystyle{ n }[/math]
[math]\displaystyle{ h(n) }[/math]
the heuristic estimate of the distance between the node [math]\displaystyle{ n }[/math] and the goal
[math]\displaystyle{ s }[/math]
the start state
[math]\displaystyle{ t }[/math]
the goal state (sometimes [math]\displaystyle{ g }[/math], not to be confused with the function)
[math]\displaystyle{ d }[/math]
the current search direction. By convention, [math]\displaystyle{ d }[/math] is equal to 1 for the forward direction and 2 for the backward direction (Kwa 1989)
[math]\displaystyle{ d' }[/math]
the opposite search direction (i.e. [math]\displaystyle{ d' = 3 - d }[/math])
[math]\displaystyle{ \mathrm{TREE}_d }[/math]
the search tree in direction d. If [math]\displaystyle{ d = 1 }[/math], the root is [math]\displaystyle{ s }[/math], if [math]\displaystyle{ d = 2 }[/math], the root is [math]\displaystyle{ t }[/math]
[math]\displaystyle{ \mathrm{OPEN}_d }[/math]
the leaves of [math]\displaystyle{ \mathrm{TREE}_d }[/math] (sometimes referred to as [math]\displaystyle{ \mathrm{FRINGE}_d }[/math]). It is from this set that a node is chosen for expansion. In bidirectional search, these are sometimes called the search 'frontiers' or 'wavefronts', referring to how they appear when a search is represented graphically. In this metaphor, a 'collision' occurs when, during the expansion phase, a node from one wavefront is found to have successors in the opposing wavefront.
[math]\displaystyle{ \mathrm{CLOSED}_d }[/math]
the non-leaf nodes of [math]\displaystyle{ \mathrm{TREE}_d }[/math]. This set contains the nodes already visited by the search

Approaches for bidirectional heuristic search

Bidirectional algorithms can be broadly split into three categories: Front-to-Front, Front-to-Back (or Front-to-End), and Perimeter Search (Kaindl Kainz 1997). These differ by the function used to calculate the heuristic.

Front-to-back

Front-to-Back algorithms calculate the [math]\displaystyle{ h }[/math] value of a node [math]\displaystyle{ n }[/math] by using the heuristic estimate between [math]\displaystyle{ n }[/math] and the root of the opposite search tree, [math]\displaystyle{ s }[/math] or [math]\displaystyle{ t }[/math].

Front-to-Back is the most actively researched of the three categories. The current best algorithm (at least in the Fifteen puzzle domain) is the BiMAX-BS*F algorithm, created by Auer and Kaindl (Auer, Kaindl 2004).

Front-to-front

Front-to-Front algorithms calculate the h value of a node n by using the heuristic estimate between n and some subset of [math]\displaystyle{ \mathrm{OPEN}_{d'} }[/math]. The canonical example is that of the BHFFA (Bidirectional Heuristic Front-to-Front Algorithm),[2] where the h function is defined as the minimum of all heuristic estimates between the current node and the nodes on the opposing front. Or, formally:

[math]\displaystyle{ h_d(n) = \min_i \left \{H(n,o_i) | o_i \in \mathrm{OPEN}_{d'} \right \} }[/math]

where [math]\displaystyle{ H(n,o) }[/math] returns an admissible (i.e. not overestimating) heuristic estimate of the distance between nodes n and o.

Front-to-Front suffers from being excessively computationally demanding. Every time a node n is put into the open list, its [math]\displaystyle{ f = g + h }[/math] value must be calculated. This involves calculating a heuristic estimate from n to every node in the opposing OPEN set, as described above. The OPEN sets increase in size exponentially for all domains with b > 1.

References

  • de Champeaux, Dennis; Sint, Lenie (1977), "An improved bidirectional heuristic search algorithm", Journal of the ACM 24 (2): 177–191, doi:10.1145/322003.322004 .
  • de Champeaux, Dennis (1983), "Bidirectional heuristic search again", Journal of the ACM 30 (1): 22–32, doi:10.1145/322358.322360 .
  • Pohl, Ira (1971), "Bi-directional Search", in Meltzer, Bernard, Machine Intelligence, 6, Edinburgh University Press, pp. 127–140 .
  • "3.4 Uninformed search strategies", A Modern Approach (2nd ed.), Prentice Hall, 2002 .