The second fundamental strategy, informed state-space search, is an application of the A* algorithm. Here we modeled the task of placing cookies as a sequence of transitions between nodes in the search tree, where each transition consists of placing a cookie on the dough in a particular way. When we expand a node, we create a set of
candidate nodes. The worst case running time for this algorithm is
.
For each node , we decomposed our cost function,
, as follows:
Running the A* algorithm starting with the empty node (no cookies) until a goal node is reached (all cookies placed) would produce an approximately optimal placement. We note that this approach is highly sensitive to the parameters b (the number of nodes expanded from each node) and , our overestimation factor. To avoid the exponentional running time
and to force the algorithm to run in a reasonable amount of time, we need to ensure that
is high enough and
is not too large. As
increases and
decreases, the algorithm runs faster because it inspects fewer nodes in the tree, but the result becomes less optimal.