CS 312: Algorithm Design & Analysis Lecture #34: Branch and Bound Design Options for Solving the...
-
Upload
dennis-thornton -
Category
Documents
-
view
218 -
download
1
Transcript of CS 312: Algorithm Design & Analysis Lecture #34: Branch and Bound Design Options for Solving the...
![Page 1: CS 312: Algorithm Design & Analysis Lecture #34: Branch and Bound Design Options for Solving the TSP: Tight Bounds This work is licensed under a Creative.](https://reader036.fdocuments.in/reader036/viewer/2022062421/56649e595503460f94b52e49/html5/thumbnails/1.jpg)
CS 312: Algorithm Design & Analysis
Lecture #34: Branch and Bound Design Options for Solving the
TSP: Tight Bounds
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 Unported License.
Slides by: Eric Ringger, with contributions from Mike Jones, Eric Mercer, and Sean Warnick
![Page 2: CS 312: Algorithm Design & Analysis Lecture #34: Branch and Bound Design Options for Solving the TSP: Tight Bounds This work is licensed under a Creative.](https://reader036.fdocuments.in/reader036/viewer/2022062421/56649e595503460f94b52e49/html5/thumbnails/2.jpg)
Announcements
Homework #24 due now
Project #7: TSP ASAP: Read the helpful “B&B for TSP Notes”
linked from the schedule Read Project Instructions Today: We continue discussing design options
![Page 3: CS 312: Algorithm Design & Analysis Lecture #34: Branch and Bound Design Options for Solving the TSP: Tight Bounds This work is licensed under a Creative.](https://reader036.fdocuments.in/reader036/viewer/2022062421/56649e595503460f94b52e49/html5/thumbnails/3.jpg)
Objectives
Review the Traveling Salesman Problem (TSP)
Develop a good bounding function for the TSP
Reason about Tight Bounds Augment general B&B algorithm
![Page 4: CS 312: Algorithm Design & Analysis Lecture #34: Branch and Bound Design Options for Solving the TSP: Tight Bounds This work is licensed under a Creative.](https://reader036.fdocuments.in/reader036/viewer/2022062421/56649e595503460f94b52e49/html5/thumbnails/4.jpg)
Traveling Salesman (Optimization) Problem
Rudrata or Hamiltonian Cycle Cycle in the graph that passes through each vertex exactly once
+ Find the least cost or “shortest”
cycle
It’s NP Hard
1
2
3 4
58
67
4
4
3
2
19
1012
Distinguish TSP-Opt from theTSP search problem and theTSP decision problem(The TSP decision problem is NP-Complete.)
![Page 5: CS 312: Algorithm Design & Analysis Lecture #34: Branch and Bound Design Options for Solving the TSP: Tight Bounds This work is licensed under a Creative.](https://reader036.fdocuments.in/reader036/viewer/2022062421/56649e595503460f94b52e49/html5/thumbnails/5.jpg)
How to solve?
![Page 6: CS 312: Algorithm Design & Analysis Lecture #34: Branch and Bound Design Options for Solving the TSP: Tight Bounds This work is licensed under a Creative.](https://reader036.fdocuments.in/reader036/viewer/2022062421/56649e595503460f94b52e49/html5/thumbnails/6.jpg)
If with B&B, what do we need?
![Page 7: CS 312: Algorithm Design & Analysis Lecture #34: Branch and Bound Design Options for Solving the TSP: Tight Bounds This work is licensed under a Creative.](https://reader036.fdocuments.in/reader036/viewer/2022062421/56649e595503460f94b52e49/html5/thumbnails/7.jpg)
Initial BSSF
1
2
3 4
5
8
6
74
4
3
2
19
10
12
How to compute?
Should be quick.
What if you have a complete graph?
What if you don’t?
![Page 8: CS 312: Algorithm Design & Analysis Lecture #34: Branch and Bound Design Options for Solving the TSP: Tight Bounds This work is licensed under a Creative.](https://reader036.fdocuments.in/reader036/viewer/2022062421/56649e595503460f94b52e49/html5/thumbnails/8.jpg)
Simple-Minded Initial BSSF
1
2
3 4
5
8
6
74
4
3
2
19
10
12
Cost of BSSF= 9+4+4+12+1 = 30
![Page 9: CS 312: Algorithm Design & Analysis Lecture #34: Branch and Bound Design Options for Solving the TSP: Tight Bounds This work is licensed under a Creative.](https://reader036.fdocuments.in/reader036/viewer/2022062421/56649e595503460f94b52e49/html5/thumbnails/9.jpg)
A Bound on Possible TSP Tours
We need a bound function. Lower or Upper?How to compute?
1
2
3 4
58
67
4
4
3
2
19
1012
![Page 10: CS 312: Algorithm Design & Analysis Lecture #34: Branch and Bound Design Options for Solving the TSP: Tight Bounds This work is licensed under a Creative.](https://reader036.fdocuments.in/reader036/viewer/2022062421/56649e595503460f94b52e49/html5/thumbnails/10.jpg)
A Bound on Possible TSP Tours
1
2
3 4
5
8
6
74
4
3
2
19
10
12
What’s the cheapest way to leave each vertex?
![Page 11: CS 312: Algorithm Design & Analysis Lecture #34: Branch and Bound Design Options for Solving the TSP: Tight Bounds This work is licensed under a Creative.](https://reader036.fdocuments.in/reader036/viewer/2022062421/56649e595503460f94b52e49/html5/thumbnails/11.jpg)
Bound on Possible TSP Tours
1
2
3 4
5
8
6
74
4
3
2
19
10
12
Save the sum of those costs in the bound (as a rough draft).
Rough draft bound= 8+6+3+2+1 = 20
![Page 12: CS 312: Algorithm Design & Analysis Lecture #34: Branch and Bound Design Options for Solving the TSP: Tight Bounds This work is licensed under a Creative.](https://reader036.fdocuments.in/reader036/viewer/2022062421/56649e595503460f94b52e49/html5/thumbnails/12.jpg)
Bound on Possible TSP Tours
1
2
3 4
5
8-8=0
6
74
4
3
2
19-8=1
10
12
For a given vertex, subtract the least cost departure from each edge leaving that vertex.
Rough draft bound= 20
![Page 13: CS 312: Algorithm Design & Analysis Lecture #34: Branch and Bound Design Options for Solving the TSP: Tight Bounds This work is licensed under a Creative.](https://reader036.fdocuments.in/reader036/viewer/2022062421/56649e595503460f94b52e49/html5/thumbnails/13.jpg)
Bound on Possible TSP Tours
1
2
3 4
5
0
0
12
1
0
0
01
9
6
Repeat for the other vertices.What do the numbers on the edges mean now?
Rough draft bound= 20
![Page 14: CS 312: Algorithm Design & Analysis Lecture #34: Branch and Bound Design Options for Solving the TSP: Tight Bounds This work is licensed under a Creative.](https://reader036.fdocuments.in/reader036/viewer/2022062421/56649e595503460f94b52e49/html5/thumbnails/14.jpg)
Bound on Possible TSP Tours
1
2
3 4
5
0
0
12
1
0
0
01
9
6
Now, can we find a tighter lower bound?
Rough draft bound= 20
![Page 15: CS 312: Algorithm Design & Analysis Lecture #34: Branch and Bound Design Options for Solving the TSP: Tight Bounds This work is licensed under a Creative.](https://reader036.fdocuments.in/reader036/viewer/2022062421/56649e595503460f94b52e49/html5/thumbnails/15.jpg)
Bound on Possible TSP Tours
1
2
3 4
5
0
0
12
1
0
0
01
9
6
Does that set of edges now having 0 residual cost arrive at every vertex?
Rough draft bound= 20
![Page 16: CS 312: Algorithm Design & Analysis Lecture #34: Branch and Bound Design Options for Solving the TSP: Tight Bounds This work is licensed under a Creative.](https://reader036.fdocuments.in/reader036/viewer/2022062421/56649e595503460f94b52e49/html5/thumbnails/16.jpg)
Bound on Possible TSP Tours
1
2
3 4
5
0
0
12
1
0
0
01
9
6
In this case, those edges never arrive at vertex #3.
Rough draft bound= 20
![Page 17: CS 312: Algorithm Design & Analysis Lecture #34: Branch and Bound Design Options for Solving the TSP: Tight Bounds This work is licensed under a Creative.](https://reader036.fdocuments.in/reader036/viewer/2022062421/56649e595503460f94b52e49/html5/thumbnails/17.jpg)
Bound on Possible TSP Tours
1
2
3 4
5
0
0
12
1
0
0
01
9
6
We have to take an edge to vertex 3 from somewhere. Assume we take the cheapest.
Rough draft bound= 20
![Page 18: CS 312: Algorithm Design & Analysis Lecture #34: Branch and Bound Design Options for Solving the TSP: Tight Bounds This work is licensed under a Creative.](https://reader036.fdocuments.in/reader036/viewer/2022062421/56649e595503460f94b52e49/html5/thumbnails/18.jpg)
Bound on Possible TSP Tours
1
2
3 4
5
0
0
01
1
0
0
01
9
6
Subtract its cost from other edges entering vertex 3 and add the cost to the bound.
We have just tightened the bound.
Bound = 21
![Page 19: CS 312: Algorithm Design & Analysis Lecture #34: Branch and Bound Design Options for Solving the TSP: Tight Bounds This work is licensed under a Creative.](https://reader036.fdocuments.in/reader036/viewer/2022062421/56649e595503460f94b52e49/html5/thumbnails/19.jpg)
This Bound
It will cost at least this much to visit all the vertices in the graph. There’s no cheaper way to get in and out of each
vertex. Each edge is now labeled with the extra cost of
choosing that edge.
The bound is not a solution; it’s a bound!
Why are tight bounds desirable?
![Page 20: CS 312: Algorithm Design & Analysis Lecture #34: Branch and Bound Design Options for Solving the TSP: Tight Bounds This work is licensed under a Creative.](https://reader036.fdocuments.in/reader036/viewer/2022062421/56649e595503460f94b52e49/html5/thumbnails/20.jpg)
Bound on Possible TSP Tours
1
2
3 4
5
8
6
74
4
3
2
19
10
12
Our algorithm can do this reasoning using a cost matrix.
999 9 999 8 999999 999 4 999 2999 3 999 4 999999 6 7 999 12
1 999 999 10 999
To:1 2 3 4 5From:
1
2
3
4
5
![Page 21: CS 312: Algorithm Design & Analysis Lecture #34: Branch and Bound Design Options for Solving the TSP: Tight Bounds This work is licensed under a Creative.](https://reader036.fdocuments.in/reader036/viewer/2022062421/56649e595503460f94b52e49/html5/thumbnails/21.jpg)
Bound on Possible TSP Tours
999 1 999 0 999999 999 2 999 0999 0 999 1 999999 0 1 999 6
0 999 999 9 999
1
2
3 4
50
01
2
1
0
0
01
9
6
Reduce all rows.
To:1 2 3 4 5From:
1
2
3
4
5
![Page 22: CS 312: Algorithm Design & Analysis Lecture #34: Branch and Bound Design Options for Solving the TSP: Tight Bounds This work is licensed under a Creative.](https://reader036.fdocuments.in/reader036/viewer/2022062421/56649e595503460f94b52e49/html5/thumbnails/22.jpg)
Bound on Possible TSP Tours
999 1 999 0 999999 999 1 999 0999 0 999 1 999999 0 0 999 6
0 999 999 9 999
1
2
3 4
50
01
2
1
0
0
01
9
6
Then reduce column #3. Now we have a tighter bound.
To:1 2 3 4 5From:
1
2
3
4
5
![Page 23: CS 312: Algorithm Design & Analysis Lecture #34: Branch and Bound Design Options for Solving the TSP: Tight Bounds This work is licensed under a Creative.](https://reader036.fdocuments.in/reader036/viewer/2022062421/56649e595503460f94b52e49/html5/thumbnails/23.jpg)
Search
Let’s start the search Arbitrarily start at vertex 1
Why is this OK? Focus on:
the bound function and the reduced cost matrix representation of
states
![Page 24: CS 312: Algorithm Design & Analysis Lecture #34: Branch and Bound Design Options for Solving the TSP: Tight Bounds This work is licensed under a Creative.](https://reader036.fdocuments.in/reader036/viewer/2022062421/56649e595503460f94b52e49/html5/thumbnails/24.jpg)
Using this bound for TSP in B&B
999 1 999 0 999999 999 1 999 0999 0 999 1 999999 0 0 999 6
0 999 999 9 999
bound = 21 BSSF=30
Start at vertex 1 in graph (arbitrary)
What should our state expansion strategy be?
![Page 25: CS 312: Algorithm Design & Analysis Lecture #34: Branch and Bound Design Options for Solving the TSP: Tight Bounds This work is licensed under a Creative.](https://reader036.fdocuments.in/reader036/viewer/2022062421/56649e595503460f94b52e49/html5/thumbnails/25.jpg)
Using this bound for TSP in B&B
999 1 999 0 999999 999 1 999 0999 0 999 1 999999 0 0 999 6
0 999 999 9 999
999 1 999 0 999999 999 1 999 0999 0 999 1 999999 0 0 999 6
0 999 999 9 999
bound = 21
1-2 1-3 1-4 1-5
bound = 21+1
999 1 999 0 999999 999 1 999 0999 0 999 1 999999 0 0 999 6
0 999 999 9 999
Start at vertex 1 in graph (arbitrary)
bound = 21
BSSF=30
![Page 26: CS 312: Algorithm Design & Analysis Lecture #34: Branch and Bound Design Options for Solving the TSP: Tight Bounds This work is licensed under a Creative.](https://reader036.fdocuments.in/reader036/viewer/2022062421/56649e595503460f94b52e49/html5/thumbnails/26.jpg)
Focus: going from 1 to 2
999 999 999 999 999999 999 1 999 0999 999 999 1 999999 999 0 999 6
0 999 999 9 999
999 1 999 0 999999 999 1 999 0999 0 999 1 999999 0 0 999 6
0 999 999 9 999
bound = 21
1-2
bound = 22
1
2
3 4
50
00
1
1
0
0
01
96
1
2
3 4
5
01
1
0
01
96
Add extra cost from 1 to 2, exclude edges from 1 or into 2.
Before After
BSSF=30
![Page 27: CS 312: Algorithm Design & Analysis Lecture #34: Branch and Bound Design Options for Solving the TSP: Tight Bounds This work is licensed under a Creative.](https://reader036.fdocuments.in/reader036/viewer/2022062421/56649e595503460f94b52e49/html5/thumbnails/27.jpg)
999 999 999 999 999999 999 1 999 0999 999 999 1 999999 999 0 999 6
0 999 999 9 999
999 1 999 0 999999 999 1 999 0999 0 999 1 999999 0 0 999 6
0 999 999 9 999
bound = 21
bound = 22+1
1
2
3 4
50
00
1
1
0
0
01
96
1
2
3 4
5
01
1
0
01
96
No edges out of vertex 3 w/ 0 reduced cost.
Focus: going from 1 to 2
Before After
1-2
BSSF=30
![Page 28: CS 312: Algorithm Design & Analysis Lecture #34: Branch and Bound Design Options for Solving the TSP: Tight Bounds This work is licensed under a Creative.](https://reader036.fdocuments.in/reader036/viewer/2022062421/56649e595503460f94b52e49/html5/thumbnails/28.jpg)
999 999 999 999 999999 999 1 999 0999 999 999 0 999999 999 0 999 6
0 999 999 9 999
999 1 999 0 999999 999 1 999 0999 0 999 1 999999 0 0 999 6
0 999 999 9 999
bound = 21
bound = 22+1
1
2
3 4
5
01
0
0
01
96
Add cost of reducing edges out of vertex 3.
Focus: going from 1 to 2
1-2
BSSF=30
![Page 29: CS 312: Algorithm Design & Analysis Lecture #34: Branch and Bound Design Options for Solving the TSP: Tight Bounds This work is licensed under a Creative.](https://reader036.fdocuments.in/reader036/viewer/2022062421/56649e595503460f94b52e49/html5/thumbnails/29.jpg)
Two Possibilities on the Agenda
1
2
3 4
5
01
0
0
01
96
1
2
3 4
50
00
1 0
0
0
6
bound = 23 bound = 21
![Page 30: CS 312: Algorithm Design & Analysis Lecture #34: Branch and Bound Design Options for Solving the TSP: Tight Bounds This work is licensed under a Creative.](https://reader036.fdocuments.in/reader036/viewer/2022062421/56649e595503460f94b52e49/html5/thumbnails/30.jpg)
Bounds for other choices
999 999 999 999 999999 999 1 999 0999 999 999 0 999999 999 0 999 6
0 999 999 8 999
999 1 999 0 999999 999 1 999 0999 0 999 1 999999 0 0 999 6
0 999 999 9 999
bound = 21
bound = 23
999 999 999 999 999999 999 1 999 0999 0 999 999 999999 0 0 999 6
0 999 999 999 999
bound = 21
1-2(23),1-4(21)
1-2 1-3 1-4 1-5
Agenda:BSSF=30
![Page 31: CS 312: Algorithm Design & Analysis Lecture #34: Branch and Bound Design Options for Solving the TSP: Tight Bounds This work is licensed under a Creative.](https://reader036.fdocuments.in/reader036/viewer/2022062421/56649e595503460f94b52e49/html5/thumbnails/31.jpg)
Leaving Vertex 4
999 999 999 999 999999 999 1 999 0999 0 999 999 999999 0 0 999 6
0 999 999 999 999
bound = 21
1
2
3 4
50
00
1 0
0
0
6
999 999 999 999 999999 999 0 999 0999 999 999 999 999999 999 999 999 999
0 999 999 999 999
999 999 999 999 999999 999 999 999 0999 0 999 999 999999 999 999 999 999
0 999 999 999 999
999 999 999 999 999999 999 0 999 999999 0 999 999 999999 999 999 999 999
0 999 999 999 999
1-4-2 1-4-3 1-4-5
bound = 22 bound = 21 bound = 28
BSSF=301-4
![Page 32: CS 312: Algorithm Design & Analysis Lecture #34: Branch and Bound Design Options for Solving the TSP: Tight Bounds This work is licensed under a Creative.](https://reader036.fdocuments.in/reader036/viewer/2022062421/56649e595503460f94b52e49/html5/thumbnails/32.jpg)
Leaving Vertex 4
999 999 999 999 999999 999 1 999 0999 0 999 999 999999 0 0 999 6
0 999 999 999 999
bound = 21
1
2
3 4
50
00
1 0
0
0
6
999 999 999 999 999999 999 0 999 0999 999 999 999 999999 999 999 999 999
0 999 999 999 999
999 999 999 999 999999 999 999 999 0999 0 999 999 999999 999 999 999 999
0 999 999 999 999
999 999 999 999 999999 999 0 999 999999 0 999 999 999999 999 999 999 999
0 999 999 999 999
bound = 22 bound = 21 bound = 28
1-4-2(22), 1-4-3(21)1-4-5(28),1-2(23)
BSSF=301-4
1-4-2 1-4-3 1-4-5
Agenda:
![Page 33: CS 312: Algorithm Design & Analysis Lecture #34: Branch and Bound Design Options for Solving the TSP: Tight Bounds This work is licensed under a Creative.](https://reader036.fdocuments.in/reader036/viewer/2022062421/56649e595503460f94b52e49/html5/thumbnails/33.jpg)
Leaving Vertex 3
999 999 999 999 999999 999 999 999 0999 0 999 999 999999 999 999 999 999
0 999 999 999 999
bound = 21
1
2
3 4
50
00
0
0
999 999 999 999 999999 999 999 999 0999 999 999 999 999999 999 999 999 999
0 999 999 999 999
1-4-3-2
bound = 21
BSSF=301-4-3
![Page 34: CS 312: Algorithm Design & Analysis Lecture #34: Branch and Bound Design Options for Solving the TSP: Tight Bounds This work is licensed under a Creative.](https://reader036.fdocuments.in/reader036/viewer/2022062421/56649e595503460f94b52e49/html5/thumbnails/34.jpg)
Leaving Vertex 3
999 999 999 999 999999 999 999 999 0999 0 999 999 999999 999 999 999 999
0 999 999 999 999
bound = 21
999 999 999 999 999999 999 999 999 0999 999 999 999 999999 999 999 999 999
0 999 999 999 999
bound = 21
4-2(22), 3-2(21)4-5(28), 1-2(23),
BSSF=30
1-4-3-2
Agenda:
1-4-31
2
3 4
50
00
0
0
![Page 35: CS 312: Algorithm Design & Analysis Lecture #34: Branch and Bound Design Options for Solving the TSP: Tight Bounds This work is licensed under a Creative.](https://reader036.fdocuments.in/reader036/viewer/2022062421/56649e595503460f94b52e49/html5/thumbnails/35.jpg)
Search Tree for This Problem
b=21
b=23 b=21
b=22 b=21 b=28
b=21
1-to-2 1-to-4
4-to-2 4-to-3 4-to-5
3-to-2
2-to-5
![Page 36: CS 312: Algorithm Design & Analysis Lecture #34: Branch and Bound Design Options for Solving the TSP: Tight Bounds This work is licensed under a Creative.](https://reader036.fdocuments.in/reader036/viewer/2022062421/56649e595503460f94b52e49/html5/thumbnails/36.jpg)
Termination Criteria for a B&B Algorithm
Repeat until Agenda is empty Or time is up Or BSSF cost is equal to original LB
![Page 37: CS 312: Algorithm Design & Analysis Lecture #34: Branch and Bound Design Options for Solving the TSP: Tight Bounds This work is licensed under a Creative.](https://reader036.fdocuments.in/reader036/viewer/2022062421/56649e595503460f94b52e49/html5/thumbnails/37.jpg)
Assignment
HW #25: Compute bound for TSP instance using
today’s method Reason about search for TSP solution Due Wednesday!