spring 2015 mathematics in management science traveling salesman problem approximate solutions for...

Post on 01-Jan-2016

216 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

Spring 2015Mathematics in

Management Science

Traveling Salesman Problem

Approximate solutions for TSPNNA, RNN, SEA

Greedy Heuristic Algorithms

Traveling Salesman Problem

Given a complete weighted graph, find a minimum weight Hamilton circuit.

A Hamilton circuit visits each vertex exactly once.

A complete graph has one edge btwn each pair of vtxs.

A weighted graph has a weight (cost) for each edge.

Solving a TSP

Brute Force Algorithm – exhaustive search

Nearest Neighbor Algorithm

Repetitive Nearest Neighbor Algorithm

Sorted Edges Algorithm

Counting Hamilton Circuits

The complete graph KN with N vertices has (N – 1)!/2 distinct Hamilton circuits.

Here (N – 1)!/2 =(N-1)x(N-2)x···3x2x1.

For N=30, the number of HCs is4,420,880,996,869,850,977,271,808, 000,000 .

Generating 1 million HCs per second, say, it would take over 10 billion years to generate all of them.

The BFA will take a loooong time to finish.

Approximate Solutions

Number of HCs in even modest sized problems is so large that we cannot examine them all to find exact solutions by brute force.

Instead we must rely on fast algorithms that find approximate solutions.

NNA, RRN, SEA

Go Cheap – NNA

Start from the home city.

Go to the city that is the cheapest to get to. Repeat this.

From each new city go to the next city that is the cheapest to get to.

When there are no more new cities to go to, go back home

Nearest Neighbor Algorithm

From a vertex, go to nearest vertex not already visited. Repeat until no more new vtxs; then go home.

An example of a greedy algorithm:– doesn’t look at the “big picture”,– goes for immediate/short-term gains– can paint itself into a corner and be

forced to accept a bad solution

From Chicago, find shortest route that visits each of Minneapolis, St. Louis, and Cleveland, and returns to Chicago.

Repetitive Nearest Neighbor

Do NNA with each vertex of the graph as the starting vertex.

Of all the circuits obtained, keep the best one.

If there is a designated starting vertex, rewrite this best circuit using that vertex as the reference point.

From Chicago, find shortest route that visits each of Minneapolis, St. Louis, and Cleveland, and returns to Chicago.

Sorted Edges Algorithm

Start with minimum cost edge.

At each stage, use the cheapest (least cost) edge which is OK.

Stop when have an HC.

An edge is NOT OK ifIt closes a circuit that is not an HC, or

It meets a vertex that already has 2 edges which have been chosen.

Sorted Edges Algorithm

Pick the cheapest link (edge with smallest weight) available.

Continue picking next cheapest link available that does notclose a circuit which is not an HC, norcreate three edges coming out of a single

vertex.

Done when get a Hamilton circuit.

Sorted Edges Algorithm

Sort edges in order of increasing cost.

Select edges in order from this list to subject to these rules:

never reuse an edge

skip edges that connect to vtx already having two used edges meeting there

skip edges that create “premature” loops, (small circuits in graph that don’t include all vtxs). No circuits created until last edge is added!

Comparison of Algorithms

Both are approximate; typically give

different approximate solutions; typically neither is the “real” solution.

Neither better than the other.

NNA adds edges in order as you would traverse the circuit.

SEA adds edges “at random” in the graph.

Neither algorithm says what to do in the case of a “tie”.

ExampleFind an approximate solution to the following TSP using the Sorted-Edges Algorithm. A

D C40

BE

90100

10 20

8050 30

60 70

ExampleFirst (smallest) edge: acceptable.

A

BE

90100

10 20

8050 30

60 70

D C40

ExampleSecond (next smallest) edge: acceptable.

A

BE

90100

10 20

8050 30

60 70

D C40

ExampleThird edge: acceptable.

A

BE

90100

8050 30

60 70

2010

D C40

ExampleFourth edge: reject (creates premature loop; three edges into one vertex)

A

BE

90100

8050 30

60 70

2010

D C40

ExampleFifth edge: reject (creates premature loop)

A

BE

90100

8050 30

60 70

2010

D C40

ExampleSixth edge: reject (three edges at one vtx)

A

BE

90100

8050 30

60 70

2010

D C40

ExampleSeventh edge: acceptable

A

BE

90100

8050 30

60 70

2010

D C40

ExampleAlready added 4 of 5 edges. Only one possible to close up loop.

A

BE

90100

10 20

8050 30

60 70

D C40

Example do NNA from BA B

CE

D

600

500

800400

700 650950

850550

750

TSP – Conclusion

How does one find an optimal Hamilton circuit in a complete weighted graph?

NNA & SEA are fairly simple strategies for attacking TSPs, which quickly give good HCs.

The search for an optimal and efficient general algorithm….

top related