Presentation is loading. Please wait.

Presentation is loading. Please wait.

 Graphs  Paths  Circuits  Euler. Traveling Salesman Problems.

Similar presentations


Presentation on theme: " Graphs  Paths  Circuits  Euler. Traveling Salesman Problems."— Presentation transcript:

1  Graphs  Paths  Circuits  Euler

2 Traveling Salesman Problems

3  You are invited to go on a lecture circuit to colleges across the country.  The company said they will cover for a part of your travel expense and you will have to cover the rest.  The cities you are able to visit are…

4  Seattle  Portland  Spokane  Boise  Salt Lake City  Reno  Sacramento  San Francisco  San Jose  Las Vegas  Los Angeles  San Diego  Phoenix  Charleston  Tampa  Orlando  Ft. Lauderdale  Raleigh  Richmond  Washington DC  Philadelphia  New York  Providence  Boston  Denver  Albuquerque  San Antonio  Austin  Houston  Dallas  Oklahoma City  Kansas City  Little Rock  New Orleans  Jackson  Memphis  St. Louis  Pensacola  Atlanta  Nashville  Chicago  Indianapolis  Minneapolis/St. Paul  Detroit  Cleveland  Pittsburgh  Charlotte

5  Create a graph so that all of the cities are connected.  Make it easy to read for yourself.

6  Find the cost for your flights.  You should have 10 flights to look up.  Write the cost on each edge.

7  How many different circuits do you make?  Which circuit would you use?  What was its cost?  How did you find this circuit? What was your process for choosing flights?

8  Hamilton Path- A path that crosses ever VERTEX once and only once  Hamilton Circuit- A Circuit that crosses ever VERTEX once and ends in the place it started.

9

10

11 Euler CircuitEuler PathHamilton CircuitHamilton Path (a)YesNoYes (b)NoYesNoYes (c)No Yes (d)YesNo Yes (e)NoYesNo (f)No

12  If there is a Hamilton Circuit, then there is a Hamilton Path (Drop the last edge that creates the circuit).  There is no connection between Euler and Hamilton  There is no easy theorem to see if there is a Hamilton Circuit or Path.

13  Find 3 different Hamilton circuits  Find a Hamilton path that starts at A and ends at B  Find a Hamilton path that starts at D and ends at F

14  Find the weight of edge BD.  Find a Hamilton circuit that starts with BD and give its weight.  Find a Hamilton circuit that starts with DB and give its weight.

15 Page 226 #2,5,6,9,10, 14,15, and 16

16  When every vertex is connected by an edge

17

18

19

20

21

22 20!

23

24

25

26 Page 229 #17-28

27  Sites: The vertices on the graph  Costs: The weight of the edges  Tour: A Hamilton Circuit  Optimal Tour: Hamilton Circuit of least weight

28

29  Exhaustive Search: Make a list of all possible routes. The previous example has 24 possible.  Go Cheap: Go to the cheapest city. Continue by going through the cheapest routes possible.

30 1. Make a list of all possible routes 2. Calculate all the tours 3. Choose the one with the smallest number

31  This will ALWAYS get you the optimal tour.  Problem: it is an INEFFICIENT ALGORITHM. This means that it can take way to long to find your solution. ◦ Even with computers

32

33 nTime 202 mins 2140 mins 2214 hours 2313 days 2410 months 2520 years 26500 years 2713,000 years 28350,000 years 299.8 million years 30284 million years

34  Start at the starting vertex  Go to the “nearest neighbor” (edge with the lowest amount)  Continue through all the points  End at your starting vertex

35  This is not optimal because it might not give us our optimal route  But this is effective because it is proportional to the size of the graph ◦ 10 vertices= 10 steps ◦ 30 vertices= 30 steps

36

37  Using Algorithms to get close to the optimal but might not be the optimal.  Ask yourself: Is a 12.49% relative error good or would we have to be closer?

38  Just like Nearest-Neighbor, but you create a circuit for all the vertices to be your starting point.

39  A C E D B A ◦ 773  B C A E D B ◦ 722  C A E D B C ◦ 722  D B C A E D ◦ 722  E C A D B E ◦ 741

40  Find the cheapest edge and mark it  Pick the next smallest edge  Keep picking the smallest edges ◦ Do not close the circuit ◦ Do not have 3 edges go to the same vertex  Close the circuit to finish

41

42 Chapter 6 #30, 31, 35, 36, 38, 41, 42, 44, 47, 48


Download ppt " Graphs  Paths  Circuits  Euler. Traveling Salesman Problems."

Similar presentations


Ads by Google