A Hybrid Heuristic for the Traveling Salesman Problem R. Baraglia, J. I. Hildalgo, R. Perego CMPSC...
-
date post
21-Dec-2015 -
Category
Documents
-
view
215 -
download
0
Transcript of A Hybrid Heuristic for the Traveling Salesman Problem R. Baraglia, J. I. Hildalgo, R. Perego CMPSC...
A Hybrid Heuristic for the Traveling Salesman Problem
R. Baraglia, J. I. Hildalgo, R. Perego
CMPSC 580, Spring 2006
Simple Example
Find the 8-bit vector which maximizes the number of 1’s in the vector – the “MAXONES” problem.
Answer is obvious: 11111111
Can a genetic algorithm find it?
Example (continued)
Initialize population (random):
10010101 11001011
01001010 01011001
01010100 10001110
Example (continued)
Evaluate fitness:
f(10010101) = 4 f(11001011) = 5
f(01001010) = 3 f(01011001) = 4
f(01010100) = 3 f(10001110) = 3
Example (continued)
Select genitors (parents):
Random, but biased toward fitter individuals:
f(10010101) = 4 f(11001011) = 5
f(01001010) = 3 f(01011001) = 4
f(01010100) = 3 f(10001110) = 3
Example (continued)
10010101 11001011
10010101 10010011
Variation operators: crossover and mutation
10110101 10010001
Example (concluded)
Evaluate and replace (next generation):
10010101(4) 11001011(5)
01001010(3) 10110101(5)
11010101(5) 10010010(3)
Survivors
Offspring
…Now repeat: select, mate, replace…
Traveling Salesperson
Here’s a nice applet from a U. Texas/Arlington course Web site:
http://www-cse.uta.edu/~cook/ai1/lectures/applets/gatsp/TSP.html
Compact GA (CGA)
Instead of maintaining a population of individuals, just keep a description, or model, of the population. Example:
A Possible Population:1 2 3 4 50 1 0 0 11 1 0 0 01 0 0 0 10 1 0 0 01 1 1 0 1
Model:(.6, .8, .1, 0, .6)
For each bit position, maintain theprobability that some element ofthe population has a “1” in that position.Example (with 5-bit chromosomes):
Compact GA (continued)
Start with uniform random model:
(.5, .5, .5, .5, .5)
Randomly generate two (or more) individuals according to this probability distribution; find fitness:
1 1 0 1 0; fitness = 3.21
0 1 1 0 0; fitness = 1.98
Compact GA (continued)
Old model: (.5, .5, .5, .5, .5)
1 1 0 1 0; fitness = 3.21 (winner)
0 1 1 0 0; fitness = 1.98 (loser)
Reward 1’s in winner; penalize 1’s in loser:
New model: (.6, .5, .4, .6, .5)
Repeat the process using the new probabilities
Compact GA (continued)
Ideally, process will converge– this is the “solution” found by the CGA:
(.5, .5, .5, .5, .5)
(.6, .5, .4, .6, .5)
(.7, .4, .3, .6, .5)
…
(1, 0, 0, 1, 1) [“solution”]
Compact GA for TSPSave a description of population in the form
of a probability matrix. Example:
1
2
34
5
Population: 1,4,5,2,3 1,2,5,3,4 1,5,3,4,2 1,3,5,2,4
0
.5 0
.5 .25 0
.75 .5 .5 0
.25 .75 .75 .25 0
1
2
3
4
5
1 2 3 4 5
Probability of edge (i,j):
CGA for TSP (continued)
Constructing a new tour:
Pick random start city:
(4, _
Pick another city:
1
Decide whether to include
1 with a 75% probability:
YES
0
.5 0
.5 .25 0
.75 .5 .5 0
.25 .75 .75 .25 0
1
2
3
4
5
1 2 3 4 5
Probability of edge (i,j):
CGA for TSP (continued)
(4, 1, _
Pick another city:
5
Decide whether to include
1 with a 25% probability:
NO
So try another city, … etc.
0
.5 0
.5 .25 0
.75 .5 .5 0
.25 .75 .75 .25 0
1
2
3
4
5
1 2 3 4 5
Probability of edge (i,j):
CGA for TSP (continued)
0
.5 0
.5 .25 0
.75 .5 .5 0
.25 .75 .75 .25 0
1
2
3
4
5
1 2 3 4 5
Probability of edge (i,j):
Constructing a new tour:
Process might get “stuck”(repeated “NO” results). In thiscase, pick the city with highestprobability of being connectedto most recently added city:
(4,1,3,5,…
Hybrid Approach
Combine Genetic Algorithm (problem-independent method) with heuristic specifically designed for TSP.
Make one “genetic step”, then improve the solution using the heuristic.
A Simple Heuristic for Improving TSP Solutions
2-opt: look at all possible pairs of edges in the tour, see if tour length can be improved by reordering cities as follows. Repeat until no more improvement is possible:
(Can have 3-opt, 4-opt, etc.; more expensive)