18

Excursions in Modern Mathematics, 7e: 6.3 - 2Copyright © 2010 Pearson Education, Inc. 6 The Mathematics of Touring 6.1Hamilton Paths and Hamilton Circuits

Embed Size (px)

Citation preview

Page 1: Excursions in Modern Mathematics, 7e: 6.3 - 2Copyright © 2010 Pearson Education, Inc. 6 The Mathematics of Touring 6.1Hamilton Paths and Hamilton Circuits
Page 2: Excursions in Modern Mathematics, 7e: 6.3 - 2Copyright © 2010 Pearson Education, Inc. 6 The Mathematics of Touring 6.1Hamilton Paths and Hamilton Circuits

Excursions in Modern Mathematics, 7e: 6.3 - 2Copyright © 2010 Pearson Education, Inc.

6 The Mathematics of Touring

6.1 Hamilton Paths and Hamilton Circuits

6.2 Complete Graphs?

6.3 Traveling Salesman Problems

6.4 Simple Strategies for Solving TSPs

6.5 The Brute-Force and Nearest-Neighbor Algorithms

6.6 Approximate Algorithms

6.7 The Repetitive Nearest-Neighbor Algorithm

6.8 The Cheapest-Link Algorithm

Page 3: Excursions in Modern Mathematics, 7e: 6.3 - 2Copyright © 2010 Pearson Education, Inc. 6 The Mathematics of Touring 6.1Hamilton Paths and Hamilton Circuits

Excursions in Modern Mathematics, 7e: 6.3 - 3Copyright © 2010 Pearson Education, Inc.

The “traveling salesman” is a convenient metaphor for many different real-life applications. The next few examples illustrate a few of the many possible settings for a “traveling salesman” problem, starting, of course, with the traveling salesman’s “traveling salesman” problem.

Traveling Salesman Problems

Page 4: Excursions in Modern Mathematics, 7e: 6.3 - 2Copyright © 2010 Pearson Education, Inc. 6 The Mathematics of Touring 6.1Hamilton Paths and Hamilton Circuits

Excursions in Modern Mathematics, 7e: 6.3 - 4Copyright © 2010 Pearson Education, Inc.

Meet Willy, the traveling salesman. Willy has customers in five cities, which for the sake of brevity we will call A, B, C, D, and E. Willy needs to schedule a sales trip that will start and end at A (that’s Willy’s hometown) and goes to each of the other four cities once. We will call the trip “Willy’s sales tour.” Other than starting and ending at A, there are no restrictions as to the sequence in which Willy’s sales tour visits the other four cities.

Example 6.4 A Tour of Five Cities

Page 5: Excursions in Modern Mathematics, 7e: 6.3 - 2Copyright © 2010 Pearson Education, Inc. 6 The Mathematics of Touring 6.1Hamilton Paths and Hamilton Circuits

Excursions in Modern Mathematics, 7e: 6.3 - 5Copyright © 2010 Pearson Education, Inc.

The graph shows the cost of a one-way airline ticket between each pair of cities. Like most people, Willy hates to

Example 6.4 A Tour of Five Cities

waste money. Thus, among the many possibilities for his sales tour, Willy wants to find the optimal (cheapest) one. How? We will return to this question soon.

Page 6: Excursions in Modern Mathematics, 7e: 6.3 - 2Copyright © 2010 Pearson Education, Inc. 6 The Mathematics of Touring 6.1Hamilton Paths and Hamilton Circuits

Excursions in Modern Mathematics, 7e: 6.3 - 6Copyright © 2010 Pearson Education, Inc.

It is the year 2020. An expedition to explore the outer planetary moons in our solar system is about to be launched from planet Earth. The expedition is scheduled to visit Callisto, Ganymede, Io, Mimas, and Titan (the first three are moons of Jupiter; the last two, of Saturn), collect rock samples at each, and then return to Earth with the loot. The next slide shows the mission time (in years) between any two moons. An important goal of the mission planners is to complete the mission in the least amount of time.

Example 6.5 Touring the Outer Moons

Page 7: Excursions in Modern Mathematics, 7e: 6.3 - 2Copyright © 2010 Pearson Education, Inc. 6 The Mathematics of Touring 6.1Hamilton Paths and Hamilton Circuits

Excursions in Modern Mathematics, 7e: 6.3 - 7Copyright © 2010 Pearson Education, Inc.

What is the optimal (shortest) tour of the outer moons?

Example 6.5 Touring the Outer Moons

Page 8: Excursions in Modern Mathematics, 7e: 6.3 - 2Copyright © 2010 Pearson Education, Inc. 6 The Mathematics of Touring 6.1Hamilton Paths and Hamilton Circuits

Excursions in Modern Mathematics, 7e: 6.3 - 8Copyright © 2010 Pearson Education, Inc.

The figure shows seven locations on Mars where NASA scientists believe there is a good chance of finding evidence of life.

Example 6.6 Roving the Red Planet

Page 9: Excursions in Modern Mathematics, 7e: 6.3 - 2Copyright © 2010 Pearson Education, Inc. 6 The Mathematics of Touring 6.1Hamilton Paths and Hamilton Circuits

Excursions in Modern Mathematics, 7e: 6.3 - 9Copyright © 2010 Pearson Education, Inc.

Imagine that you are in charge of planning a sample-return mission. First, you must land an unmanned rover in the Ares Vallis (A). Then you must direct the rover to travel to each site and collect and analyze soil samples. Finally, you must instruct the rover to return to the Ares Vallis landing site, where a return rocket will bring the best samples back to Earth. A Mars tour like this will take several years and cost several billion dollars, so good planning is critical.

Example 6.6 Roving the Red Planet

Page 10: Excursions in Modern Mathematics, 7e: 6.3 - 2Copyright © 2010 Pearson Education, Inc. 6 The Mathematics of Touring 6.1Hamilton Paths and Hamilton Circuits

Excursions in Modern Mathematics, 7e: 6.3 - 10Copyright © 2010 Pearson Education, Inc.

Here are the estimated distances (in miles) that a rover would have to travel to get from one Martian site to another. What is the optimal (shortest) tour for the Mars rover?

Example 6.6 Roving the Red Planet

Page 11: Excursions in Modern Mathematics, 7e: 6.3 - 2Copyright © 2010 Pearson Education, Inc. 6 The Mathematics of Touring 6.1Hamilton Paths and Hamilton Circuits

Excursions in Modern Mathematics, 7e: 6.3 - 11Copyright © 2010 Pearson Education, Inc.

In each case the problem is to find a tour of the sites (i.e., a trip that starts and ends at a designated site and visits each of the other sites once) and has the property of being optimal (i.e., has the least total cost). Any problem that shares these common elements (a traveler, a set of sites, a cost function for travel between pairs of sites, a need to tour all the sites, and a desire to minimize the total cost of the tour) is known as a traveling salesman problem, or TSP.

Traveling Salesman Examples

Page 12: Excursions in Modern Mathematics, 7e: 6.3 - 2Copyright © 2010 Pearson Education, Inc. 6 The Mathematics of Touring 6.1Hamilton Paths and Hamilton Circuits

Excursions in Modern Mathematics, 7e: 6.3 - 12Copyright © 2010 Pearson Education, Inc.

A school bus (the traveler) picks up children in the morning and drops them off at the end of the day at designated stops (the sites). On a typical school bus route there may be 20 to 30 such stops. With school buses, total time on the bus is always the most important variable (students have to get to school on time), and there is a known time of travel (the cost) between any two bus stops. Since children must be picked up at every bus stop, a tour of all the sites (starting and ending at the school) is required. Since the bus repeats its route every day during the school year, finding an optimal tour is crucial.

Routing School Buses

Page 13: Excursions in Modern Mathematics, 7e: 6.3 - 2Copyright © 2010 Pearson Education, Inc. 6 The Mathematics of Touring 6.1Hamilton Paths and Hamilton Circuits

Excursions in Modern Mathematics, 7e: 6.3 - 13Copyright © 2010 Pearson Education, Inc.

Package delivery companies such as UPS and FedEx deal with TSPs on a daily basis. Each truck is a traveler that must deliver packages to a specific list of delivery destinations (the sites). The travel time between any two delivery sites (the cost) is known or can be estimated. Each day the truck must deliver to all the sites on its list (that’s why sometimes you see a UPS truck delivering at 8 P.M.), so a tour is an implied part of the requirements. Since one can assume that the driver would rather be home than out delivering packages, an optimal tour is a highly desirable goal.

Delivering Packages

Page 14: Excursions in Modern Mathematics, 7e: 6.3 - 2Copyright © 2010 Pearson Education, Inc. 6 The Mathematics of Touring 6.1Hamilton Paths and Hamilton Circuits

Excursions in Modern Mathematics, 7e: 6.3 - 14Copyright © 2010 Pearson Education, Inc.

In the process of fabricating integrated-circuit boards, tens of thousands of tiny holes (the sites) must be drilled in each board. This is done by using a stationary laser beam and moving the board (the traveler). To do this efficiently, the order in which the holes are drilled should be such that the entire drilling sequence (the tour) is completed in the least amount of time (optimal cost). This makes for a very high tech TSP.

Fabricating Circuit Boards

Page 15: Excursions in Modern Mathematics, 7e: 6.3 - 2Copyright © 2010 Pearson Education, Inc. 6 The Mathematics of Touring 6.1Hamilton Paths and Hamilton Circuits

Excursions in Modern Mathematics, 7e: 6.3 - 15Copyright © 2010 Pearson Education, Inc.

On a typical Saturday morning, an average Joe or Jane (the traveler) sets out to run a bunch of errands around town, visiting various sites (grocery store, hair salon, bakery, post office). When gas was cheap, time used to be the key cost variable, but with the cost of gas these days, people are more likely to be looking for the tour that minimizes the total distance traveled.

Fabricating Circuit Boards

Page 16: Excursions in Modern Mathematics, 7e: 6.3 - 2Copyright © 2010 Pearson Education, Inc. 6 The Mathematics of Touring 6.1Hamilton Paths and Hamilton Circuits

Excursions in Modern Mathematics, 7e: 6.3 - 16Copyright © 2010 Pearson Education, Inc.

Every TSP can be modeled by a weighted graph, that is, a graph such that there is a number associated with each edge (called the weight of the edge). The beauty of this approach is that the model always has the same structure: The vertices of the graph are the sites of the TSP, and there is an edge between X and Y if there is a direct link for the traveler to travel from site X to site Y. Moreover, the weight of the edge XY is the cost of travel between X and Y.

Modeling a TSP

Page 17: Excursions in Modern Mathematics, 7e: 6.3 - 2Copyright © 2010 Pearson Education, Inc. 6 The Mathematics of Touring 6.1Hamilton Paths and Hamilton Circuits

Excursions in Modern Mathematics, 7e: 6.3 - 17Copyright © 2010 Pearson Education, Inc.

In this setting a tour is a Hamilton circuit of the graph, and an optimal tour is the Hamilton circuit of least total weight. In all the applications and examples we will be considering in this chapter, we will make the assumption that there is an edge connecting every pair of sites, which implies that the underlying graph model is always a complete weighted graph. The following is a summary of the preceding observations.

Modeling a TSP

Page 18: Excursions in Modern Mathematics, 7e: 6.3 - 2Copyright © 2010 Pearson Education, Inc. 6 The Mathematics of Touring 6.1Hamilton Paths and Hamilton Circuits

Excursions in Modern Mathematics, 7e: 6.3 - 18Copyright © 2010 Pearson Education, Inc.

■ Sites vertices of the graph. ■ Costs weights of the edges.

■ Tour Hamilton circuit.

■ Optimal tour Hamilton circuit of least total cost

GRAPH MODEL OF A TRAVELING SALESMAN PROBLEM