A Hybrid Heuristic for the Traveling Salesman Problem R. Baraglia, J. I. Hildalgo, R. Perego CMPSC 580, Spring 2006
I didn’t even think “difficultly” was a word.
Genetic Algorithms (from Eiben and Schoenauer)
Simple Example Find the 8-bit vector which maximizes the number of 1’s in the vector – the “MAXONES” problem. Answer is obvious: Can a genetic algorithm find it?
Example (continued) Initialize population (random):
Example (continued) Evaluate fitness: f( ) = 4f( ) = 5 f( ) = 3f( ) = 4 f( ) = 3f( ) = 3
Example (continued) Select genitors (parents): Random, but biased toward fitter individuals: f( ) = 4f( ) = 5 f( ) = 3 f( ) = 4 f( ) = 3f( ) = 3
Example (continued) Variation operators: crossover and mutation
Example (concluded) Evaluate and replace (next generation): (4) (5) (3) (5) (5) (3) Survivors Offspring …Now repeat: select, mate, replace…
Traveling Salesperson Here’s a nice applet from a U. Texas/Arlington course Web site: 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: 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):
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: ; fitness = ; fitness = 1.98
Compact GA (continued) Old model: (.5,.5,.5,.5,.5) ; fitness = 3.21 (winner) ; 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 TSP Save a description of population in the form of a probability matrix. Example: Population: 1,4,5,2,3 1,2,5,3,4 1,5,3,4,2 1,3,5,2, 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 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 Probability of edge (i,j):
CGA for TSP (continued) 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,…
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)
Slides not completed yet