1 / 24

Traveling salesperson problem

Traveling salesperson problem. Chapter 4 sec. 2. What is the traveling salesperson problem?. A famous and difficult problem to solve in graph theory. Tools we need to solve this problem. 1. Hamiltonian path- A path that passes through all the vertices of a graph exactly once.

quang
Download Presentation

Traveling salesperson problem

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 salesperson problem Chapter 4 sec. 2

  2. What is the traveling salesperson problem? • A famous and difficult problem to solve in graph theory.

  3. Tools we need to solve this problem. • 1. Hamiltonian path- A path that passes through all the vertices of a graph exactly once. • 2. Hamiltonian circuit- If a Hamilton path begins and ends at the same vertex. (If a graph has a Hamilton circuit we will say it is Hamiltonian)

  4. Note: Hamiltonian and Euler. • Although the definitions of Hamilton path and Euler path sound similar, they are not the same. Why?

  5. In producing a Hamilton path, you do not have to trace every edge, as with an Euler path.

  6. Find the Hamilton path and circuit of each graph shown below.

  7. Solution: • A) If we start from pt. A, the path is AEDCB is the Hamilton path. The path AEDCBA is the Hamilton circuit. • B) There are no Hamilton path or Hamilton circuits.

  8. Finding a Hamilton Circuit. • A complete graph- • Is one in which every pair of vertices is joined by an edge. • A completed graph with n vertices is denoted by Kn

  9. Examples

  10. Find all Hamilton circuits in K4.

  11. Solution • ABCDA, ABDCA, ACBDA, ACDBA, ADBCA, ADCBA

  12. Calculating Hamilton circuits • Q: What if I ask you to find all the Hamilton circuits for a K6 or K10? • A: I hope that you will not list all the combinations, but tell me how many Hamilton circuits there are.

  13. Formula Kn has (n-1)(n-2)(n-3)(n-4)…..3x2x1 Hamilton circuits. When there is a pattern as shown, it is called a factorial. Which is written as (n-1)!.

  14. Therefore, • K6 = 5x4x3x2x1 = 5! = 120 Hamilton circuits. • K10 = 9! = 362,880 Hamilton circuits.

  15. Traveling Salesperson Problem • 3 Methods to solve the Travel Salesperson. • 1. Brute Force • 2. Nearest Neighbor • 3. Best Edge

  16. Definitions • Weighted Graph- we assign numbers to the edges of a graph. • Weights- the numbers on the edges • Weight of a path- is the sum of the weights of the edges of the path.

  17. Brute Force • You want to conference in 5 different cities across the U.S. The weights represents money. (In other problems it could represent distance or time.)

  18. The five cities are: • A = Albuquerque • L = Las Vegas • S = Seattle • B = Boston • D = Dallas

  19. Use the graph that will minimize your travel time. Start from A.

  20. Find the Hamilton circuit that has the smallest weight. • Solution: • ALDSBA = $1,120 • ASBDLA = $1,110 • ADBLSA = $1,210 Adv. Or Disadv.?

  21. Nearest Neighbor • 1. Begin at A (Albq) • 2. View the weights around A. • AB = 210 • AS = 230 • AD = 180 • AL = 110 • 3. Since AL has the lowest weight, that is our next vertex.

  22. Nearest neighbor • 4. View the weights around L. • LD = 170 • LS = 240 • LB = 310 • 5. D is the lowest and next vertex. • 6. Keep doing this til you reach A. • Solution: ALDBSA = $1,100

  23. Best Edge • 1. Begin by choosing any edge with the smallest weight. • 2. Choose any remaining edge in the graph with the smallest weight. • 3. Keep repeating step 2; however, do not allow a circuit to form until all vertices have been used. Also, because the final hamilton circuit cannot have three edges joined to the same vertex, new allow this to happen during the construction of the circuit.

  24. Solution • 1. Smallest edge to largest: AL(110), LD(170), AD(180), AB(210), AS(230), LS(240), BD(250), SD(290), LB(310), SB(350) • 2. AL, LD, (cannot use AD for it closes the circuit.) DB, BS, SA

More Related