Download presentation
Presentation is loading. Please wait.
1
A Hybrid Heuristic for the Traveling Salesman Problem R. Baraglia, J. I. Hildalgo, R. Perego CMPSC 580, Spring 2006
2
I didn’t even think “difficultly” was a word.
3
Genetic Algorithms (from Eiben and Schoenauer)
4
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?
5
Example (continued) Initialize population (random): 1001010111001011 0100101001011001 0101010010001110
6
Example (continued) Evaluate fitness: f(10010101) = 4f(11001011) = 5 f(01001010) = 3f(01011001) = 4 f(01010100) = 3f(10001110) = 3
7
Example (continued) Select genitors (parents): Random, but biased toward fitter individuals: f(10010101) = 4f(11001011) = 5 f(01001010) = 3 f(01011001) = 4 f(01010100) = 3f(10001110) = 3
8
Example (continued) 1001010111001011 1001010110010011 Variation operators: crossover and mutation 10110101 10010001
9
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…
10
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
11
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 5 0 1 0 0 1 1 1 0 0 0 1 0 0 0 1 0 1 0 0 0 1 1 1 0 1 Model: (.6,.8,.1, 0,.6) For each bit position, maintain the probability that some element of the population has a “1” in that position. Example (with 5-bit chromosomes):
12
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
13
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
14
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”]
15
Compact GA for TSP Save 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.50.250.75.5 0.25.75.250 1 2 3 4 5 12345 Probability of edge (i,j):
16
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.50.250.75.5 0.25.75.250 1 2 3 4 5 12345 Probability of edge (i,j):
17
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.50.250.75.5 0.25.75.250 1 2 3 4 5 12345 Probability of edge (i,j):
18
CGA for TSP (continued) 0.50.250.75.5 0.25.75.250 1 2 3 4 5 12345 Probability of edge (i,j): Constructing a new tour: Process might get “stuck” (repeated “NO” results). In this case, pick the city with highest probability of being connected to most recently added city: (4,1,3,5,…
19
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.
20
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)
21
Slides not completed yet
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.