---
title: "Best-Case and Worst-Case Behavior of Greedy Best-First Search"
authors:
  - "Manuel Heusner"
  - "Thomas Keller"
  - "Malte Helmert"
doi: "10.24963/ijcai.2018/203"
url: "https://ijcai.org/proceedings/2018/203"
pdf: "https://ijcai.org/proceedings/2018/0203.pdf"
venue: "Proceedings of the Twenty-Seventh International Joint Conference on Artificial Intelligence"
year: 2018
pages: "1463-1470"
track: "Main track"
keywords:
  - "Heuristic Search and Game Playing: Heuristic Search"
---

# Best-Case and Worst-Case Behavior of Greedy Best-First Search

Manuel Heusner, Thomas Keller, Malte Helmert

*Proceedings of the Twenty-Seventh International Joint Conference on Artificial Intelligence*, pages 1463-1470. DOI: [10.24963/ijcai.2018/203](https://doi.org/10.24963/ijcai.2018/203)

## Abstract

We study the impact of tie-breaking on the behavior of greedy best-first search with a fixed state space and fixed heuristic. We prove that it is NP-complete to determine the number of states that need to be expanded by greedy best-first search in the best case or in the worst case. However, the best- and worst-case behavior can be computed in polynomial time for undirected state spaces. We perform computational experiments on benchmark tasks from the International Planning Competitions that compare the best and worst cases of greedy best-first search to FIFO, LIFO and random tie-breaking. The experiments demonstrate the importance of tie-breaking in greedy best-first search.

## Full text

## 1 Introduction

While the theoretical properties of optimal state-space search algorithms like A∗ or IDA∗ have been quite extensively studied (e.g., Martelli, 1977; Pearl, 1984; Dechter and Pearl, 1985; Korf et al., 2001; Helmert and R¨oger, 2008; Holte, 2010), satisficing search algorithms like greedy best-first search (GBFS, Doran and Michie, 1966) are considerably less well understood. The research goal of developing a theory of GBFS and related algorithms has recently received growing attention (e.g., Wilt and Ruml, 2014; 2015; 2016), but many basic questions remain unaddressed.

Anecdotal evidence suggest that tie-breaking has a significant impact on the performance of GBFS (e.g., Asai and Fukunaga, 2017), and indeed this is easy to see when considering an extreme scenario: with a constant heuristic, GBFS with best-case tie-breaking only expands the states along a shortest solution path, while it expands all states that can be reached without passing through a goal state with worst-case tie-breaking. However, practical applications of GBFS do not use constant heuristics, and understanding the impact of tiebreaking in the general case is much more challenging.

To understand the difficulty in analyzing the tie-breaking behavior of GBFS, it is instructive to contrast it with the much better understood behavior of A∗ search with an admissible and consistent heuristic. Consider such an A∗ search with an optimal solution cost of K. Let us call a state s an early layer state if f(s) &lt; K and a goal layer state if f(s) = K, s can be reached without passing through a goal state, and s itself is not a goal state. 1 The set of possibly expanded states then consists of all early layer states and all goal layer states. Under worst-case tie-breaking, A∗ expands exactly these states. The set of necessarily expanded states consists of all early layer states together with those goal-layer states that are part of every optimal solution. Under best-case tie-breaking, A∗ expands exactly the early layer states plus the minimum number of goal-layer states that occur in any optimal solution. The tie-breaking behavior of A∗ can be almost completely understood in terms of the possibly and necessarily expanded states, which can be easily computed.

For GBFS, the situation is significantly more complicated. We recently made a step towards a better understanding of GBFS by showing that every run of the algorithm can be partitioned into different episodes defined by so-called highwater mark benches [Heusner et al., 2017] . Based on this insight, we fully characterized the possibly expanded states. We also discussed necessarily expanded states, although without providing a complete characterization. The goal of this paper is to deepen the understanding of the best- and worst-case behavior of GBFS with the following contributions:

1. We show that, given an explicit representation of a state space, it is NP-complete to compute lower or upper bounds on the number of states expanded by GBFS.
2. Based on the decomposition of GBFS runs into high-water mark benches, we describe (worst-case exponential-time) algorithms for determining the bestcase and worst-case tie-breaking of GBFS.
3. We show that for undirected state spaces, best-case and worst-case tie-breaking of GBFS can be analyzed in polynomial time.
4. We provide an experimental analysis that demonstrates the gap between worst-case and best-case tie-breaking of GBFS on benchmarks from the International Planning Competitions. We also show how standard tie-breaking strategies compare experimentally to the best and worst case, and we explore the relationship between worstcase tie-breaking and the set of possibly expanded states.

1 There is no universal agreement in the literature whether the final goal state considered by a search algorithm counts as expanded. As their successors are not generated, we exclude goal states here.

Figure 1: State space topology 〈{A, . . . ,N}, succ,A, {N}〉 with succ as indicated by the arrows. Heuristic values are given by the levels, states are annotated with their high-water marks, and progress states are gray.

![Image](https://ijcai.org/proceedings/2018/fulltext/203/image_000000_8127af51aa679c81f692f25a5eaeecba5da3f51c3666b80c31150c42dd2d9929.png)

## 2 Background

State Space Topology We begin by introducing the formal background needed for this work.

Definition 1. A state space is a 4-tuple S = 〈S, succ, sinit, Sgoal〉, where S is a finite set of states, succ : S → 2S is the successor function, sinit ∈ S is the initial state, and Sgoal ⊆ S is the set of goal states. If s′ ∈ succ(s), we say that s′ is a successor of s and that s → s′ is a (state) transition.

A heuristic for S is a function h : S → R.

A state space topology is a pair 〈S, h〉, where S is a state space and h is a heuristic for S.

Figure 1 shows the state space topology that we use as an example throughout this paper.

For simplicity, we do not consider infinite heuristic values, which can be derived from an arbitrary state space topology by considering states with h(s) = ∞ as non-existent. We also do not consider transition costs, as these are ignored by greedy best-first search. A path of length n from state s to state s′ is a sequence of states π = 〈s0, . . . , sn〉 where s = s0, s′ = sn and si ∈ succ(si-1) for all 1 ≤ i ≤ n. We write P(s) for the set of all paths from s to any goal state.

Greedy Best-First Search The objective in state-space search is to find a path from the initial state to any goal state. The greedy best-first search algorithm solves this problem by keeping track of an open list (a set of states ready to be expanded) and a closed list (a set of states that have already been expanded), beginning with an empty closed list and an open list including only the initial state. Expanding a state involves generating its successors and adding those that are not yet open or closed to the open list. Expanded states are moved from the open to the closed list.

The algorithm terminates with success when a goal state is generated and with failure when no further expansions are possible because the open list has run empty. The search behavior in the failure case is easy to analyze (all reachable states must be expanded), so we only consider the success case in the following.

A critical decision for the efficiency of GBFS is which state to expand next if there are multiple open states. GBFS always selects a state with minimum heuristic value among all candidates. If there are multiple minimizers, the algorithm is underspecified, and different choices of minimizers lead to different behaviors of GBFS. We refer to the process that selects among these possible behaviors as a tie-breaking strategy.

The execution of GBFS on a given state space topology where state si is expanded in the i-th iteration and where the algorithm terminates after n expansions is called a run 〈s1, . . . , sn〉 of GBFS. In the trivial case where sinit ∈ Sgoal, only the empty run is possible; otherwise, s1 = sinit and sn always has a goal state as successor. We measure the performance of GBFS in terms of the number of state expansions, i.e., in the length of the run. This paper investigates the impact of tie-breaking on the performance of GBFS, with an emphasis on the best case (the shortest possible run for a given state space topology) and the worst case (the longest possible run). 〈A,G, L,E, I,M〉 and 〈A,G, L,C, F,D,H, I,M〉 are best and worst case runs in our example state space topology with 6 and 9 expansions, respectively.

In the rest of this paper, we assume that the initial state has a larger heuristic value than all other states and that all goal states have lower heuristic values than all non-goal states. These assumptions help avoid special cases in some of the following definitions. They do not affect the behavior of GBFS: the initial state is always the first expanded state regardless of its heuristic value, and the heuristic values of goal states are never considered because we terminate as soon as a goal state is generated.

High-Water Marks and Benches We now briefly recapitulate the observations of our previous work [Heusner et al., 2017] on the behavior of greedy best-first search in so far as they are relevant for this paper. We adapt the notations and terminology to suit the following discussions. The concept of high-water marks is central to the understanding of GBFS.

Definition 2. Let 〈S, h〉 be a state space topology with states S. The high-water mark of s ∈ S is

<!-- formula-not-decoded -->

We define the high-water mark of a set of states S′ ⊆ S as

<!-- formula-not-decoded -->

Intuitively, hwm(s) is the largest heuristic value that needs to be considered to reach a goal state from s. Figure 1 shows the high-water mark values of states from our example state space topology. As A has the highest heuristic value of all paths from A to a goal state, hwm(A) = 4, and hwm(F) = 3 as all paths from F to N are via B and h(B) = 3.

If S′ is the set of open states at any time during a GBFS run, then at least one state s with h(s) = hwm(S′ ) and no state s with h(s) &gt; hwm(S′ ) will be expanded during the rest of the run. Based on this observation, we showed that every GBFS run can be partitioned into episodes, where a new episode begins whenever a state is expanded whose high-water mark is lower than the high-water mark of all previously expanded states. We call the last state of every episode a progress state.

Definition 3. A state s of a state space topology 〈S, h〉 is a progress state iff hwm(s) &gt; hwm(succ(s)).

Progress states s always satisfy hwm(s) = h(s). The highwater mark of the set of states expanded in an episode is always equal to hwm(s), and the high-water mark of the set of states expanded after s has been expanded is always lower than hwm(s).

Progress states are depicted in gray in our example state space topology in Figure 1. In the run 〈A,G, L,E, I,M〉, for instance, the episode that starts with the expansion of A lasts until the next progress state, E, is expanded. The high-water mark of the episode is hwm({A,G, L}) = 3 = hwm(E) and the high-water mark of all states expanded after E is hwm({I, M}) = 2 &lt; hwm(E).

The key insight into understanding the search behavior of GBFS is that progress states behave like reset points upon whose expansion the open list could be cleared without affecting the behavior of the algorithm. In the example just given, even though C is inserted into the open list upon expanding A, it will never be expanded by GBFS regardless of the tie-breaking strategy after the expansion of E.

Hence, we can simulate the search behavior by treating all episodes as separate searches on a restricted state space called bench with a progress state as the initial state and subsequent progress states as goal states. 2

Definition 4. Let 〈S, h〉 be a state space topology with set of states S. Let s ∈ S be a progress state.

The bench level of s is level(s) = hwm(succ(s)).

The inner bench states inner(s) for s consist of all states s′′ ̸= s that can be reached from s on paths on which all states s′ ̸= s (including s′′ itself) are non-progress states and satisfy h(s′ ) ≤ level(s).

The bench exit states exit(s) for s consist of all progress states s′ with h(s′ ) = level(s) that are successors of s or of some inner bench state of s.

The bench states states(s) for s are {s}∪inner(s)∪exit(s). The bench induced by s, denoted by B(s), is the state space with states states(s), initial state s, and goal states exit(s). The successor function is the successor function of S restricted to states(s) without transitions to s and from bench exit states exit(s).

In our example state space topology, A induces the bench B(A) with inner(A) = {C, F,G, L} and exit(A) = {B, D, E}. Another bench is defined by progress state D with inner(D) = {G, H, L} and exit(D) = {I}. Note that benches do not partition the state space but may overlap. In the example, states G and L are inner states both of B(A) and B(D).

The bench transition system is the meta state space where states are the benches that are generated by at least one GBFS run and where edges are such that two benches are connected if an exit state of one bench induces the other bench.

Definition 5. Let T = 〈S, h〉 be a state space topology with initial state sinit. The bench transition system B(T ) of T is a directed graph 〈V, E〉 whose vertices are benches. The vertex set V and directed edges E are inductively defined as the smallest sets that satisfy the following properties:

2 The main differences of the following definitions to our previous work [Heusner et al., 2017] are that we define benches as state spaces, that we consider the progress state which induces a bench as part of the bench and that we only consider reduced benches.

1. B(sinit) ∈ V
2. If B(s) ∈ V , s′ ∈ exit(s), and s′ is a non-goal state, then B(s′ ) ∈ V and 〈B(s), B(s′ )〉 ∈ E.

A bench may contain craters which consist of states that are guaranteed to be expanded after expansion of a state.

Definition 6. Let 〈S, h〉 be a state space topology with set of states S.

The crater crater(s) of a progress state s ∈ S is the set of all states s′′ ∈ S that can be reached from s on paths on which all states s′ ̸= s (including s′′ ) satisfy h(s′ ) &lt; hwm(succ(s)) and hwm(s′ ) ≥ hwm(succ(s)), and the crater of a non-progress state s is the set of all states s′′ ∈ S that can be reached from s on paths on which all states s′ ̸= s (including s′′ ) satisfy h(s′ ) &lt; h(s) and hwm(s′ ) ≥ hwm(s).

The escape states escape(s) of a progress state s are all successor states s′′ of states s′ ∈ crater(s) that satisfy h(s′′ ) = hwm(succ(s)) and the escape state of a nonprogress state s are all successor states s′′ of states s′ ∈ crater(s) that satisfy h(s′′ ) = h(s).

Progress state A induces crater crater(A) = {G, L} with escape(A) = {D}, and non-progress state C induces crater (C) = {F, G, L} with escape(C) = {B, D}. Note that G and L are part of both craters.

## 3 NP-Completeness Results

We now formally introduce the problems of analyzing the best and worst case of GBFS. As is usual in complexity theory, we study the related decision problems and show that these are already NP-complete. It follows that the more general problems of computing the number of states expanded in the best/worst case and computing the best/worst runs are NP-equivalent [Garey and Johnson, 1979].

Definition 7. The GBFSBESTCASE problem is defined as follows: given a state space topology T and K ∈ N0, does there exist a GBFS run on T with at most K expanded states?

Definition 8. The GBFSWORSTCASE problem is defined as follows: given a state space topology T and K ∈ N0, does there exist a GBFS run on T with at least K expanded states?

We now show that both problems are NP-complete. To be clear, we assume that the state spaces in the input are explicitly represented as directed graphs, so the hardness is not related to the state explosion problem that makes state-space search in implicitly defined state spaces hard.

Theorem 1. GBFSBESTCASE is NP-complete.

Proof: For membership in NP, we guess a run for the given state space topology that satisfies the given bound and verify that it is a legal run. For hardness, we polynomially reduce from the NP-complete VERTEXCOVER problem: given a graph 〈V,E〉 and number M, does there exist a subset C ⊆ V with |C| ≤ M such that C ∩ e ̸= ∅ for all e ∈ E?

Given a VERTEXCOVER instance with vertices V , edges E = {e1, . . . , en} and bound M, we produce a GBFSBESTCASE instance with bound K = 2n + 1 + M and a state space topology with initial state s1 with heuristic value 3; edge branch states s2, . . . , sn+1 with heuristic value 2; for every edge ei = {u, v}, two edge decision states sui and svi with heuristic value 2; for every vertex v ∈ V , a vertex state v with heuristic value 1; a goal state s∗ with heuristic value 0; for every edge ei and vertex v ∈ ei, transitions si → svi , svi → si+1 and svi → v; and a transition sn+1 → s∗ .

Figure 2: Illustration of the proof of Theorem 1, depicting a GBFS run that allows to compute the vertex cover of a graph 〈{A, B, C, D}, {{A, B}, {A, C}, {B, C}, {C, D}}〉.

![Image](https://ijcai.org/proceedings/2018/fulltext/203/image_000001_e26add15ae8fffed93bac01f2c2a38df897df01327b4b285333536c5c6d2a0d8.png)

The reduction is illustrated in Figure 2. Every GBFS run must expand the initial state (1 expansion), all edge branch states (n expansions) and at least one edge decision state per edge (n expansions). If edge decision state eui is expanded, vertex state u must also be expanded. It is easy to see that the expanded vertex states form a vertex cover, and that a run with at most K = 2n + 1 +M expansions exists iff there exists a vertex cover of size at most M. □

We remark that the state space topology used in the reduction only consist of a single bench, and that the best case of GBFS is hence already hard to compute for a single bench. The difficulty of minimizing GBFS expansions stems from overlapping crater states: expanding certain states (the edge decision states in the reduction) forces the expansion of adjacent crater states that form a heuristic depression (the vertex states in the reduction). The cost incurred by crater state expansions cannot be quantified locally because craters can overlap and global optimization is hence required.

In contrast to the best case, the worst case of GBFS is easy to determine for a single bench: the worst case on a single bench is always to expand all non-exit states in some order, and then any exit state. (This is always possible.) Still, analyzing the worst case of GBFS is hard as we prove next.

Theorem 2. GBFSWORSTCASE is NP-complete.

Proof: For membership in NP, we guess a run for the given state space topology that satisfies the given bound and verify that it is a legal run. For hardness, we polynomially reduce from the NP-complete SAT problem: given a set of propositional variables V and a set of clauses C over V (represented as sets of literals), does there exist a truth assignment for V that satisfies all clauses?

Given a SAT instance with variables V = {v1, . . . , vn} and clauses C, we produce a GBFSWORSTCASE instance with bound K = 2n + 1 + |C| and a state space topology with variable branch states s1, . . . , sn+1 with heuristic values h(si) = 2(n - i) + 4 (s1 is the initial state); for every variable vi, two literal states vi and ¬vi with heuristic value 2(n - i) + 3; for every clause c ∈ C, a clause state c with heuristic value 1; a goal state s∗ with heuristic value 0; for every variable vi and literal ℓ ∈ {vi, ¬vi}, transitions si → ℓ, ℓ → si+1 and ℓ → c for all clauses c with ℓ ∈ c; and a transition sn+1 → s∗ .

Figure 3: Illustration of the proof of Theorem 2, depicting a GBFS run that allows to determine the satisfiability of the formula ¬v1 ∧ (v1 ∨ ¬v2) ∧ (v2 ∨ v3).

![Image](https://ijcai.org/proceedings/2018/fulltext/203/image_000002_a258f3f7a59dfc04d0506d3c1e66bc39043200b5b6d8e5b78327aa409f9d316c.png)

The reduction is illustrated in Figure 3. It is very similar to the one from the previous proof. The main difference is that we define the heuristic values in such a way that GBFS is prevented from expanding both literal states belonging to the same variable in one run. Truth assignments correspond to paths through the variable branch and literal states. From this, it is easy to see that satisfying assignments correspond to runs where all clause vertices are expanded, which is equivalent to saying that at least K = 2n+1+ |C| states are expanded. □

Again, the hardness stems from the difficulties caused by overlapping craters. The difference to the result above is that now the overlap is between craters from different benches, as determining the worst case for a single bench is easy.

## 4 Algorithms

Despite the discouraging results of the previous section, we now present algorithms for the computation of the best- and worst-case tie-breaking behavior of GBFS. A straightforward approach searches in the space of open and closed list configurations and starts with a search node whose open list only contains the initial state and whose closed list is empty. Search nodes are expanded by creating successors for each state in the open list of the search node with minimal heuristic value, and successor nodes are equal to their predecessors except that the expanded state is moved to the closed list and all successor states of the expanded state that are not yet open or closed are added to the open list.

Applying this algorithm to our example state space topology leads to a search node whose open list contains the states C and E and whose closed list conisists of A,G and L. Expanding this search node creates the two successors 〈{E, F}, {A, C, G, L}〉 and 〈{C, I}, {A, E, G, L}〉. The straightforward algorithm keeps track of the whole open and closed list in each search node and creates a search node for each possible open and closed list configuration. We present two algorithms in the following that operate on a more compact data structure and omit search inside of craters (for GBFSBESTCASE) and benches (for GBFSWORSTCASE) by exploiting previous insights on the search behavior of GBFS.

Figure 4: Surface graph of our example state space topology from Figure 1. States are annotated with their crater unless it is empty.

![Image](https://ijcai.org/proceedings/2018/fulltext/203/image_000003_8f3cc02d2e1648c5c53e47c4463e9d8861035d1040b164f311bf945a44bceb06.png)

Best Case Analysis The algorithm that determines theminimum number of states expanded by GBFS for a given state space topology operates on the surface graph, the search space that contains only states s with h(s) = hwm(s) that are expanded by at least one instance of GBFS. To derive the surface graph, we

1. compute hwm(sinit) by running an instance of GBFS with an arbitrary tie-breaking strategy;
2. expand all states s with h(s) ≤ hwm(sinit) that can be reached from sinit without passing through a goal state;
3. determine hwm(s) for all expanded states s by backpropagation from goal states;
4. reduce the state space by removing all states and adjacent transitions that are not included in a bench of the bench transitions system;
5. remove all remaining states s and adjacent transitions with h(s) ̸= hwm(s); and
6. for each remaining state s, add a transition from s to each s′ ∈ escape(s).

Steps 1 and 2 compute an overapproximation of the set of possibly expanded states, and steps 3 and 4 refine the approximation to the exact set (the fact that finite high-water marks larger than hwm(sinit) are considered infinite by our procedure is irrelevant for the computation of the set of possibly expanded states). The final steps 5 and 6 reduces this further to the surface graph 〈S,E〉 by removing all states with different heuristic and high-water mark values and by adding transitions between states that lead into and out of each crater.

Our algorithm exploits the fact that we are not interested in the behavior of any tie-breaking strategy, but in the best-case behavior of GBFS: first, it only considers successors nodes that are implied by a transition, as a best-case run must be such that subsequent states in the surface graph are connected in the surface graph (this is not the case for other tie-breaking strategies: e.g., it is possible to expand state E after state F in our example even though they are not connected). And second, rather than keeping track of all states in the closed list it restricts to the set of states that can be encountered in the bestcase more than once, i.e., visited states that are part of at least one crater. By picking an appropriate cost function that ensures that states that have to be expanded are reflected in the cost of the expansion and by tracking visited crater states, we can turn the problem into a shortest path problem that can be solved with uniform cost search on the surface graph. Search nodes are hence pairs 〈s,D〉, where s ∈ S is the last expanded state, and D is the set of crater states that has been expanded on the way to s.

A search node 〈s,D〉 is expanded by creating a successor 〈s′ ,D ∪ crater(s′ )〉 for each (s, s′ ) ∈ E, and the cost of the transition from 〈s,D〉 to 〈s′ ,D′ 〉 is cost(〈s,D〉, 〈s′ ,D′ 〉) = 1 + |D′ \ D|; 1 for the expansion of s′ and |D′ \ D| for the expansion of previously unexpanded crater states. The initial search node is 〈sinit, crater(sinit)〉 and each 〈s,D〉 with succ(s) ∩ Sgoal ̸= ∅ is a goal node. The number of states that are expanded by GBFS under best-case tiebreaking corresponds to the sum of cost of the shortest path and 1+|crater(sinit)| for the expansion of the initial state and its crater states.

The surface graph of our example state space topology is depicted in Figure 4. It contains exactly the states s with h(s) = hwm(s). All crater states crater(s), which are annotated with s in Figure 4, are removed from the surface graph. This also leads to the removal of the transition from H to G even though G is not in a crater on B(D). However, the transition from H to G cannot be part of a best-case run of GBFS because there cannot be a path to a goal from G on B(D) (since it is part of another crater on a higher bench, it only has escape states on the higher bench).

Computing GBFSBESTCASE on the surface graph rather than a search in the space of open and closed list configurations results in smaller search nodes where we only have to keep track of the last expanded state and all expanded crater states, and it results in a smaller number of search nodes since we do not perform search in craters (the expansion of crater states is encoded in the cost and transition functions) and noncrater states with infinite high-water mark which can never be part of a best-case tie-breaking strategy.

Worst Case Analysis The introduction of the surface graph allows us to perform uniform cost search to determine the best-case behavior of GBFS. For the worst-case, we can simplify the search space even further since transitions within benches are irrelevant: for each bench, all non-exit states and a single exit state are expanded in the worst-case (it is only a single exit state as an algorithm has to move onto the next bench once an exit state is expanded). To put this insight into an algorithm, we reduce the surface graph even further and remove all transitions within one bench and add a transition from the progress state that defines a bench to all exit states of the bench. The resulting graph is equivalent to the bench transition system (with the exception that nodes are progress states rather than benches induced by the progress states), which we have shown to be a directed acyclic graph in previous work [Heusner et al., 2017].

We derive a similar search structure from this graph as in the best-case. The only difference is the successor generation, which creates a search node 〈s′ , D∪inner(s′ )〉 for each (s, s′ ) in the bench transition system when 〈s,D〉 is expanded. In this search space, we perform a longest path search, which can be computed in time polynomial in the size of an directed acyclic graph [Lawler, 1976] as the hwm-levels induce a suitable topological ordering.

Figure 5: Bench transition system of our example state space topology from Figure 1. Progress states are annotated with the set of inner bench states of the induced bench unless it is empty.

![Image](https://ijcai.org/proceedings/2018/fulltext/203/image_000004_549c06c0db6bfe40ee718b874bd0ea8be0dc722fc922c072b70f9f3e02f1bc28.png)

## 5 Tractability Results

In this section, we discuss properties of state space topologies that can be determined in polynomial time and that allow a polynomial computation of GBFSBESTCASE and GBFSWORSTCASE despite the complexity of the general case.

Definition 9. Let T be a state space topology with set of states S and bench transition system B(T ) = 〈V, E〉.

T is undirected iff s′ ∈ succ(s) ⇔ s ∈ succ(s′ ) for all states s, s′ ∈ S.

T is overlap-free with respect to benches iff inner(s) ∩ inner(s′ ) = ∅ for all benches B(s), B(s′ ) ∈ V with level(s) ̸= level(s′ ).

T is overlap-free with respect to craters iff crater(s) ∩ crater(s′ ) = ∅ for all pairwise distinct s, s′ ∈ states(p) and all benches B(p) ∈ V with h(s) = h(s′ ) = hwm(s) = hwm(s′ ) = level(p).

Let us now investigate what these properties mean for the complexity of GBFSWORSTCASE and GBFSBESTCASE.

Theorem 3. GBFSWORSTCASE can be decided in polynomial time and space for a given state space topology T and K ∈ N0 if T is overlap-free with respect to benches.

Proof: We know that benches along each path in the bench transition system have monotonously decreasing and therefore distinct hwm-levels [Heusner et al., 2017]. Moreover, the complexity of GBFSWORSTCASE results from states that occur on benches of different hwm-levels along a bench path.

As each pair of benches in a run is overlap-free, we can determine the worst-case behavior of GBFS by running our general algorithm of the previous section directly on the bench transition system with cost function cost(s, s′ ) = 1 + |inner(s′ )| in time linear in the number of exit states from the bench transition system. 3 □

Theorem 4. GBFSWORSTCASE can be decided in polynomial time and space for a given state space topology T and K ∈ N0 if T is undirected.

Proof: We show that a state can only be shared between two consecutive benches of the bench transition system.

Let us assume there is a state s and three consecutive benches defined by progress states p, p′ , and p′′ with level(p) &gt; level(p′ ) &gt; level(p′′ ) such that s ∈ inner(p) and s ∈ inner(p′′ ). As s is in inner(p), we know that hwm(s) ≥ level(p) (1). As s is in inner(p′′ ) and as S is undirected, there must be a path from s over p′′ to a goal bench which only includes states s′ with h(s′ ) ≤ level(p′′ ), and hence h(p′′ ) ≥ hwm(s) (2). Finally, as p′′ is in exit(p′ ), we know that level(p′ ) = h(p′′ ) and hence level(p) &gt; h(p′′ ) due to level(p) &gt; level(p′ ) (3).

3 Our result also holds if there is no pair of benches on a path in the bench transition system that shares a state. However, since it is not possible to compute this property in polynomial time for a given state space topology, we present the less general result here.

Table 1: Number of undirected (u), overlap-free (of), other (o) and total number of instances where the search space and the best- and worst-case tie-breaking have been computed.

|           |   best case - of |   best case - u |   best case - o |   best case - total |   worst case - of |   worst case - u |   worst case - o |   worst case - total |
|-----------|------------------|-----------------|-----------------|---------------------|-------------------|------------------|------------------|----------------------|
| instances |              406 |              31 |             327 |                 764 |               471 |               10 |              283 |                  764 |
| covered   |              406 |              31 |             242 |                 679 |               466 |               10 |              263 |                  739 |

With this, we have hwm(s) (1) ≥ level(p) (3) &gt; h(p′′ ) (2) ≥ hwm(s), which contradicts the assumption.

Since dependencies can only arise between consecutive benches, we can determine the worst-case behavior of GBFS by running our general algorithm of the previous section directly on the bench transition system with cost function cost (s, s′ ) = 1 + |inner(s′ ) \ inner(s)|. □

Theorem 5. GBFSBESTCASE can be decided in polynomial time and space for a given state space topology T and K ∈ N0 if T is overlap-free with respect to craters and benches.

Proof: The proof is analogously to the proof of Theorem 3 applied to craters instead of benches and with cost function cost (s, s′ ) = 1 + |crater (s′ )|. □

Theorem 6. GBFSBESTCASE can be decided in polynomial time and space for a given state space topology T and K ∈ N0 if T is undirected.

Proof: Since s ∈ escape(s′ ) iff s′ ∈ escape(s) in undirected state spaces, the surface graph of an undirected state space is undirected as well. Moreover, (s, s′ ) ∈ E of the surface graph iff crater(s) ∩ crater(s′ ) ̸= ∅. Therefore, dependencies arise only between two neighboring states and we can run the general algorithm directly on the surface graph with cost function cost(s, s′ ) = 1+ |crater(s′ ) \ crater(s)|. □

## 6 Experimental Results

We implemented all presented algorithms in the Fast Downward planning system [Helmert, 2006] and performed experiments on the benchmark sets of the 1998-2014 International Planning Competitions (IPC) with the hFF heuristic [Hoffmann and Nebel, 2001] and unit cost. We restricted the benchmark sets to tasks where GBFS search with hFF and FIFO tie-breaking found a plan within 30 minutes and 3.5 GB memory, which has been possible for 2519 instances.

For each instance, we computed the reduced state space with step 1 - 4 of surface graph computation, and determined the relevant properties of the state space topology, i.e., if it is overlap-free (with respect to benches and craters) or not overlap-free but undirected. This was possible for 764 instances from 78 domains within a time limit of 30 minutes and a memory limit of 3.5 GB. These instances form the benchmark set that we used for the further experiments. The surface graphs and the bench transition systems were generated on the fly for the computation of best or worst case in order to save memory.

Figure 6: Number of states versus number of search nodes generated by the best case and worst case algorithms for each search space that is neither undirected nor overlap-free.

![Image](https://ijcai.org/proceedings/2018/fulltext/203/image_000005_d4bc50d79b8fb0140cdf162a087b58a9c55b00252b38544af1c2f0a755c2522a.png)

## 6.1 Evaluation of Tractability

An overview on the number of instances for which we were able to compute the minimal and/or the maximal number of states that are expanded by GBFS is given in Table 1. In 665 instances, both values have been computed, and only the best or worst case in an additional 14 and 74, respectively.

Even though the percentage of instances for which we could perform the tie-breaking analysis is high in general, one can see that the success rate is much higher for the polynomial special cases: we have results for the best case for all overlapfree or undirected instances, while there are only 5 instances for which we could not come up with an upper bound on the number of GBFS expansions.

The NP-hardness of the general problem can be observed for the numbers on the remaining instances, where the possibly exponential blow-up seems to be more present when computing the best case (not successfull in 85 instances) than when computing the worst case (not successfull in just 20 instances). To support this hypothesis, Figure 6 plots the number of generated states in the surface graph (best case) or bench transition system (worst case) in comparison to the number of generates search nodes for each instance that is neither undirected nor overlap-free. For the worst case, the blow-up is almost always signifcantly below an order of magnitude, while it is usually close to one and up to more than three orders of magnitude for the best case.

## 6.2 Evaluation of Tie-Breaking Strategies

In our second experiment, we compare the performance of the well-known tie-breaking strategies FIFO, LIFO and random (averaged over 10 runs) with the best and worst case. One of our main results is that the influence of tie-breaking is indeed highly significant in practice - Figure 7 shows that GBFS with worst-case tie-breaking has to expand approximately 10 times as many states as GBFS with best-case tie-breaking in state space topologies without craters (left plot), and as much as 100 as many in the presence of craters (center plot).

The three considered tie-breaking strategies are not far from the best case in crater-free state space topologies. This result matches the insights of Hoffmann [2005], whose heuristic benches relate to high-water mark benches in craterfree instances. In state space topologies with craters, the picture is different: the number of expanded states of the specific tie-breaking strategies is about 10 times the number of the best case. Since the differences between FIFO, LIFO and random are additionally negligible, we assume that no good GBFS tie-breaking strategy has been found so far.

## 6.3 Worst Case and Possibly Expanded States

In our final experiment, we are interested in the relationship between the number of possibly expanded states and the number of states expanded under worst-case tie-breaking, which is shown in Figure 7 for state spaces with or without craters. In the presence of craters, both numbers are similar, i.e., almost all states that are expanded by some tie-breaking strategy are expanded in the worst case. We assume this is because most states can be reached on many different ways.

In crater-free state space topologies, this is not the case, and the number of states expanded by the worst-case tiebreaking strategy is often less than 1% of the possibly expanded states. This is very different from the result in A∗ and is one explanation why GBFS is often a good choice in satisficing planning.

## 7 Conclusion

We analyzed the problem of computing the number of states expanded by GBFS under worst-case and best-case tiebreaking and showed that the computation is NP-complete for the general case, but polynomial in undirected or overlapfree state space topologies. We presented worst-case exponential time algorithms for arbitrary state spaces and polynomial variants for the tractable subsets.

Our experimental analysis reveals that the gap between best- and worst-case tie-breaking is large and that there is plenty of room for improvement over standard tie-breaking strategies in state space topologies with craters.

We plan to extend our work in multiple directions: there is room for improvement in the computation of the graphs required for our analysis, which is a promising direction since the current implementation works for only approximately one third of the instances that can be solved by GBFS; we plan to use our insights to design tie-breaking strategies for GBFS that are closer to the best case even in the presence of craters; and we work on a comparison of different heuristics, where numbers on best- and worst-case tie-breaking strategies allow to compare the quality of heuristics for GBFS similar to the dominance of higher admissible heuristic estimates in A∗ .

## Acknowledgments

This work was supported by the European Research Council as part of the project "State Space Exploration: Principles, Algorithms and Applications".

Figure 7: Left and middle: number of instances where GBFS expands at most a given number of states for different tie-breaking strategies. (Legend is sorted by decreasing performance of tie-breaking strategies) Right: comparison of the number of possibly expanded states and expanded states under worst case tie-breaking.

![Image](https://ijcai.org/proceedings/2018/fulltext/203/image_000006_944f3bad3b8842c4b27996d0c1e69836609c9f432403d17d5a1c63bd930259aa.png)

## References

1. [Asai and Fukunaga, 2017] Masataro Asai and Alex Fuku- naga. Exploration among and within plateaus in greedy best-first search. In Proceedings of the Twenty-Seventh International Conference on Automated Planning and Scheduling (ICAPS 2017), pages 11-19. AAAI Press, 2017.
2. [Dechter and Pearl, 1985] Rina Dechter and Judea Pearl. Generalized best-first search strategies and the optimality of A * . Journal of the ACM, 32(3):505-536, 1985.
3. [Doran and Michie, 1966] James E. Doran and Donald Michie. Experiments with the graph traverser program. Proceedings of the Royal Society A, 294:235-259, 1966.
4. [Garey and Johnson, 1979] Michael R. Garey and David S. Johnson. Computers and Intractability -A Guide to the Theory of NP-Completeness. Freeman, 1979. [Helmert and Röger, 2008] Malte Helmert and Gabriele Röger. How good is almost perfect? In Proceedings of the Twenty-Third AAAI Conference on Artificial Intelligence (AAAI 2008), pages 944-949. AAAI Press, 2008.
5. [Helmert, 2006] Malte Helmert. The Fast Downward plan- ning system. Journal of Artificial Intelligence Research, 26:191-246, 2006.
6. [Heusner et al., 2017] Manuel Heusner, Thomas Keller, and Malte Helmert. Understanding the search behaviour of greedy best-first search. In Alex Fukunaga and Akihiro Kishimoto, editors, Proceedings of the 10th Annual Sym- posium on Combinatorial Search (SoCS 2017), pages 47- 55. AAAI Press, 2017.
7. [Hoffmann and Nebel, 2001] Jörg Hoffmann and Bernhard Nebel. The FF planning system: Fast plan generation through heuristic search. Journal of Artificial Intelligence Research, 14:253-302, 2001.
8. [Hoffmann, 2005] Jörg Hoffmann. Where 'ignoring delete lists' works: Local search topology in planning bench- marks. Journal of Artificial Intelligence Research, 24:685- 758, 2005.
9. [Holte, 2010] Robert C. Holte. Common misconceptions concerning heuristic search. In Ariel Felner and Nathan Sturtevant, editors, Proceedings of the Third Annual Sym- posium on Combinatorial Search (SoCS 2010), pages 46- 51. AAAI Press, 2010.
10. [Korf et al., 2001] Richard E. Korf, Michael Reid, and Ste- fan Edelkamp. Time complexity of iterative-deepening A * . Artificial Intelligence, 129:199-218, 2001.
11. [Lawler, 1976] Eugene L. Lawler. Combinatorial Optimiza- tion: Networks and Matroids. Holt, Rinehart and Winston, 1976.
12. [Martelli, 1977] Alberto Martelli. On the complexity of ad- missible search algorithms. Artificial Intelligence, 8:1-13, 1977.
13. [Pearl, 1984] Judea Pearl. Heuristics: Intelligent Search Strategies for Computer Problem Solving. Addison- Wesley, 1984.
14. [Wilt and Ruml, 2014] Christopher Wilt and Wheeler Ruml. Speedy versus greedy search. In Stefan Edelkamp and Ro- man Barták, editors, Proceedings of the Seventh Annual Symposium on Combinatorial Search (SoCS 2014), pages 184-192. AAAI Press, 2014.
15. [Wilt and Ruml, 2015] Christopher Wilt and Wheeler Ruml. Building a heuristic for greedy search. In Levi Lelis and Roni Stern, editors, Proceedings of the Eighth Annual Symposium on Combinatorial Search (SoCS 2015), pages 131-139. AAAI Press, 2015.
16. [Wilt and Ruml, 2016] Christopher Wilt and Wheeler Ruml. Effective heuristics for suboptimal best-first search. Jour- nal of Artificial Intelligence Research, 57:273-306, 2016.
