160 likes | 343 Views
Traveling-Salesman Problems. Ch 6. A. B. A. B. F. C. E. C. E. D. D. More examples of Complete Graphs. Graph1. Graph 2. No. of edges with n=5 vertices = n(n-1)/2 = 5(5-1)/2 = 10. No. of edges with n=6 vertices = n(n-1)/2 = 6(6-1)/2 = 15.
E N D
A B A B F C E C E D D More examples of Complete Graphs Graph1 Graph 2 No. of edges with n=5 vertices = n(n-1)/2 = 5(5-1)/2 = 10 No. of edges with n=6 vertices = n(n-1)/2 = 6(6-1)/2 = 15 n represents the number of vertices in a complete graph
A B E D C Not a Complete graph No edge between the pair of edges A, C No edge between the pair of edges B, D
A B E D C Not a Complete graph No edge between the pair of vertices A, D No edge between the pair of vertices B, C No edge between the pair of vertices A, C No edge between the pair of vertices B, D
Not a Complete graph A B We cannot apply the formula for number of edges for a graph which is not a complete graph D C E No edge between the pair of vertices A, E No edge between the pair of vertices B, E
Modifying the previous graph: Complete graph A B We can apply the formula for number of edges for a graph which is a complete graph. # of edges = n(n-1) = 5x4/2 = 10 D C E Add an edge between the pair of vertices A, E Add an edge between the pair of vertices B, E n represents the number of vertices in a complete graph
No of edges of a complete graph A No. of edges of the complete graph = n(n-1)/2 = 3(3-1)/2 = 3 B C n represents the number of vertices in a complete graph
A B D C No. of Hamilton circuits of a complete graph No. of Hamilton circuit of the Complete graph = (n-1)! = (4-1)! = 3! = 1x2x3 = 6 n represents the number of vertices in a complete graph
A B E C D No. of Hamilton circuits of a complete graph No. of Hamilton circuit of the Complete graph = (n-1)! = (5-1)! = 4! = 1x2x3x4 = 24 n represents the number of vertices in a complete graph
A B F C E D No. of Hamilton circuits of a complete graph No. of Hamilton circuit of the Complete graph = (n-1)! = (6-1)! = 5! = 1x2x3x4x5 = 120 n represents the number of vertices in a complete graph
Simple Strategies for solving TSPs Method 1: • Make a list of all possible Hamilton circuits • Calculate the total cost for each circuit. • Select a circuit with least total cost for the answer.
Simple Strategies for solving TSPs $185 $133 $200 $119 $152 $121 $120 $150 $199 $174
Simple Strategies for solving TSPs Method 2: • Start at home (A) • From there go to the city to which the cost of travel is the cheapest. • Then from there go to the next city to which the cost of travel is the cheapest, and so on. • From the last city, return to A.
Simple Strategies for solving TSPs The optimal circuit: A,E,C,B,D,A => Cost $676 (Method1) A,C,E, D,B, A => cost $773 (Method 2)