Download presentation
Presentation is loading. Please wait.
1
School of Computer Science & Engineering
Artificial Intelligence Escaping Local Optima: Genetic Algorithm Dae-Won Kim School of Computer Science & Engineering Chung-Ang University
2
We’re trying to escape local optima
3
To achieve this, we have learned simulated annealing & tabu search
4
They always have a single current best solution stored that they try to improve in the next step.
5
Hill-climbing uses deterministic rules
6
If an examined neighbor is better, proceed to that neighbor and continue to search from there.
7
SA uses probabilistic rules.
8
If an examined neighbor is better, accept this as the new current position.
9
Otherwise, either probabilistically accept this new weaker solution anyway or continue to search in the current neighborhood.
10
What would happen if we instead maintained several solutions simultaneously?
11
What would happen if our search algorithm worked with a population (or set) of solutions?
13
At first glance, this idea doesn’t provide us with anything new.
14
We just process several solutions in parallel with other methods!
15
Q: What makes it essentially different from other methods?
16
1. Evolutionary process of competition and selection and let the candidate solutions fight for the room in future generations
17
2. Random variation to search for new solutions similar to natural evolution
18
We start with a population of initial solution, called chromosomes.
19
We use an evaluation function to determine the merit of each solutions.
* Fitness function == Obj. fn
20
The better solutions become parents for the next generation of offspring.
21
How should we generate these offspring?
22
We don’t have to rely on the neighborhoods of each individual solution.
23
We can examine the neighborhoods of pairs of solutions.
24
We can use more than one parent solution to generate a new candidate solution.
25
One way is by taking parts of two parents and putting them together with to form an offspring.
26
We might take the first half of one parent together with the second half of another.
28
With each generation, the individuals compete (among themselves or parents) for inclusion in the next iteration.
29
After a series of generations, we observe a succession of improvements and a convergence.
30
Why should we labor to solve a problem by calculating difficult mathematical expressions or developing computer programs to optimize the results?
31
Genetic Algorithm Genetic Programming Evolutionary Algorithm Evolutionary Programming …
32
It’s often called as Swiss Army Knife
33
begin t := 0 initialize P(t) evaluate P(t) while (not termination-condition) do t := t + 1 select P(t) from P(t-1) alter P(t) end
35
Q: How to design GA for TSP?
36
The idea is quite simple:
a population of TSP candidate solutions is evolved over iterations of variation and selection.
37
(Random) variation provides the mechanism for discovering new solutions.
38
Selection determines which solutions to maintain as a basis for further exploration.
39
Issues for solving TSP:
Representation Variation operators Evaluation function Selection
40
Issue 1: Representation
41
A representation is a mapping from the state space of possible solutions to a state space of encoded solutions within a particular data structure.
42
One possible way is to make an ordered list of the cities to visit.
43
A ten city tour may be represented:
< >
44
<permutation> representation provides a feasible tour, but isn’t the only possible representation.
45
In the <adjacency> representation, city j is listed in the position i if and only if the tour leads from city i to city j.
46
The vector < > represents the tour 1 – 2 – 4 – 3 – 8 – 5 – 9 – 6 – 7
47
What’s the advantage of this <adjacency> representation?
48
It allows us to look for templates that are associated with good solutions.
49
In the <ordinal> representation, the i-th element of the list is a number in the range from 1 to n-i+1.
50
The ordered list serves as a reference point for lists in ordinal representation.
51
Given an ordered list (1 2 3 4 5 6 7 8 9),
A tour 1 – 2 – 4 – 3 – 8 – 5 – 9 – 6 – 7 is represented as a list of references: < >
52
What’s the advantage of this <ordinal> representation?
53
A good representation leads to good search (variation) operators.
54
Issue 2: Variation operators
55
The choice of how to represent a tour is related to the choice of what variation operators to use.
56
Let us assume that we use <Path Permutation> representation.
57
A tour 5 – 1 – 7 – 8 – 9 – 4 – 6 – 2 – 3 is represented as < >
58
Q: how to make offspring from two parents (sequences)?
59
For example, P1 = < > P2 = < >
60
We introduce two variation operators, called crossovers.
61
1. Partially mapped crossover: PMX
62
PMX builds a offspring by choosing a subsequence of a tour from one parent and preserving the order and position of as many cities as possible from the other parent.
63
A subsequence of tour is selected by choosing two random cut points, which serve as boundaries for the swapping operations.
64
For example, P1 = < > P2 = < >
65
P1 = <1 2 3 | | 8 9> P2 = <4 5 2 | | 9 3>
66
The segments between cut points are swapped.
67
P1 = <1 2 3 | | 8 9> P2 = <4 5 2 | | 9 3> O1 = <x x x | | x x> O2 = <x x x | | x x>
68
O1 = <x x x | | x x> O2 = <x x x | | x x> We can see a series of mappings: 1 – 4, 8 – 5, 7 – 6, 6 – 7
69
The, we can fill in additional cities from the original parents for which there’s no conflict.
70
P1 = <1 2 3 | | 8 9> P2 = <4 5 2 | | 9 3> O1 = <x 2 3 | | x 9> O2 = <x x 2 | | 9 3>
71
O1 = <x 2 3 | | x 9> O2 = <x x 2 | | 9 3> How to fill the value of x?
72
P1 = <1 2 3 | | 8 9> P2 = <4 5 2 | | 9 3> O1 = <4 2 3 | | x 9> O2 = <x x 2 | | 9 3> We use the mapping 1 – 4.
73
P1 = <1 2 3 | | 8 9> P2 = <4 5 2 | | 9 3> O1 = <4 2 3 | | 5 9> O2 = <1 8 2 | | 9 3>
74
2. Ordered crossover: OX
75
The OX builds offspring by choosing a subsequence of a tour from one parent and preserving the relative order of cities from the other parent.
76
Starting from the second cut point of one parent, the cities from the other parent are copied in the same order, omitting symbols that are already present.
77
Reaching the end of the string, we continue from the first place of the string.
78
P1 = <1 2 3 | | 8 9> P2 = <4 5 2 | | 9 3>
79
P1 = <1 2 3 | | 8 9> P2 = <4 5 2 | | 9 3> O1 = <x x x | | x x> O2 = <x x x | | x x>
80
P1 = <1 2 3 | | 8 9> P2 = <4 5 2 | | 9 3> The sequence of the cities in the second parent is 9 – 3 – 4 – 5 – 2 – 1 – 8 – 7 – 6
81
O1 = <x x x | | x x> O2 = <x x x | | x x> 9 – 3 – 4 – 5 – 2 – 1 – 8 – 7 – 6 After removing 4, 5, 6, 7, which are in the first offspring, we obtain 9 – 3 – 2 – 1 – 8
82
O1 = <x x x | | x x> O2 = <x x x | | x x> This sequence 9 – 3 – 2 – 1 – 8 is replaced in the first offspring. O1 = <2 1 8 | | 9 3> Similarly, O2 = < >
83
The OX operator exploits that the relative order of the cities is important, i.e., the two tours
9 – 3 – 4 – 5 – 2 – 1 – 8 – 7 – 6 4 – 5 – 2 – 1 – 8 – 7 – 6 – 9 – 3 are in fact identical.
84
Besides, many crossovers have been suggested; we should tell the pros and cons of the methods to achieve good results for TSP project.
85
Other types of variation operators are mutations, which use a probability that an arbitrary point in a solution sequence is changed from its parent.
86
The design of crossover and mutation allows GA to avoid local optima; you should devote much time in this issue.
87
Issue 3: Evaluation function
88
Evaluation = Fitness function
= Objective function
89
The TSP has an easy and natural evaluation function: we calculate the total length of the tour.
90
Issue 4: Selection
91
The selection acts on individuals in the current population.
92
Based on each individual’s quality, it determines the next population.
93
Selection typically comes in one of two forms:
94
1. Some individuals are eliminated from consideration: each contribute at most one time.
95
2. Individuals are sampled with replacement: each can be chosen multiple times.
96
Other researchers classify selection methods as either deterministic or stochastic.
97
1. Deterministic selection will always eliminate the same individuals, given the same population.
98
It is faster than stochastic selection.
99
Stochastic (probabilistic) selection generates a probability over the possible compositions of the next iteration.
100
e.g. 1) the number of individuals for the next generation is made proportional to current population
101
e.g. 2) random tournaments
102
It may or may not be beneficial depending on where the population converges.
103
Q: What’s the weak points?
104
1. GA is very slower than others
105
2. GA requires a few parameters
106
The population size, probability of various operators, mutations size, the number of crossover points, the ratio of parents and offspring, …
107
It’s time-consuming, and considerable effort is necessary to develop good heuristics for good choices across many problems.
108
Premature Convergence
vs. Convergence Speed
109
Estimation of Distribution Algorithms
Particle Swam Optimization Ant Colony Optimization Genetic Local Search
111
Hybrid / GLS / Memetic Algorithm
113
From Wikipedia, “Metaheuristic”
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.