9/22/09 Genotypes and Phenotypes Part II ‐‐ The Return of the Salesman Traveling Salesman Problem • Instance: • N cities with distances between pairs of cities • Said another way: • Complete graph with n vertices such that all edges are labeled with a cost value 1
9/22/09 Traveling Salesman Problem • Solution: • Tour of the cities such that each city is visited once. • Said another way: • A permutation of the cities. • Ordered list of the cities • Is this a large search space? • n cities = n! permutation Traveling Salesman Problem • Output: • Distance traveled to complete the tour. • Recall: • Phenotype == ordered tour of the cities • TSP presents challenges for Genetic Mapping. 2
9/22/09 TSP ‐ Path Representation • Tour is represented as an ordered list (or array) of the cities. • Order in array == order of visitation. • If city i is the jth element of the array, city i is the jth city to be visited. • Eg. 3 2 4 1 7 5 8 6 Tour: 3‐2‐4‐1‐7‐5‐8‐6 TSP ‐ Path Representation • Most intuitive and common genotype. • But it has it’s problems: 3 2 4 1 7 5 8 6 3 2 4 1 7 5 8 6 8 7 6 5 4 3 2 1 3 2 4 1 4 3 2 1 3 2 4 1 3 5 8 6 Not valid tours!!! 3
9/22/09 TSP ‐ Path Representation • GeneRepair [Mitchell, et.al.] • Keep a corrective template with a valid tour. • Identify duplicate cities • Use template to replace duplicate cities. TSP ‐ Path Representation 1 2 3 4 5 6 7 8 3 2 4 1 3 7 5 8 6 4
9/22/09 TSP ‐ Path Representation • Genetic Mapping responsible for doing the repair on a “bad genome” • Most approaches that use the path representation use designer crossover/ mutation operators • Assure valid offspring. TSP ‐ binary representation • Classic GA approach • Each city encoded by a string of length log 2 (n) ‐‐ chromosomes? • Complete genome is concatenation of cities in order. • Complete genome has length n log 2 (n) 5
9/22/09 TSP ‐‐ binary representation • Example i City i i City i 1 000 4 011 2 001 5 100 3 010 6 101 • Tour: 1‐2‐3‐4‐5‐6 • (000 001 010 011 100 101) TSP ‐‐ binary representation • Similar problem with repair. • (000 001 010 011 011 101) 1‐2‐3‐4‐5‐6 • (101 100 011 010 001 000) 6‐5‐4‐3‐2‐1 • (000 001 010 010 001 000) 1‐2‐3‐3‐2‐1 Duplicate cities 6
9/22/09 TSP ‐‐ binary representation • Genetic Mapping: • Decode binary ‐> city. • Perform repair for “bad genome”. TSP ‐ Adjacency Representation • Tour is represented as an array of n cities. • City j is listed in position i, if and only if, the tour leads from city i to city j. 7
9/22/09 TSP ‐ Adjacency Representation • Example: 3 5 7 6 4 8 2 1 1 3 7 2 5 4 6 8 TSP ‐ Adjacency Representation • Has same problem as others PLUS • ( 3 5 7 6 2 4 1 8) ⇒ (1 3 7 | 2 5 | 4 6 8) 3 1 2 4 8 6 7 5 8
9/22/09 TSP ‐ Adjacency Representation • Note: • Same phenotype as path representation • Different Genetic Mapping. • …and here’s another one TSP ‐ ordinal representation • Tour is represented as an array of n cities. • The ith element is a number in the range from 1 to (n ‐ i + 1) • There exists an ordered list of cities to use as a reference point. 9
9/22/09 TSP ‐ ordinal representation • Example • C = ( 1 2 3 4 5 67 8 9 ) • Genome: 1 1 2 1 4 1 3 1 1 1 2 4 3 8 5 9 6 7 TSP ‐ ordinal representation • Complex? Perhaps, but std. crossover works! 1 1 2 1 4 1 3 1 1 1‐2‐4‐3‐8‐5‐9‐6‐7 5‐1‐7‐8‐9‐4‐6‐3‐2 5 1 5 5 5 3 3 2 1 1‐2‐4‐3‐9‐7‐8‐6‐5 1 1 2 1 5 3 3 2 1 10
9/22/09 TSP ‐ ordinal representation • Note: • Same phenotype as path representation • Even more complex Genetic Mapping. TSP ‐ Matrix representation(1) • Tour is represented as a 2D binary matrix, M. • M ij = 1 if and only if city i is visited before city j in the tour. • Must have the following properties: • Number of 1’s = n(n‐2) / 2 • M ii = 0 • If M ij = 1 and M jk =1 then M ik = 1 11
9/22/09 TSP ‐ Matrix representation(1) 0 0 0 1 1 0 1 1 1 0 0 1 0 0 0 0 Tour: 2‐3‐1‐4 TSP ‐ Matrix representation(2) • Tour is represented as a 2D binary matrix, M. • M ij = 1 if and only if city j follows city i immediately on the tour. • Each row and each column must have exactly one 1 in it. 12
9/22/09 TSP ‐ Matrix representation(2) 0 0 0 1 0 0 1 0 1 0 0 0 0 1 0 0 Tour: 1‐4‐2‐3 By the way • Most promising approach: • Path representation with designer crossover / mutation operators. • Questions? 13
9/22/09 Take home messages • A given phenotype can result from many different genotypes. • Different genotype‐phenotype pairs can have different Genetic Mapping. • Get creative with your genetic mapping! • Bad mojo is a problem • Genetic repair during Genetic Mapping • Use of designer crossover / mutation operators. Questions • Questions? 14
Recommend
More recommend