1 / 20

Traveling Salesman Problems Repetitive Nearest-Neighbor and Cheapest-Link Algorithms

Traveling Salesman Problems Repetitive Nearest-Neighbor and Cheapest-Link Algorithms. Chapter: 6. Repetitive Nearest-Neighbor Algorithm. Let A be any vertex. Apply the nearest-neighbor algorithm using A as the starting vertex and calculate the total cost associated with the circuit.

quade
Download Presentation

Traveling Salesman Problems Repetitive Nearest-Neighbor and Cheapest-Link Algorithms

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Traveling Salesman ProblemsRepetitive Nearest-Neighbor and Cheapest-Link Algorithms Chapter: 6

  2. Repetitive Nearest-Neighbor Algorithm • Let A be any vertex. Apply the nearest-neighbor algorithm using A as the starting vertex and calculate the total cost associated with the circuit. • Repeat the process using each of the other vertices (B,C, D, E) of the graph as the staring vertex. • Keep the best one from all the Hamilton circuits. If there is a designated starting vertex, rewrite this circuit with that vertex as the reference point.

  3. Repetitive Nearest-Neighbor Algorithm • Step 1: • Let A be any vertex . • Apply nearest-neighbor Algo. • Calculate the cost of circuit A $185 $133 B $200 $119 $152 E $121 At point A: EdgeWeight AE $133 AD $152 AC $119 Min AB $185 $120 $150 C $199 $174 D

  4. $185 $133 $200 $119 $152 $121 $120 $150 $199 $174 Repetitive Nearest-Neighbor Algorithm • Step 1: • Let A be any vertex . • Apply nearest-neighbor Algo. • Calculate the cost of circuit A B E At point C: EdgeWeight CB $121 CA $119 Already visited CE $120 Min CD $174 C D

  5. $185 $133 $200 $119 $152 $121 $120 $150 $199 $174 Repetitive Nearest-Neighbor Algorithm • Step 1: • Let A be any vertex . • Apply nearest-neighbor Algo. • Calculate the cost of circuit A B E At point E: EdgeWeight EA $133 Cannot revisit A as all vertices are visited yet EB $200 EC $120 Already visited ED $199 Min C D

  6. $185 $133 $200 $119 $152 $121 $120 $150 $199 $174 Repetitive Nearest-Neighbor Algorithm • Step 1: • Let A be any vertex . • Apply nearest-neighbor Algo. • Calculate the cost of circuit A B E At point D: EdgeWeight DE $199 DA $152 DB $150 Min DC $174 C D

  7. $185 $133 $200 $119 $152 $121 $120 $150 $199 $174 Repetitive Nearest-Neighbor Algorithm • Step 1: • Let A be any vertex . • Apply nearest-neighbor Algo. • Calculate the cost of circuit A B E At point B: From the last vertex (B), return to the starting point (A). All vertices have been visited Selected edge: BA C D

  8. $185 $133 $200 $119 $152 $121 $120 $150 $199 $174 Repetitive Nearest-Neighbor Algorithm • Step 1: • Let A be any vertex . • Apply nearest-neighbor Algo. • Calculate the cost of circuit A Using the Nearest-Neighbor algorithm with A as the starting vertex, we got: Hamilton circuit: A, C, E, D, B, A Cost associated with the Hamilton circuit: $119+$120+$199+ $150+$185 = $773 B E C D

  9. $185 A $133 $200 $119 $152 B $121 $120 $150 E $199 C $174 D Repetitive Nearest-Neighbor Algorithm Step 2: Repeat the process using each of the other vertices (B,C, D, E) of the graph as the staring vertex.

  10. $185 A $133 $200 $119 $152 B $121 $120 $150 E $199 C $174 D Repetitive Nearest-Neighbor Algorithm • Step 3: • Keep the best one from all the Hamilton circuits. If there is a designated starting vertex, rewrite this circuit with that vertex as the reference point.

  11. $185 A $133 $200 $119 $152 B $121 $120 $150 E $199 C $174 D Repetitive Nearest-Neighbor Algorithm • Step 3: • Keep the best one from all the Hamilton circuits. If there is a designated starting vertex, rewrite this circuit with that vertex as the reference point. The Best one from all Hamilton circuits: • B, C, A, E, D, B • C, A, E, D, B, C • D, B, C, A, E, D B, C, A, E, D, B Rewrite with A as the starting vertex A, E, D, B, C, A B, C, A, E, D, B Rewrite with C as the starting vertex C, A, E, D, B, C B, C, A, E, D, B Rewrite with E as the starting vertex E, D, B, C, A, E Tie: Select randomly

  12. $185 A $133 $200 $119 $152 B $121 $120 $150 E $199 C $174 D Cheapest-Link Algorithm • Pick the edge with the smallest weight first. Mark the edge (say in red). • Pick the next “cheapest” edge and mark the edge in red. • Continue picking the “cheapest” edge available and mark the edge in red except when • It closes a circuit • It results in three edges coming out of a single vertex • When there are no more vertices to join, close the red circuit.

  13. $185 A $133 $119 $200 B $152 $121 $120 E $150 $199 C $174 D Cheapest-Link Algorithm Step 1: Pick the edge with the smallest weight first. Mark the edge (say in red).  Edge AC (Weight: $119)

  14. $185 A $133 $119 $200 B $152 $121 $120 E $150 $199 C $174 D Cheapest-Link Algorithm Step 2: Pick the next “cheapest” edge. Mark the edge (say in red).  Edge EC (Weight: $120)

  15. $185 A $133 $119 $200 B $152 $121 $120 E $150 $199 C $174 D Cheapest-Link Algorithm Step 3: Continue picking the next “cheapest” edge. Mark the edge (say in red) except when it results in 3 edges coming out of a single vertex.  Edge BC Weight ($121)

  16. $185 A $133 $119 $200 B $152 $121 $120 E $150 $199 C $174 D Cheapest-Link Algorithm Step 3: Continue picking the next “cheapest” edge. Mark the edge (say in red) except when it closes a circuit.  Edge AE Weight ($133)

  17. Cheapest-Link Algorithm A $185 B Step 3: Continue picking the next “cheapest” edge. Mark the edge (say in red).  Edge BD Weight ($150) $119 $200 $152 E $120 $150 C $199 $174 D

  18. Cheapest-Link Algorithm A $185 B Step 3: Continue picking the next “cheapest” edge. Mark the edge (say in red).  Edge AD Weight ($152) $119 $200 $152 E $120 $150 C $199 $174 D

  19. Cheapest-Link Algorithm A $185 B Step 4: When there are no more vertices to join, close the red circuit Edge EB Weight ($200) $119 $200 $152 E $120 $150 C $199 $174 D

  20. A $185 B $200 $152 $119 E $120 $150 C $199 $174 D Summary of Cheapest-Link Algorithm

More Related