The next 3 methods use an evaluation function to guide the search towards goal. Information about the state space will be used to guide the search. Knowledge is used in the queueing function to determine which node to expand next. This process uses an evaluation function:
Evaluation function f(n)
Cost: g(n)=C
heuristic: h(n)=E (estimate of distance to goal)
The evaluation function returns a number describing the desirability of expanding the node and uses these numbers to guide the search towards goal.
Search efficiency can be improved if you can estimate whether one choice is likely to be better than another, and order the choices accordingly. This is achieved by obtaining some measure of distance En between a node n and the goal. Sitting at a parent node we would determine the distances Ec1, ... of all its children from the goal. Then expand them in ascending order of E.
The hillclimbing algorithm is:
1. Form a one element queue Q consisting of the root node.
2. Until the Q is empty or the goal has been reached, determine if the first element in the Q is the goal.2a. If it is, do nothing.3. If the goal is reached, success; else failure.
2b. If is isn't, remove the first element from the Q, sort the first element's children, if any, by estimating remaining distance, and add this sorted list to the FRONT of the Q.
We can visualize the disadvantage of this search techniqure by using the hill-climbing analogy.
In best-first search expansion of nodes is resumed from the best open node visited so far, no matter where it is in the partially explored tree. The bestfirst algorithm is:
1. Form a one element queue Q consisting of the root node.
2. Until the Q is empty or the goal has been reached, determine if the first element in the Q is the goal.2a. If it is, do nothing.3. If the goal is reached, success; else failure.
2b. If is isn't, remove the first element from the Q, and add the first element's children, if any, to the Q. Sort Q by estimated remaining distance.
Note that Best-first search may NOT find the best path! Finding the optimum path is the subject of the next section.