Local Search Algorithms
Local Search Algorithms
Algorithms
Chapter 4
Summary: Informed search
• Best-first search is general search where the minimum-cost nodes (according
to some measure) are expanded first.
• A* search combines uniform-cost search and greedy search: f(n) = g(n) + h(n).
A* handles state repetitions and h(n) never overestimates.
– A* is complete and optimal, but space complexity is high.
– The time complexity depends on the quality of the heuristic function.
– IDA* and SMA* reduce the memory requirements of A*.
• Hill-climbing algorithms keep only a single state in memory, but can get
stuck on local optima.
• Simulated annealing escapes local optima, and is complete and optimal
given a “long enough” cooling schedule.
• Genetic algorithms can search a large space by modeling biological evolution.
• .
Iterative improvement search
Height Defined by
Evaluation Function
Hill climbing on a surface of states
Hill-climbing search
• If there exists a successor s for the current state n such that
– h(s) < h(n)
– h(s) ≤ h(t) for all the successors t of n,
• then move from n to s. Otherwise, halt at n.
• Looks one step ahead to determine if any successor is
better than the current state; if there is, move to the best
successor.
• Similar to Greedy search in that it uses h, but does not
allow backtracking or jumping to an alternative path since it
doesn’t “remember” where it has been.
• Not complete since the search will terminate at
"local minima," "plateaus," and "ridges."
Exploring the Landscape
• Local Maxima: peaks that
aren’t the highest point in the area.
space
• Plateaus: the space has a
broad flat region that
gives the search algorithm
no direction (random
walk)
• Ridges: flat like a plateau, but
the main difference between a
ridge and a plateau is the
scale of the flat region: a
ridge is a narrow flat path,
while a plateau is a broad flat
local maximum
plateau
ridge
Solution
By definition, the Manhattan distance heuristic is the
sum of the Manhattan distances of tiles from their
goal positions. In Figure, only the tiles 5, 6 and 8 are
misplaced and their distances from the goal positions
are respectively 2, 2 and 1. Therefore h(Initialstate) =
2 + 2 + 1 = 5:
Examples
Example 2
Begin
Initialize gen=0
Population initialization P (gen)
While termination criteria is not accomplish
Begin
Assess fitness of each candidate solution of the current generation
Select parents to generate offspring
Produce offspring by using genetic operators
Replace some members from new offspring
gen = gen+1
End while
End while