0% found this document useful (0 votes)
19 views

Session 56 Co1_local Search Algorithm

This document provides an overview of local search algorithms, specifically focusing on the Hill Climbing algorithm and its variations, including Simple Hill Climbing, Steepest Ascent Hill Climbing, and Stochastic Hill Climbing. It discusses the concept of local search in AI, its applications in optimization problems, and the challenges faced such as local maxima, plateaus, and ridges. Additionally, it introduces Simulated Annealing as a method to overcome some limitations of traditional hill climbing approaches.

Uploaded by

sanjanarrao.2005
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views

Session 56 Co1_local Search Algorithm

This document provides an overview of local search algorithms, specifically focusing on the Hill Climbing algorithm and its variations, including Simple Hill Climbing, Steepest Ascent Hill Climbing, and Stochastic Hill Climbing. It discusses the concept of local search in AI, its applications in optimization problems, and the challenges faced such as local maxima, plateaus, and ridges. Additionally, it introduces Simulated Annealing as a method to overcome some limitations of traditional hill climbing approaches.

Uploaded by

sanjanarrao.2005
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 28

ARTIFICIAL INTELLIGENCE &

MACHINE LEARNING

Topic:
LOCAL SEARCH ALGORITHM:
HILL CLIMBING

Session – 05 &
06
AIM OF THE SESSION

To familiarize students with the basic concept of Heuristic functions

INSTRUCTIONAL
OBJECTIVES

This Session is designed to:


1. Explain What is Local Search Algorithm?
2. Describe different types of Local Search Algorithm:Hill Climbing Algorithm,
Simulated Annealing

LEARNING OUTCOMES

At the end of this session, you should be able to:


1. Define the concept of Local Search Algorithm
2. Understand about types of Local search, Hill Climbing Algorithm, Simulated
Annealing
SESSION INTRODUCTION

• This session provides the basics of Local Search, Hill


Climbing, Simulated Annealing.

• This session also gives an idea about types of


Optimization
Local Search Algorithm

What Is Local Search In AI?


• Local search is a type of Artificial Intelligence (AI) algorithm used to solve optimisation
problems. It is also known as simulated annealing or hill-climbing and involves searching for
the best solution in a given region using greedy search techniques.

• Local search is an algorithm that is used to find the best solution to a problem by starting with
a random solution and then making small changes to it until it finds a better solution.

• The objective function is at the heart of any local search algorithm; it defines what constitutes
an acceptable solution and serves as a measure of how well any given candidate solution fits
that definition.

• Hill climbing or k opt are examples of local optimisation algorithms that use such functions to
identify promising candidates for further refinement until a satisfactory result is obtained.

• Search algorithms like quick search can be employed to traverse the search space efficiently,
while customer reviews and BBB business profiles provide valuable additional data points for
informed decision-making.
Local Search Algorithm…..

• The ability for customers to search locally has been made even easier by advances in
technology such as voice-activated searches on devices like smartphones and tablets.

• This enables customers to quickly find what they are looking for without having to
enter extensive search terms into a web browser.

• With these advancements, Local Search has become increasingly important for
businesses who want to stay competitive in their industry.

• Local Search also provides valuable insights about customer behavior that can inform
marketing strategies and help brands better understand their target audience.

• For companies seeking success, understanding how best to leverage Local Search is
essential; it offers significant opportunities but must be approached strategically.

5
SESSION INTRODUCTION…..

Which Is An Example Of A Local Search?


It requires an understanding of how search engine optimisation (SEO) works, as well as the use of
mobile devices and physical locations.
An example of a local search in Australia.
Google Search uses data from its index stores to return results when someone makes a query
using a specific expression. Businesses located near where the person making the query is can
show up at the top of the search results thanks to this technology.
The technology behind this process is based on K median and facility location problems.
Facility location problems involve finding good positions for facilities so they are able to serve
most people in the area efficiently with minimal cost.
In order to find optimal solutions for these types of problems, Google’s algorithms need detailed
information about Australian businesses, such as business type, geographical coordinates,
customer reviews, opening hours and more.
With accurate data available, Google can then rank businesses according to relevance and
proximity to users' current location.

6
Local Search Algorithm

Local Search Algorithms


Several local search algorithms are commonly used in AI and optimization problems.
Let's explore a few of them:
Let's delve into some of the commonly used local search algorithms:
1. Hill Climbing
2. Local Beam Search
3. Simulated Annealing

7
HILL CLIMBING

• Artificial intelligence (AI) uses the straightforward optimization


method known as "hill climbing" to identify the optimum answer
to a given issue.

• We learn the following two strategies as part of Informed Search Strategies.

• Simple Hill climbing:


• Steepest Ascent Hill climbing
• Stochastic hill climbing

8
TYPES OF HILL CLIMBING

• 1. Simple Hill climbing:


• It looks at each neighboring node individually and chooses the first one that minimizes
the current cost as the next node.
• Steepest Ascent Hill climbing:
• It initially looks at all the nearby nodes before choosing the one that is most near the
solution state as the next node.
• Stochastic hill climbing:
• It chooses a node without first considering all of its neighbors. It just chooses a
neighboring node at random and determines whether to go there or to look at another
based on how much that neighbor has improved.

9
STATE SPACE DIAGRAM FOR HILL CLIMBING:

• The state-space diagram plots our search algorithm's collection of possible


states against the value of our objective function, or the function we want to
maximize.
• X-axis: denotes the state space i.e. states or configuration our algorithm may
reach.
• Y-axis: denotes the values of objective function corresponding to a particular
state.

10
DIFFERENT REGIONS IN THE STATE SPACE
DIAGRAM:
• Local maximum: A state exists that is better than it (the global maximum),
but it is not better than its neighbour. This state is preferable because the goal
function's value is higher here than it is in its surrounding states.
• Global maximum: In the state space diagram, it is the ideal state that is
conceivable. This is due to the goal function having the maximum value at this
point.
• Plateau/flat local maximum: It is a flat area in state space where states
close by have equal values.

11
• Ridge: It is a location that is higher than its surroundings yet has a slope of its own. This
particular local maximum is unique.

• Current state: The region of the state space diagram where we are currently present
during the search.

• Shoulder: It is a plateau with an upward-facing edge.

• 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.

12
PROBLEMS IN HILL
CLIMBING:
• 1. Local Maximum: A local maximum is a state that dominates its
surrounding states but is surpassed by another state that is also present and is
higher than the local maximum.
• Solution: In the state space landscape, the local maximum can be resolved
using the backtracking approach. Make a list of the promising paths so that the
algorithm may go back and investigate other routes.

13
• Plateau: A plateau is a flat region of the search space where all neighbour
states of the current state have the same value. As a result, the algorithm is
unable to determine the optimum course of action. In the plateau region, a hill-
climbing search may become disoriented.
• Solution: Making either large or little movements while looking for a solution
can help you get over the plateau. Choose a state at random that is remote
from the one you are in now, giving the algorithm a chance to discover a non-
plateau region.

14
Ridges: The local maximum might take distinctive forms, such as ridges. It has a
portion that is higher than the places around it, but because of its own slope, it
cannot be reached in a single motion.
Solution: We can make this situation better by using bidirectional search or by
going in separate ways.

15
BLOCK WORLD PROBLEM

• The most important step in solving any hill-climbing issue is to pick the right
heuristic function.
• Definition of such a function, h
• If the block is appropriately positioned, h(x) = +1 for all the blocks in the
support structure; otherwise, h(x) = -1 for all the blocks in the support
structure.

16
• Any block that has the same support structure as the objective state is referred
to in this context as being appropriately positioned. Let's have a look at all the
iterations and their heuristics to achieve the goal state using the hill climbing
approach we outlined earlier:

17
STEEPEST-ASCENT HILL CLIMBING

This is a variation of simple hill climbing which considers all the moves from the current
state and selects the best one as the next state. Also known as Gradient search
Algorithm: Steepest-Ascent Hill Climbing
1. Evaluate the initial state. If it is also a goal state, then return it and quit. Otherwise,
continue with the initial state as the current state.
2. Loop until a solution is found or until a complete iteration produces no change to
current state:
a. Let SUCC be a state such that any possible successor of the current state will be
better than SUCC
b. For each operator that applies to the current state do:
i. Apply the operator and generate a new state
ii. Evaluate the new state. If is is a goal state, then return it and quit. If not,
compare it to SUCC. If it is better, then set SUCC to this state. If it is not
better, leave SUCC alone.
c. If the SUCC is better than the current state, then set current state to SUCC.
HILL-CLIMBING (CONTINUED…) - LIMITATIONS

Both simple Hill climbing and Steepest-Ascent Hill climbing may have
following limitations:
1. Local Maxima: a local maximum as opposed to global
maximum.
Way Out: Backtrack to some earlier node and try going in a
different direction
2. Plateaus: An area of the search space where evaluation function
is flat, thus requiring random walk.
Way out: Make a big jump to try to get in a new section
3. Ridge: Where there are steep slopes and the search direction is
not towards the top but towards the side.
19the test.
Way out: Apply two or more rules before doing
Simulated Annealing

• Simulated Annealing
• Simulated Annealing is a heuristic search algorithm applied to optimization
and artificial intelligence issues. By allowing the algorithm to occasionally
accept moves that do not improve, this variation of the hill climbing algorithm
can avoid the issue of getting stuck in local optima.

20
STEPS OF THE SIMULATED ANNEALING
ALGORITHM
• Start with an initial solution.
• Set the initial temperature to a high value.
• Repeat the following steps until the stopping criterion is met:
• Generate a new solution by making a small modification to the current solution.
• Evaluate the objective function of the new solution.
• If the new solution improves the objective function, accept it as the new current solution.
• If the new solution does not improve the objective function, accept it with a probability
that depends on the difference between the objective function values of the current and
new solutions and the current temperature.
• Decrease the temperature according to a cooling schedule.

21
• Return the current solution as the final solution.
• The main principle of the simulated annealing algorithm is to control the level of
randomness in the search process by altering the temperature parameter. High
temperatures enable the algorithm to explore new regions of the search space by
increasing its propensity to accept non-improving moves. The algorithm becomes
more selective and concentrates on improving the solution as the temperature drops.
• Simulated annealing has been successfully applied to a wide range of optimization
problems, such as the traveling salesman problem, the vehicle routing problem, and
the job shop scheduling problem. However, it requires careful tuning of the
temperature and cooling schedule parameters to achieve good performance.

22
TRAVELLING SALESMAN PROBLEM

• The Traveling Salesman Problem (TSP) is a well-known example of a


combinatorial optimization problem in which the goal is to determine
the quickest path between the starting city and a given set of cities. No
known algorithm can complete it in polynomial time because it is an
NP-hard problem.
• Local search algorithms for the TSP work by starting with an initial
solution and incrementally improving it by making small changes to it
one at a time until no more advancements are possible.

23
TRAVELLING SALESMAN PROBLEM

24
SUMMARY

 Local search algorithms iteratively improve a single solution by making small


modifications to it.
• .Local search algorithms are often simple and efficient and can handle large
solution spaces.
• However, they are prone to get stuck in local optima, where the solution is not
the global optimum.
• To overcome this limitation, various modifications to local search algorithms
have been proposed, such as tabu search, simulated annealing, and genetic
algorithms.

25
SELF ASSESSMENT
1. QUESTIONS
Local search algorithms can solve?

(a) Any problems


(b) optimization problems
(c) Algorithm

2. Hill climbing is sometimes called.?

(a) Local maxima


(b) greedy local search
(c) optimal solution
TERMINAL QUESTIONS

1. Define Hill Climbing Algorithm with suitable example.


2. Write the problems in Hill Climbing Algorithm
3. Define Ridges and plateau
4. List the different Regions of Hill Climbing Algorithm.
5. Write an algorithm of hill climbing heuristic search technique

27
• Reference Books:

• 1. Russel and Norvig, ‘Artificial Intelligence’, third edition, Pearson Education, PHI, (2015)

• 2. Elaine Rich & Kevin Knight, ‘Artificial Intelligence’, 3nd Edition, Tata Mc Graw Hill Edition,
Reprint( 2008)

• Sites and Web links:

1. https://www.virtusa.com/digital-themes/heuristic-search-techniques

2. https://towardsdatascience.com/a-star-a-search-algorithm-eb495fb156bb

3. https://www.tutorialandexample.com/local-search-algorithms-and-optimization-problem/

4. http://cgi.di.uoa.gr/~ys02/siteAI2008/local-search-2spp.pdf

5. http://aima.eecs.berkeley.edu/slides-pdf/chapter04b.pdf

28

You might also like