Some embodiments of the invention provide a method for costing an
expansion to a two-dimensional state in a path search that searches for a
path between two sets of states in a space. The method identifies a cost
function that is defined over the two-dimensional state. The method
computes a second cost function that is defined over the two-dimensional
state. It also computes a third cost function that is defined over the
two-dimensional state. It then adds the second and third cost functions
to obtain the first cost function.