Artificial Intelligence : Hill Climbing (Steepest Ascent)
In this blog, I will be discussing another heuristic algorithm which has slightly
better performance than Simple Hill Climbing. This algorithm is known as Hill
Climbing (Steepest Ascent).
out of all the nodes and then proceeds, unlike Simple Hill Climbing in which it
chooses the first better node it encounters and then proceeds. Thereby missing the
next nodes which may have higher heuristic values than the current node and leading
to the wrong selection and falling into local maxima.
continue with the initial state as current state.
2. Loop until a solution is found or until a complete iteration produces no change
to the current state:
a) Let SUCC be a state such that any possible successor of current state is
better than SUCC.
b) For each operator that applies to the current state do-
i) Apply the operator and generate a new state.
ii) Evaluate the new state, if it be a goal state then return it & quit.
Else if it is better than SUCC then set SUCC to this state else retain
SUCC as it was.
c) If SUCC is better than the current state then set current state to SUCC.
It cannot backtrack to its parent node. If it gets trapped in the local
maxima, then nothing can help it to get out of that situation.
the example code this time. My previous blog will serve as a reference. Take
this as a challenge and try to implement it. When you implement it yourself,
you will start to get the essence of AI. So best of luck with that.
Stay tuned and keep coding.