In computer science, hill climbing is a mathematical optimization technique which belongs to the family of local search. It is relatively simple to implement, making it a popular first choice. Although more advanced algorithms may give better results, in some situations hill climbing works just as well.
Hill climbing can be used to solve problems that have many solutions, some of which are better than others. It starts with a random (potentially poor) solution, and iteratively makes small changes to the solution, each time improving it a little. When the algorithm cannot see any improvement anymore, it terminates. Ideally, at that point the current solution is close to optimal, but it is not guaranteed that hill climbing will ever come close to the optimal solution.
For example, hill climbing can be applied to the traveling salesman problem. It is easy to find a solution that visits all the cities but will be very poor compared to the optimal solution. The algorithm starts with such a solution and makes small improvements to it, such as switching the order in which two cities are visited. Eventually, a much better route is obtained.
Hill climbing is used widely in artificial intelligence, for reaching a goal state from a starting node. Choice of next node and starting node can be varied to give a list of related algorithms.
Mathematical description
Hill climbing attempts to maximize (or minimize) a function f ( x ) , where x are discrete states. These states are typically represented by vertices in a graph, where edges in the graph encode nearness or similarity of a graph. Hill climbing will follow the graph from vertex to vertex, always locally increasing (or decreasing) the value of f , until a local maximum (or local minimum) x m is reached. Hill climbing can also operate on a continuous space: in that case, the algorithm is called gradient ascent (or gradient descent if the function is minimized).*.
![]()
Variants
In simple hill climbing , the first closer node is chosen, whereas in steepest ascent hill climbing all successors are compared and the closest to the solution is chosen. Both forms fail if there is no closer node, which may happen if there are local maxima in the search space which are not solutions. Steepest ascent hill climbing is similar to best-first search, which tries all possible extensions of the current path instead of only one.
Stochastic hill climbing does not examine all neighbors before deciding how to move. Rather, it selects a neighbor at random, and decides (based on the amount of improvement in that neighbor) whether to move to that neighbor or to examine another.
Random-restart hill climbing is a meta-algorithm built on top of the hill climbing algorithm. It is also known as Shotgun hill climbing . It iteratively does hill-climbing, each time with a random initial condition x 0 . The best x m is kept: if a new run of hill climbing produces a better x m than the stored state, it replaces the stored state.
Random-restart hill climbing is a surprisingly effective algorithm in many cases. It turns out that it is often better to spend CPU time exploring the space, than carefully optimizing from an initial condition.
Problems
Local maxima
A problem with hill climbing is that it will find only local maxima. Unless the heuristic is convex, it may not reach a global maximum. Other local search algorithms try to overcome this problem such as stochastic hill climbing, random walks and simulated annealing.
![]()
Ridges
A ridge is a curve in the search place that leads to a maximum, but the orientation of the ridge compared to the available moves that are used to climb is such that each move will lead to a smaller point. In other words, each point on a ridge looks to the algorithm like a local maximum, even though the point is part of a curve leading to a better optimum.
Plateau
Another problem with hill climbing is that of a plateau, which occurs when we get to a "flat" part of the search space, i.e. we have a path where the heuristics are all very close together. This kind of flatness can cause the algorithm to cease progress and wander aimlessly.
Pseudocode
Hill Climbing Algorithm currentNode = startNode; loop do L = NEIGHBORS(currentNode); nextEval = -INF; nextNode = NULL; for all x in L if (EVAL(x) > nextEval) nextNode = x; nextEval = EVAL(x); if nextEval <= EVAL(currentNode) //Return current node since no better neighbors exist return currentNode; currentNode = nextNode;Contrast genetic algorithm; random optimization.
See also
- Gradient descent
- Greedy algorithm
- Tâtonnement
References
- Russell, Stuart J.; Norvig, Peter (2003), Artificial Intelligence: A Modern Approach (2nd ed.), Upper Saddle River, NJ: Prentice Hall, pp. 111-114, ISBN 0-13-790395-2 , http://aima.cs.berkeley.edu/
This article was originally based on material from the Free On-line Dictionary of Computing, which is licensed under the GFDL.
Hillclimbing (cycling) - Wikipedia, the free encyclopedia
A hill climb usually represents an event which gains altitude continuously, usually terminating at a summit. Well known hill climbs include the Mt. Evans Hill Climb and the Mount ...
Camps ||| Lynn Hill Climbing Camps
Climbing Camps offered by world class climber Lynn Hill. Locations include Bishop, CA, Moab, UT, Eldorado Springs, CO, Vedauwoo, WY, New River Gorge, WY and Smith Rocks, OR.
Hill climbs - definition of Hill climbs by the Free Online Dictionary ...
hill climb. n (Individual Sports & Recreations / Motor Racing) a competition in which motor vehicles attempt singly to ascend a steep slope as fast as possible
Time Trials/Hill Climbs
North Road CC Hardriders 25 TT 2009: Submitted By: LondonCycleSport: The 'Big One' for many riders, the North Road CC Hardriders 25 Time Trial held in Hertfordshire on February 22.
Cycle2max | Hill Climbs
Bike Hill Climb - Cycle 2 max is the home of hill climb time trials for cyclists, meet other ridres, track your times and get training information direct to your email!
Bicycle Hill Climbs | Cycle2max
Hill climb time trials calculates Power using formula, make a rider profile, and interact with other bike riders.
Hill Climbs | Cycling UK
Hill Climb Agony (photo by Bernard Thompson) At the top of Stennying Hill Climb - Brighton Mitre CC Cyclists are a pretty idiosyncratic bunch. Shaving
YouTube - Formula Offroad Hill Climbs
awesome video. love the water crossing. is their any full dvd's of hill climbing on youtube under a different name.
Shetland Wheelers - Hill Climbs > Hill Climbs ...
... etland is not short of, it is hills. We maybe not have any 15km long alpine drags, but there is a mixture of all of the ...
Hillclimbing - Wikipedia, the free encyclopedia
Hillclimbing (also known as hill climbing, speed hillclimbing or speed hill climbing) is a branch of motorsport in which drivers compete against the clock to complete an uphill ...