Let be the traversable squares and the exits. Sample the state space at the end of each complete round, so a live state is with . The given starting positions specify the initial state. The board and exits are fixed problem data, rather than changing components of the state space.
The rabbit has at most five actions: stay or move to one of its traversable orthogonally adjacent squares. A search transition model first applies that action, giving , and immediately checks for capture at . Otherwise hold fixed and apply the fox rule twice, checking for capture after each step. A capture is terminal failure; it must not be overlooked merely because the fox could subsequently move elsewhere. A surviving successor is . Equivalently, omit actions whose complete-round outcome is capture.
The goal test is the rabbit is on an exit after surviving the fox's entire turn: and no capture occurred in that round. Merely entering an exit before the fox moves is insufficient. Each surviving search transition model step has cost one when minimizing rounds.
Only legal moves are considered when applying the stated horizontal preference: try a legal horizontal step that reduces horizontal separation, otherwise a legal vertical step that reduces vertical separation, otherwise stay. If a blocked preferred direction is instead interpreted as forcing a stay immediately, the counterexamples below and all completeness and optimality conclusions remain valid.
Write . The ordered position pairs give at most states, or live states after excluding capture. Thus the usual Big O notation estimate is . An additional terminal-failure marker changes this by only one.
For distinguishable foxes, retain . Different foxes may share a square; none may share the rabbit's square in a live state. There are at most live position tuples, giving . These counts describe possible encodings; obstacles, starting positions and the fixed fox rule can make the reachable state space much smaller.
The branching factor of the search tree is at most five, so through depth it has at most
nodes in Big O notation. With no depth bound, the search tree can be infinite, despite the finite state space: tree search retains different action histories even when they end at the same position pair.
For a concrete repeating history, use a two-row, three-column board, indexed from zero, with the sole obstacle , rabbit at and fox at . Repeated rabbit stays leave the fox blocked horizontally with no vertical separation to reduce. Hence the same live state can repeat forever. An exit at is nevertheless safely reachable in one round.
Breadth-first tree search is complete and optimal for minimizing rounds. If a successful escape has finite length , there are only finitely many nodes at depths below , since the branching factor is at most five. Breadth-first tree search therefore reaches a shallowest successful node after finite work, even if other branches continue forever.
It is an optimal search algorithm because every search transition model step costs one round, so minimum depth is exactly the desired minimum number of rounds. The goal test must be applied to the surviving complete-round successor. Here a complete search algorithm guarantees finding an escape when one exists; it need not terminate on every unsolvable instance.
Depth-first tree search is neither complete nor optimal for minimizing rounds.
For incompleteness, use the two-row, three-column board from part (c), with exit . If stay is the first action explored, depth-first tree search follows the repeating state forever. Moving the rabbit down instead survives the round: under legal horizontal-then-vertical movement the fox moves to and then , leaving the rabbit safely at the exit. Thus a one-round escape exists but is never reached in this action order.
For nonoptimality, use an unobstructed one-row board with columns , initial fox column , initial rabbit column , and exits at columns and . Moving left once escapes at column with the fox at column . Moving right twice escapes at column with successive fox positions . A depth-first tree search that explores the latter route first returns two rounds although one suffices. This counterexample supplies an actual returned, suboptimal escape independently of the infinite-branch example.
Ignore the fox and obstacles when estimating the remaining number of rabbit moves. Define the heuristic function
This is Manhattan distance to the nearest exit, a relaxation heuristic. Assume at least one exit; with none the instance is immediately unsolvable. The estimate is generally nonconstant and is not the perfect escape cost: obstacles can force detours, while pursuit can make an apparently nearby exit unreachable.
To prove it is a consistent heuristic, consider a surviving one-round transition from to . Let attain the minimum defining . The triangle inequality for Manhattan distance and the rabbit's move bound give
Every successful terminal state has . This proves consistency with unit round costs; summing the inequality along any successful route also proves that it is an admissible heuristic. Failed transitions need no successor estimate because they are discarded.
Breadth-first tree search remains complete but is not optimal for maximizing the bonus. Completeness depends on the finite branching factor and a finite successful depth, not on the objective used to compare escapes.
Use the one-row, seven-square example from part (e). The one-round escape at column leaves the fox at column , so its graph distance to the exit, and hence the bonus, is . The two-round escape at column leaves the fox at column , giving bonus . The earliest successful node therefore has bonus when bonus is achievable. Breadth-first tree search orders by rounds rather than terminal graph distance.
Breadth-first tree search is complete and is still not bonus-optimal. Fix any deterministic rule for choosing among equally short fox routes; the completeness argument again uses only the finite branching factor. The unobstructed corridor of part (g) has unique shortest paths, so its fox moves are exactly the same under the new strategy. The one-round bonus is and the two-round bonus is , proving nonoptimality without any tie-breaking ambiguity.
If there is no route between fox and rabbit, the printed shortest-path rule needs a convention; letting the fox stay supplies a natural extension. The completeness argument is unchanged, and the counterexample above uses only connected squares. When the fox and rabbit initially belong to the same connected component of a graph, the shortest-path pursuit distance bound also makes every surviving branch finite. That additional property does not make the first escape maximize its bonus.
Depth-first tree search is complete under the stated initial reachability assumption, but is not bonus-optimal.
Let be the graph distance between fox and rabbit after round , with their initial graph distance. Initial reachability makes finite, and ordinary moves preserve membership in their common connected component of a graph. After the rabbit's next move, the triangle inequality gives intermediate separation at most . If that separation is at most two, the fox catches the rabbit that round. Otherwise the fox takes two steps along a shortest path, leaving
Thus a successful surviving history has at most rounds; if it does not escape by then, the next round captures it. The shortest-path pursuit distance bound excludes infinite live branches, even when the rabbit stays. Together with the finite branching factor, it makes the whole relevant search tree finite, so depth-first tree search eventually finds an escape whenever one exists.
For nonoptimality, take the corridor of part (g) and let depth-first tree search try left first. It immediately returns the one-round escape with bonus , whereas trying right twice earns . The decreasing separation proves termination, not optimality of the first returned escape.

Articles by others on the same topic (0)

There are currently no matching articles.