Professional Documents
Culture Documents
Introduction To Artificial Intelligence: Amna Iftikhar Spring ' 2021 1
Introduction To Artificial Intelligence: Amna Iftikhar Spring ' 2021 1
Intelligence
Lecture 05
Amna Iftikhar Spring ' 2021 1
Today’s Agenda
• Hill climbing
• Simulated annealing
• Local beam search
• Genetic algorithms
• It is an optimization search
Amna Iftikhar Spring ' 2021 3
Classical Search vs. Local Search
Classical search Local Search
• systematic exploration of • In many optimization problems,
search space. the path to the goal is irrelevant;
the goal state itself is the solution.
• Keeps one or more paths
• State space = set of "complete"
in memory.
configurations.
• Records which • Find configuration satisfying
alternatives have been constraints, Find best state
explored at each point according to some objective
along the path. function h(s). e.g., n-queens, h(s)=
number of attacking queens. In
• The path to the goal is a
such cases, we can use Local
solution to the problem.
Search Algorithms.
Plateaux
Plateaux
Amna Iftikhar
Current state Spring ' 2021 15
Hill-Climbing Search
Local maxima: a local maximum is a peak that is
higher than each of its neighboring states, but
lower than the global maximum. Hill-climbing
algorithms that reach the vicinity of a local
maximum will be drawn upwards towards the
peak, but will then be stuck with nowhere else to
go.
6 H 5 I J 7 K 6
2 L 0 M N 4 O 4
9 A B 11
7.5 C 8.5 D 8 E F 9 G 9
6 H 5 I J 7 K 6
2 L 0 M N 4 O 4
9 A B 11
7.5 C 8.5 D 8 E F 9 G 9
6 H 5 I J 7 K 6
2 L 0 M N 4 O 4
9 A B 11
7.5 C 8.5 D 8 E F 9 G 9
6 H 5 I J 7 K 6
2 L 0 M N 4 O 4
9 A B 11
7.5 C 8.5 D 8 E F 9 G 9
6 H 5 I J 7 K 6
2 L 0 M N 4 O 4
10 B 7 F
8 J
4 D C E 3 G
2 5
0 K
I 6
0 H
K 0
10 B 7 F
8 J
4 D C E 3 G
2 5
0 K
I 6
0 H
K 0
10 B 7 F
8 J
4 D C E 3 G
2 5
0 K
G is local minimum I 6
0 H
K 0
Hill climbing is sometimes called greedy local search because it grabs a good neighbor
state without thinking ahead about where
Amna Iftikhar Springto go next.
' 2021 24
Hill-Climbing Search Example
Local Maximum, Local Minimum
If any one is a goal state, stop; else select the k best successors from the
complete list and repeat.
Drawback: the k states tend to regroup very quickly in the same region lack of
diversity.
Is this the same as running k greedy searches in parallel?
Cost
States
Amna Iftikhar
X Spring ' 2021
Y 41
GA Parent Selection - Roulette Wheel
• Sum the fitnesses of all the
population members, TF
• Generate a random number, m,
between 0 and TF
• Return the first population
member whose fitness added
Roulette Wheel Selection to the preceding population
members is greater than or
equal to m
1 2 3 4 5 6 7 8
1 2 3 1 3 5 1 2
0 Rnd[0..18] = 7 Rnd[0..18] = 12 18
Chromosome4 Chromosome6
Genetic Algorithms: Cross-Over
and Mutation
How do individuals reproduce ?
Genetic Algorithms
Crossover - Recombination
Crossover
single point - With some high probability (crossover rate)
random apply crossover to the parents. (typical
values are 0.8 to 0.95)
Stochastic Search: Genetic Algorithms
Mutation
mutate
Maxone problem
Genetic Algorithms
Algorithm:
1. Initialize population with p Individuals at
random
2. For each Individual h compute its fitness
3. While max fitness < threshold do
Create a new generation Ps
4. Return the Individual with highest fitness
Evolvable Circuits
Robotics
Car Design
Evolutionary Arts