hill climbing Algorithm

Hill climbing finds optimal solutions for convex problems – for other problems it will find only local optima (solutions that can not be better upon by any neighboring configurations), which are not inevitably the best possible solution (the global optimum) out of all possible solutions (the search space).(i.e. repeated local search), or more complex schemes based on iterations (like iterated local search), or on memory (like reactive search optimization and tabu search), or on memory-less stochastic alterations (like simulated annealing).

hill climbing source code, pseudocode and analysis