Hill Climbing Algo
Hill Climbing Algo
• So, given a large set of inputs and a good heuristic function, the algorithm tries to
find the best possible solution to the problem in the most reasonable time period.
This solution may not be the absolute best(global optimal maximum) but it is
sufficiently good considering the time allotted.
• The definition above implies that hill-climbing solves the problems where we need to
maximize or minimize a given real function by selecting values from the given inputs.
• This basically means that this search algorithm may not find the
optimal solution to the problem but it will give the best possible
solution in a reasonable amount of time.
• It is a variant of the generate-and-test algorithm.
• At any point in state space, the search moves in that direction only
which optimizes the cost of function with the hope of finding the
most optimum solution at the end.
State Space diagram for Hill
Climbing
• The State-space diagram is a graphical representation of the set
of states(input) our search algorithm can reach vs the value of
our objective function(function we intend to
maximize/minimize). Here;
• 1. The X-axis denotes the state space i.e. states or configuration
our algorithm may reach.
• 2. The Y-axis denotes the values of objective function
corresponding to a particular state.
• The best solution will be that state space where objective
function has maximum value or global maxima.
• Following are the different regions in the State Space Diagram;
• Local maxima: It is a state which is better than its neighboring state however there exists
a state which is better than it (global maximum). This state is better because here the value
of the objective function is higher than its neighbors.
• Global maxima: It is the best possible state in the state space diagram. This because at
this state, objective function has the highest value.
• Plateau/flat local maxima: It is a flat region of state space where neighboring states have
the same value.
• Ridge: It is a region which is higher than its neighbor's but itself has a slope. It is a special
kind of local maximum.
• Current state: The region of state space diagram where we are currently present during
the search. (Denoted by the highlighted circle in the given image.)
Types of Hill Climbing
• 1. Simple Hill Climbing
• 1. Local maximum: At a local maximum all neighboring states have values which are
worse than the current state. Since hill-climbing uses a greedy approach, it will not
move to the worse state and terminate itself. The process will end even though a
better solution may exist.
• To overcome plateaus: Make a big jump. Randomly select a state far away
from the current state. Chances are that we will land at a non-plateau region
• 3. Ridge: Any point on a ridge can look like a peak because the movement in
all possible directions is downward. Hence, the algorithm stops when it
reaches such a state.
• To overcome Ridge: You could use two or more rules before testing. It implies
moving in several directions at once.
Applications of Hill Climbing
Technique
• Hill Climbing technique can be
used to solve many problems,
where the current state allows
for an accurate evaluation
function, such as Network-Flow,
Travelling Salesman problem, 8-
Queens problem, Integrated
Circuit design, etc.
• Hill climbing Is mostly used in robotics which helps their system to work as
a team and maintain coordination.
• Marketing
• Hill Climbing Algorithm is a very widely used algorithm for Optimization related
problems as it gives decent solutions to computationally challenging problems. It
has certain drawbacks associated with it like its Local Minima, Ridge, and Plateau
problem which can be solved by using some advanced algorithm.
Advantages of Hill Climbing In
Artificial Intelligence
1. Hill Climbing In Artificial Intelligence can be utilized nonstop, just like a
domain. It is beneficial in routing the related problems—for example,
portfolio management, chip designing, and job scheduling.
2. Hill Climbing is a good option in optimizing the problems when you
are limited to computational power.
3. This one is more efficient in contrast to other search algorithms.
4. Hill Climbing procedures are valuable in terms of vehicle routing,
automatic programming, circuit designing, etc.
5. It can tackle unadulterated advancement issues where the goal is to
point out the best suitable state (following the procedure or the goal
work).
Disadvantages of Hill Climbing In
Artificial Intelligence
• Hill Climbing Algorithm is one of the widely used algorithms for
optimizing the given problems. It provides outstanding solutions to
computationally challenging situations and has certain drawbacks also.
The disadvantages related to it are:
• Local Minima
• Ridge
• Plateau