# Why does hill climbing algorithm only produce a local maximum?

Apparently,the hill climbing algorithm just produces a local maximum,and not necessarily a global optimum.It's stuck on a local maximum.Why does hill climbing algorithm only produce a local maximum?

To answer your question is back to the stop criteria of HL.It will be stopped when reaching to a maximum point.The maximum point means a point which the objective function has a greater value in that point than on its$$\epsilon$$-neighborhood of that point.Therefore,if objective function has some local maxima,depends on the initial point of HL,it might be trapped in one of the local maxima as their definition is satisfied in the explained definition.