A common way to avoid getting stuck in local maxima with Hill Climbing is to use random restarts. In your example if G is a local maxima, the algorithm would stop there and then pick another random node to restart from. So if J or C were picked (or possibly A, B, or D) you would find the global maxima in H or K. Rinse and repeat enough times and you'll find the global maxima or something close ...
The specific greedy algorithm you described constructs the solution greedily, while the hill climbing heuristic reaches a local optima greedily. The only difference is that the greedy step in the first one involves constructing a solution while the greedy step in hill climbing involves selecting a neighbour (greedy local search).
Does anyone know a good approach to solving the N queens problem as {N = 25}, using the vanilla hill-climbing algorithm?
I am trying to solve the 8 puzzle or sliding tile problem using Hill-Climbing algorithm in python. I Wrote the code to print each intermediate step until goal node is reached but no output is shown...
algorithm - What is the difference between Hill Climbing Search and ...
Hill-climbing algorithms are less deliberative; rather than considering all open nodes, they expand the most promising descendant of the most recently expanded node until they encounter a solution.
algorithm - what is the difference between Hill climbing and A* ...
Hill-climbing search and branch-and-bound are two heuristic search algorithms used in artificial intelligence. What is the difference between these two approaches?
You want to use the Manhattan distance that ignores the obstacles to direct Hill Climbing towards the locally best direction, and you want to find an example where this algorithm finds a local optimum.