16

I am trying to learn some search concepts but ran into a wall in the process. Can anyone explain to me what the difference is between hill climbing search and best first search? To me, they both look like expanding the nodes with the heuristic value closest to the goal. If anyone can explain the difference to me, it'd be greatly appreciated. Thanks!

skaffman
  • 398,947
  • 96
  • 818
  • 769
freddy
  • 161
  • 1
  • 1
  • 3

5 Answers5

13

You can view search algorithm as having a queue of remaining nodes to search. This answer demonstrates this principle.

In depth-first search, you add the current node's children to the front of the queue (a stack). In breadth-first search, you add the current node's children to the back of the queue. Think for a moment about how this leads to the right behaviour for those algorithms.

Now, in hill-climbing search, you sort[1] the current node's children before adding them to the queue. In best-first search, you add the current node's children to the queue in any old order, then sort[1] the entire queue. If you think about the effect that might have on the order in which nodes are searched, you should get an idea of the practical difference.

I found this concept too tangly to understand from purely abstract terms, but if you work through a couple of examples with a pencil it becomes simple.

[1]: sort according to some problem-specific evaluation of the solution node, for example "distance from destination" in a path-finding search.

Community
  • 1
  • 1
Brendan
  • 1,995
  • 1
  • 20
  • 35
9

A liitle late, but here goes.

In BFS, it's about finding the goal. So it's about picking the best node (the one which we hope will take us to the goal) among the possible ones. We keep trying to go towards the goal.

But in hill climbing, it's about maximizing the target function. We pick the node which provides the highest ascent. So unlike BFS, the 'value' of the parent node is also taken into account. If we can't go higher, we just give up. In that case we may not even reach the goal. We might be at a local maxima.

Jayanth Koushik
  • 9,476
  • 1
  • 44
  • 52
3

The difference lies in understanding what is more concerned in searching for the goal state.

Ask the question what is our aim... the final goal state? or the Best path to reach the goal state

The Best First Search is a systematic search algorithm where systematicity is achieved by moving forward iteratively on the basis of finding out the best heuristic value for the adjacent nodes for every current node.

Here the evaluation function ( heuristic function ) calculates the best possible path to achieve the goal state. So here we could see the Best First search is concerned about the best PATH to reach to the goal state.

However there are many problems where "Path to the Goal" is not a concern, the only thing is concerned is to achieve the final state in any possible ways or paths. (For eg: 8-queens problem).

Hence for this local search algorithms are used.

Local search algorithms operate using a single current node and generally move only to neighbor of that node.

Hill Climbing algorithm is a local search algorithm. So here we need to understand the approach to get to the goal state not the best path to reach when thinking about hill climbing.

(As stated in AI-A Modern Approach,SR & PN)

Basically, to understand local search we need to consider state-space landscape.

A landscape has both

(i) location (defined by the state) and

(ii) Elevation (defined by the value of heuristic function or objective function)

We need to understand the two types of elevations,

(i) If elevation corresponds to an objective function,then the aim is to find the highest peak i.e. a Global Maximum.

(So these type of elevation are useful in different scenarios which are not concerned with cost and which are only concerned with finding the best instant moves)

(ii) If elevation corresponds to cost, then the aim is to find the lowest valley i.e. a Global Minimum.

(Here is the common thing i.e. Steepest(always stepping up with better estimations i.e. no plateau problem or any other) hill climbing is similar to Best First Search. Here the elevation function is the heuristic function which provide the best minimum cost. And hill climbing here is only concerned with current node and iterates through the adjacent nodes for minimum value and proceeds with expanding the best node which is similar to Best First Search)

Note:

Hill Climbing algorithm does not look ahead beyond the immediate neighbors of the current state. It is only concerned with best neighboring node to expand.And the best neighboring is decided by the above evaluations functions.

Whereas, Best First Search algorithm look ahead of the immediate neighbors to find the best path to the goal(using Heuristic evaluation) and then proceeding with the best one. So difference lies in approach of local searches and systematic search algorithms.

Understand the difference in approaches, you will get to know why both are named different.

Reck
  • 1,388
  • 11
  • 20
2

Let me Wiki that for you:

In simple hill climbing, the first closer node is chosen, whereas in steepest ascent hill climbing all successors are compared and the closest to the solution is chosen.

...

Steepest ascent hill climbing is similar to best-first search, which tries all possible extensions of the current path instead of only one.

Tom Shaw
  • 660
  • 3
  • 7
  • what does it mean by "tries all possible extensions of the current path?" doesn't it only expand the node with the best heuristic value? – freddy May 27 '11 at 01:43
  • 8
    Best-first search calculates the value of ALL neighboring nodes and then iterates with the best one. Simple hill climbing calculates the value of each neighbouring node in turn and iterates as soon as it finds one better than the current node. – Tom Shaw May 27 '11 at 01:46
0

So Basically Steepest HC in the second step itself gets the answer to the problem as it's second move will be the most optimal solution and leading to the answer

  • As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Sep 16 '22 at 17:17