07 Local Search Algorithms
07 Local Search Algorithms
Artificial Intelligence
Chapter 2: Solving Problems
by Searching (5)
Local Search Algorithms &
Optimization Problems
Nguyễn Hải Minh, Ph.D
[email protected]
Outline
1. Optimization Problems
2. Hill-climbing search
3. Local beam search
4. Genetic algorithm
5. Issues with local search
❑Advantages:
o Use very little memory
o Can often find reasonable solutions in large or infinite
(continuous) state spaces.
*Do not use the ones that have been discussed on the slide
**Go to Moodles from 20:00 to 22:00 today (Jun 5th) to submit
your answer (bonus credit)
❑An 8-queens state with heuristic cost estimate h=17, showing the
value of h for each possible successor obtained by moving a queen
within its column.
Hill-climbing example
❑(c1 c2 c3 c4 c5 c6 c7 c8) = (8 3 7 4 2 5 1 6)
❑A local minimum in the 8-queens state space; the state has h=1 but
every successor has a higher cost.
Hill-climbing drawbacks
❑Ridge = sequence of local maxima difficult for greedy
algorithms to navigate
❑Plateau = an area of the state space where the evaluation
function is flat.
Performance of hill-climbing on 8-queens
❑Randomly generated 8-queens starting states
o 14% the time it solves the problem
o 86% of the time it get stuck at a local minimum
❑However…
o Takes only 4 steps on average when it succeeds
o And 3 on average when it gets stuck
o (for a state space with ~17 million states)
No
Start Cross-over
Selection
New population
Mutation
Next generation building
7/12/2020 Nguyễn Hải Minh @ FIT 23
Genetic algorithms
❑Genetic representation:
o Use integers
o Use bit string
❑Fitness function: number of non-attacking pairs
of queens (min = 0, max = 8×7/2 = 28)
o 24/(24+23+20+11) = 31%
o 23/(24+23+20+11) = 29% etc