Hill climbing is a simple heuristic that helps find the local optima of a given problem. While it is easy to implement, it can sometimes miss the (usually much better) global optima.

Pseudocode (VSV Copied)

#todo Improve with better pseudocode (?)

ALGORITHM HillClimbing(iterations):
  currentNode ← startNode
  For i from 1 to iterations do:
    neighbours := Get neighbours of current node
    nextEval := −infinity
    nextNode := empty
    for x in Locale do
      if Evaluation(x) > nextEval then
        nextNode := x
        nextEval := Evaluation(x)
    if nextEval ≤ Evaluation(currentNode) then
        // Return current node since no better neighbours exist
        return currentNode
    else
        currentNode := nextNode
**End Algorithm**