foundations of computational agents
The size of the search space of the generic search algorithm, for a given pruning strategy, depends on the path length and the branching factor. Anything that can be done to reduce these can potentially give great savings.
If the following conditions hold:
the set of goal nodes, $\{n:\text{goal}(n)\}$, is finite and can be generated
for any node $n$ the neighbors of $n$ in the inverse graph, namely $$, can be generated
the graph search algorithm can either begin with the start node and search forward for a goal node, or begin with a goal node and search backward for the start node. In many applications the set of goal nodes or the inverse graph cannot easily be generated so backward search may not be feasible; indeed, sometimes the purpose of the search is to just find a goal node and not the path to it.
In backward search, the frontier starts with a node labeled goal. The neighbors of goal are the goal nodes, $\{n:\text{goal}(n)\}$. The neighbours of the other nodes are given in the in the inverse graph. The search stops when it finds the start node. Once goal is expanded, the frontier contains all of the goal nodes.
Forward search searches from the start node to the goal nodes in the original graph.
For those cases where the goal nodes and the inverse graph can be created, it may be more efficient to search in one direction than in the other. The size of the search space is typically exponential in the branching factor. It is often the case that forward and backward searches have different branching factors. A general principle is to search in the direction that has the smaller branching factor.
The following sections consider some other ways in which search efficiency can be improved for many search spaces.
The idea of bidirectional search is to search forward from the start and backward from the goal simultaneously. When the two search frontiers intersect, the algorithm needs to construct a single path that extends from the start node through the frontier intersection to a goal node. It is a challenge to guarantee that the path found is optimal.
A new problem arises during a bidirectional search, namely ensuring that the two search frontiers actually meet. For example, a depth-first search in both directions is not likely to work at all unless one is extremely lucky because its small search frontiers are likely to pass each other by. Breadth-first search in both directions would be guaranteed to meet.
A combination of depth-first search in one direction and breadth-first search in the other would guarantee the required intersection of the search frontiers, but the choice of which to apply in which direction may be difficult. The decision depends on the cost of saving the breadth-first frontier and searching it to check when the depth-first method will intersect one of its elements.
There are situations where a bidirectional search results in substantial savings. For example, if the forward and backward branching factors of the search space are both $b$, and the goal is at depth $k$, then breadth-first search will take time proportional to ${b}^{k}$, whereas a symmetric bidirectional search will take time proportional to $2{b}^{k/2}$. This is an exponential saving in time, even though the time complexity is still exponential.
One of the ways that search may be made more efficient is to identify a limited number of places where the forward search and backward search could meet. For example, in searching for a path from two rooms on different floors, it may be appropriate to constrain the search to first go to the elevator on one level, go to the appropriate level and then go from the elevator to the goal room. Intuitively, these designated positions are islands in the search graph, which are constrained to be on a solution path from the start node to a goal node.
When islands are specified, an agent can decompose the search problem into several search problems, for example, one from the initial room to the elevator, one from the elevator on one level to the elevator on the other level, and one from the elevator to the destination room. This reduces the search space by having three simpler problems to solve. Having smaller problems helps to reduce the combinatorial explosion of large searches and is an example of how extra knowledge about a problem is used to improve efficiency of search.
To find a path between $s$ and $g$ using islands:
identify a set of islands ${i}_{0},\mathrm{\dots},{i}_{k}$
find paths from $s$ to ${i}_{0}$, from ${i}_{j-1}$ to ${i}_{j}$ for each $j$, and from ${i}_{k}$ to $g$.
Each of these searching problems should be correspondingly simpler than the general problem and, therefore, easier to solve.
The identification of islands is extra knowledge which may be beyond that which is in the graph. The use of inappropriate islands may make the problem more difficult (or even impossible to solve). It may also be possible to identify an alternate decomposition of the problem by choosing a different set of islands and search through the space of possible islands. Whether this works in practice depends on the details of the problem. Island search sacrifices optimality unless one is able to guarantee that the isands are on an optimal path.
The notion of islands can be used to define problem-solving strategies that work at multiple levels of detail or multiple levels of abstraction.
The idea of searching in a hierarchy of abstractions first involves abstracting the problem, leaving out as many details as possible. A solution to the abstract problem can be seen as a partial solution to the original problem. For example, the problem of getting from one room to another requires the use of many instances of turning, but an agent would like to reason about the problem at a level of abstraction where the steering details are omitted. It is expected that an appropriate abstraction solves the problem in broad strokes, leaving only minor problems to be solved.
One way this can be implemented is to generalize island-driven search to search over possible islands. Once a solution is found at the island level, this information provides a heuristic function for lower levels. Information that is found at lower level can inform higher levels by changing the arc lengths. For example, the higher level may assume a particular distance between exit doors, but a lower-level search could find a better estimate of the actual distance.
The effectiveness of searching in a hierarchy of abstractions depends on how one decomposes and abstracts the problem to be solved. Once the problems are abstracted and decomposed, any of the search methods could be used to solve them. It is not easy, however, to recognize useful abstractions and problem decompositions.