Lecture 09 - Local Search
Lecture 09 - Local Search
In this lecture:
0
4
Local Search Algorithms
ِExamples:
– to reduce cost, as in cost functions
0
7
Search Landscape (two-dimension)
0
8
Birzeit University, 2018
In this lecture:
❑ Part 1: What/Why Local Search Algorithms
9
Hill-Climbing Search
• Continually moves in the direction of increasing value (i.e., uphill).
• Terminates when it reaches a “peak”, no neighbor has a higher value.
• Only records the state and its objective function value.
• Does not look ahead beyond the immediate.
Sometimes called
Greedy Local Search
0
11
Example: n-queens
0
12
Example: 8-queens
0
13
Example: n-queens
0
14
Birzeit University, 2020
In this lecture:
❑ Part 1: What/Why Local Search Algorithms
0
15
Simulated Annealing (SA) is an optimization algorithm
inspired by the annealing process in metallurgy,
where a material is heated and then slowly cooled to
remove defects and achieve a stable structure. It is
particularly useful for finding a good (not necessarily
perfect) solution in large search spaces, especially
when a problem has many local optima.
Algorithm Steps
1.Initialize a random solution.
2.Compute the cost (or energy) using an objective function.
3.Perturb (modify) the solution slightly to generate a
neighbor solution.
4.Compute the new cost:
1. If the new solution is better, accept it.
2. If the new solution is worse, accept it with some
probability to avoid being stuck in a local minimum.
5.Gradually decrease temperature (T):
1. The probability of accepting worse solutions decreases
over time.
6.Repeat until termination condition is met (e.g.,
temperature is very low or solution is stable).
Example : 8-Queens Problem
0
19
Simulated Annealing Search
Based on [1]