60 likes | 70 Views
This article discusses how branch and bound algorithms can be used to find optimal solutions for NP-Hard problems, with a focus on the Traveling Salesperson Problem (TSP). The algorithm is designed to run fast in the average case, although it still exhibits exponential time complexity in the worst case.
E N D
Data Structures and Algorithms for Information Processing • Preliminary exercise • Branch and bound and TSP • Find an optimal solution to an NP Hard problem that runs fast in the average case. • Still exponential time in the worst case. From Data Structures and Algorithms, Aho, Hopcroft & Ullman
Hamiltonian Cycle • AHamiltonian pathis a path in an undirected or directed graph that visits each vertex exactly once. A Hamiltonian cycle (or Hamiltonian circuit) is a Hamiltonian path that is a cycle. • Determining whether such paths and cycles exist in graphs is the Hamiltonian path problem, which is NP-complete. From Data Structures and Algorithms, Aho, Hopcroft & Ullman
Preliminary In Class Exercise • Put your name on a piece of paper • Construct a complete undirected graph with 4 vertices labelled a,b,c,d. Show your instructor. • How many edges are there? • Create a set S with these edges. • How many subsets of S are there? • Draw a decision tree that represents the decisions you need to make in order to construct one of the subsets of S. • How many leaves are there? • Which paths from the root to the leaves could be Hamiltonian cycle? From Data Structures and Algorithms, Aho, Hopcroft & Ullman
Traveling Salesperson Problem (TSP) 3 3 a b 4 4 7 2 6 8 e c 5 6 No tour can cost less than one half the sum over all nodes n of the two lowest cost edges incident upon n. Lower bound = (5+6+8+7+9)/2 = 17.5 d From Data Structures and Algorithms, Aho, Hopcroft & Ullman
Traveling Salesperson Problem (TSP) 3 3 a b 4 4 7 2 6 8 e c 5 6 Suppose we are constrained to include (a,e) and exclude (b,c). Lower bound = (9+6+9+7+10)/2 = 20.5 d From Data Structures and Algorithms, Aho, Hopcroft & Ullman
A 17.5 no constraints AAAA B17.5 ab C 18.5 ∼(ab) E 18 ∼(ac) D 20.5 ac ∼(ad) ∼(ae) K 21 ∼(ac) ad ae J 18.5 ac M 23.5 ∼(ad) ae Pruned after Discovery of I F 18 ad ∼(ae) G23 ∼(ad) ae L 18.5 ad ∼(ae) pruned P ∼(bc) bd be ce ∼(de) ∼(cd) tour ace bda cost = 23 N bc∼(cd) ∼(ce) ∼(bd) de be tour acbeda cost = 19 H bc∼(bd) ~(be) ce de ∼(cd) tour abceda cost = 23 I ∼(bc) cd ce ∼(bd) de be tour abecda cost = 21 Pruned after discovery of I Fig. 10.22. Search tree for TSP solutions From Data Structures and Algorithms, Aho, Hopcroft & Ullman