# Hill climbing search in Artificial Intelligence

This article is all about the hill climbing in the heuristic search which is used in the field of AI for problem-solving using search techniques. We will learn about what the hill climbing search is and how it works, and also what algorithm it follows?
Submitted by Monika Sharma, on May 29, 2019

Hill climbing is a variety of Depth-First search. In this type of search (heuristic search), feedback is used to decide the next move in the state space. It is basically used for mathematical computations in the field of Artificial Intelligence.

The main concept of hill climbing can be understood as follows:

suppose we are climbing the hill and are present at some point. Our task is to reach the peak point of the hill. So, we look at the neighboring points where we can step. If that step takes us closer towards the peak, then we take that step, but if it takes us farther, then we do not take it. If more than two options are available to choose from, then we choose the best one which brings us closest to our goal state.

So, the strategy that we follow in the hill-climbing algorithm is that we look at the neighboring point, if it is at a level which is higher than our current position, then we take that step, else we do a further comparison of the other neighboring points.

## Algorithm for Hill Climbing

Step 1: Evaluate the current initial state. If it is the goal state, then return and quit.

Step 2: If the current state is not the goal state, then loop until a solution is found or there are no further operations left for comparison.

Step 3: Select a new state for comparison.

Step 4: Evaluate the new state:

1. If it is the goal state, i.e. the highest peak, then quit.
2. If it is better than the current state, then make it the new current state.
3. If it is not better than the current state, then go to step 2.

### Limitations/problems that occur in hill climbing

1. Local Maxima:

It is a state which is better than all the existing neighboring states but is not the peak point of the hill. 2. Plateau:

A plateau is a flat area and therefore no neighboring state in the search space exists so that it is better than the current point because all of them lie on the same plane. 3. Ridge:

It is an area in the search space which is higher than the surrounding areas but cannot be searched in a simple move. 