Chapter 10 The Traveling Salesman Problem 1

Download Report

Transcript Chapter 10 The Traveling Salesman Problem 1

Chapter 10
The Traveling Salesman Problem
1
The Traveling Salesman Problem
(TSP)




Minimum total cost
A set of permutations of n cities
NP-hard problem
Similar techniques: scheduling, partitioning …
2
Representation & Operators

BINARY representation with classical operators



VECTOR representations with special genetic operators
V : i1 , i2 , , in 




Illegal tours
100 cities only
(i j  integer)
Adjacency representation
Ordinal representation
Path representation
Binary MATRIX representations


Precedence binary matrix
Direct binary matrix
3
VECTOR representation

Adjacency representation with a repair algorithm



Reference (position list): (1, 2, 3, 4, 5, 6, 7, 8, 9)
V = (2, 4, 8, 3, 9, 7, 1, 5, 6)
tour: (1 – 2 – 4 – 3 – 8 – 5 – 9 – 6 – 7)
Crossover:
p1  (2 3 8 7 9 1 4 5 6)
p2  (7 5 1 6 9 2 8 4 3)



alternating-edges crossover: a random edge
subtour-chunks crossover: a random subtour
heuristic crossover: a random city  a shorter edge  (repeat)
4

Ordinal representation



Reference (ordered list): (1, 2, 3, 4, 5, 6, 7, 8, 9)
V = (1, 1, 2, 1, 4, 1, 3, 1, 1)
tour: (1 – 2 – 4 – 3 – 8 – 5 – 9 – 6 – 7)
Crossover:
p1  (11 2 1 4 1 3 11)
p2  (5 1 5 5 5 3 3 2 1)

1- 2 - 4 - 3- 8 - 5 - 9 - 6 - 7
5 -1- 7 - 8 - 9 - 4 - 6 - 3 - 2
classical crossover
o1  (11 2 1 5 3 3 2 1)
o2  (5 1 5 5 4 1 3 11)
1- 2 - 4 - 3- 9 - 7 - 8 - 6 - 5
5 -1- 7 - 8 - 6 - 2 - 9 - 3 - 4
5

Path representation



Reference:
V = (5, 1, 7 ,8, 9, 4, 6, 2, 3)
tour: (5 – 1 – 7 – 8 – 9 – 4 – 6 – 2 – 3)
Crossover:

Partially-Mapped crossover (PMX)
p1  (1 2 3 4 5 6 7 8 9)
p2  (4 5 2 1 8 7 6 9 3)
o1  ( x 2 3 1 8 7 6 x 9)
o2  ( x x 2 4 5 6 7 9 3)
o1  (4 2 3 1 8 7 6 5 9)
o2  (1 8 2 4 5 6 7 9 3)
6

Example 2.
p1  (812 4 5 6 7 3 9)
p2  (123 9 8 7 4 56)
o1  ( x12 | 9874 | 3x )
o2  (123 | 4567 | xx )
o1  (512 | 9874 | 36)
o2  (123 | 4567 | 89)
7

Order crossover (OX)
p1  (1 2 3 4 5 6 7 8 9)
p2  (4 5 2 1 8 7 6 9 3)
o1  ( x x x 4 5 6 7 x x )
o2  ( x x x 1 8 7 6 x x )
o1  ( 2 1 8 4 5 6 7 9 3)
o2  ( 3 4 5 1 8 7 6 9 2)
8

Cycle crossover (CX)
p1  (1 2 3 4 5 6 7 8 9)
p2  (4 1 2 8 7 6 9 3 5)

Order-based crossover
p1  (1 2 3 4 5 6 7 8 9)
p2  (4 1 2 8 7 6 9 3 5)

o1  (1 2 3 4 7 6 9 8 5)
o2  (4 1 2 8 5 6 7 3 9)
o1  (1 2 3 4 8 6 7 5 9)
o2  (3 1 2 8 7 4 6 9 5)
Heuristic crossover (p.220)
pool  { p1 , p2 ,}
b  min{ left pi (a), right pi (a)}
9

Heuristic crossover (Grefenstette)
1.
2.
3.
4.
5.
6.
7.
Randomly select a city to be the current city c of the
offspring,
Select 4 edges (two from each parent) incident to the current
city c,
Define a probability distribution over selected edges based on
their cost.
The probability for the edge associated with a previously
visited city is 0.
Select an edge. If at least one edge has non-zero probability,
selection is based on the above distribution; otherwise,
selection is random (from unvisited cities)
The city on ‘the other end’ of the selected edge becomes the
current city c
If the tour is complete, stop; otherwise, go to step 2.
10

Edge Recombination crossover (ER)
p1  (1 2 3 4 5 6 7 8 9)
p2  (4 1 2 8 7 6 9 3 5)
city 1 : edges to other cities : 9 2 4
city 2 : edges to other cities : 1 3 8
city 3 : edges to other cities : 2 4 9 5
city 4 : edges to other cities : 3 5 1
city 5 : edges to other cities : 4 6 3
city 6 : edges to other cities : 5 7 9
city 7 : edges to other cities : 6 8
city 8 : edges to other cities : 7 9 2
city 9 : edges to other cities : 8 1 6 3
city 1 : edges to other cities : 9 - 2 4
city 2 : edges to other cities : - 1 3 8
city 3 : edges to other cities : 2 4 9 5
city 4 : edges to other cities : 3 - 5 1
city 5 : edges to other cities : - 4 6 3
city 6 : edges to other cities : 5 - 7 9
city 7 : edges to other cities : - 6 - 8
city 8 : edges to other cities : - 7 9 2
city 9 : edges to other cities : 8 1 6 3
11
Mutation:




Inversion
Insertion
Displacement
Reciprocal exchange
12
Binary MATRIX representations

Fox and McMahon
tour: (3 – 1 –2 – 8 – 7 – 4 –6 – 9 – 5)
Properties:
n(n-1 )
1. the number of 1s is exactly
2
2. mii  0 for all 1  i  n , and
3. if mij  1 and m jk  1 then mik  1
13
Intersection operator
14
Union operator
15

David Seniw
16
17
Mutation operator
1 3 5 8 9
4
6
7
9
4
6
7
9
1 3 5 8 9
18
Crossover operator
V1:
Intersection:
V2:
Alternately add 1:
0 1
19
Fill:
20

Homaifar and Guan
Two-point crossover:
21
Repair Algorithm:
• remove duplications
0
1
1
0
1
0
1
0
22
• cut & connect
0
1
1
0
0
1
1
Tour: (1 2 8 4 3 6 5 7 9)
0
Tour: (1 6 5 7 2 8 9) (3 4)
(2 4)
Tour: (1 6 5 7 2 4 3 8 9)
23