Presentation is loading. Please wait.

Presentation is loading. Please wait.

Approximation Algorithms Guo QI, Chen Zhenghai, Wang Guanhua, Shen Shiqi, Himeshi De Silva.

Similar presentations


Presentation on theme: "Approximation Algorithms Guo QI, Chen Zhenghai, Wang Guanhua, Shen Shiqi, Himeshi De Silva."— Presentation transcript:

1 Approximation Algorithms Guo QI, Chen Zhenghai, Wang Guanhua, Shen Shiqi, Himeshi De Silva

2 Introduction Shen Shiqi

3 Definition Approximation Algorithm Return the solutions to optimization problem Comparison Approximation algorithm: provably close to optimal Heuristic: may or may not find a good solution

4 Background NP Problem A set of decision problems in which given a solution, you can check it in polynomial time. NP-hard Problem A problem is NP-hard if all other problems in NP can be polynomially reduced to it. At least as hard as the hardest problem in NP problems NP-complete Problem A problem is NP-complete if it is in NP and NP-hard. Approximation Ratio (approximation factor) Ratio between the result obtained by the algorithm and the optimal cost K-approximation algorithm

5 Steiner Tree Problem Assume we are given: a graph, edge weights, a set of required nodes R, a set of steiner nodes S. Assume that. The Steiner Tree Problem is to find a subset of the Steiner points and a spanning tree of minimum weight. The weight of Tree is defined to be:

6 3 variants of Steiner Tree Problem Euclidean weights refers to the Euclidean distance from u and v Metric a metric distance function d: VxV → R which satisfies the following properties: Non-negativity: for all u, v ∈ V, d(u, v)≥0 Identity: for all u ∈ V, d(u, u)=0 Symmetric: for all u, v ∈ V, d(u, v)=d(v, u) Triangle Inequality: for all u, v, w ∈ V, d(u, v)+d(v, w)≥d(u, w) General weights can be arbitrary

7 Steiner Tree Problem → Metric Steiner Tree Problem Theorem: There is an approximation factor preserving reduction from the Steiner tree problem to the metric Steiner tree problem. Proof: A instance I of the Steiner tree problem, consisting of graph G=(V,E) Generate a complete undirected graph G’ on vertex set V. The cost of edge (u,v) in G’ is the smallest cost of u-v path in G Find the Steiner Tree T’ in G’ Replace each edge (u,v) in T’ by corresponding path in G Delete edges if there are cycles ⇒ Obtain the Steiner Tree T for G

8 Minimum Spanning Tree Definition of Minimum Spanning Tree Given a graph G=(V, E) and edge weights, find a subset of the edges such that: the subgraph is a spanning tree the sum of edge weights is minimized.

9 Minimum Spanning Tree Kruskal’s algorithm create an empty set A for each vertex v in V : MAKE-SET(v) sort E in nondecreasing order by weight w for each (u, v) taken from the sorted list : if u and v are not in the same set : then add (u, v) into A UNION(u, v) if all nodes are in same set: break edgeaecdabbebceced weight1234567 A={} {a}, {b}, {c}, {d}, {e} a dbc e 3 1 5 4 6 7 2 A={(a,e)} {a,e}, {b}, {c}, {d} A={(a,e),(c,d)} {a,e}, {b}, {c,d} A={(a,e),(c,d),(a,b)} {a,e,b}, {c,d} A={(a,e),(c,d),(a,b),(b,c)} {a,e,b,c,d}

10 Minimum Spanning Tree vs. Steiner Tree a d c be 2 km 5 km a d c be 2 km 4 km 3 km D=17 km D=16 km

11 MST-based Approximation Algorithm Wang Guanhua

12 MST-based Approximation Algorithm Method : Perform minimum spanning tree(MST) algorithm on Required vertices without any steiner vertices. MST algorithms Kruskal O(m*log n) Prim O(n^2)

13 The cost of a MST on R is within 2*OPT Theorem : For a set of required nodes R, a set of Steiner nodes S, and a metric distance function d. Consider an Optimal Steiner Tree(R+S, d) of cost OPT. The cost of a minimum spanning tree of (R, d) is within 2*OPT. Cost(MST) ≤ 2*OPT

14 Euler tour & Eulerian Graph Euler tour : An Euler tour is a trail which starts and ends at the same graph vertex. In other words, it is a graph cycle which uses each graph edge exactly once. (Also named by Eulerian cycle, Eulerian circuit, Euler circuit, etc.) Eulerian Graph: An Eulerian graph is a graph containing an Euler tour. Theorem: A connected graph has an Euler tour if and only if it has no graph vertices of odd degree. degree = 3 (odd)

15 Hamiltonian cycle Hamiltonian cycle: Is a graph cycle through a graph that visits each node exactly once.

16 Proof of 2*OPT f e a c b h 1 1 1 1 1 1 1 1 ●An example: An undirected, complete graph Assume: All edges drawn have distance 1(e.g. d to f), All edges not drawn have distance 2 (e.g. a to e). Green nodes: Required vertices Red nodes: Steiner vertices d g

17 Proof of 2*OPT f e a c b h 1 1 1 1 1 1 1 1 ●An example: An undirected, complete graph Assume: All edges drawn have distance 1 (e.g. d to f), All edges not drawn have distance 2 (e.g. a to e). Green nodes: Required vertices Red nodes: Steiner vertices d g

18 Proof of 2*OPT f e a c b h 1 1 1 1 1 1 1 1 ●An example: An undirected, complete graph Assume: All edges drawn have distance 1(e.g. d to f), All edges not drawn have distance 2 (e.g. a to e). Green nodes: Required vertices Red nodes: Steiner vertices d g 2

19 Step 1: Optimal Steiner tree df e a cb gh 1 1 1 11 2 ●Optimal Steiner tree T. The cost is the sum of distance of all edges: 1 + 1 + 1+ 1 + 1 + 1 + 2 = 8 OPT=Cost(T) = 8 1 f e a c b h 1 1 1 1 1 1 1 1 d g

20 Step 2 df e a cb gh 1 1 1 1 1 2 ●Obtain an Eulerian graph by doubling edges. 1 df e a cb gh 1 1 1 1 2 1 doubling edges Eulerian graphOptimal steiner tree 1 1 1 1 1 1 1 2 OPT = 8 Cost(EG) = 16

21 Step 3 ●Find an Euler Tour by traversing edges of Eulerian graph in depth first search (DFS) order. df e a cb gh Eulerian tour

22 Step 3 ●Find an Euler Tour by traversing edges of Eulerian graph in depth first search (DFS) order. df e a cb gh Eulerian tour

23 Step 3 ●Find an Euler Tour by traversing edges of Eulerian graph in depth first search (DFS) order. df e a cb gh Eulerian tour

24 Step 3 ●Find an Euler Tour by traversing edges of Eulerian graph in depth first search (DFS) order. df e a cb gh Euler tour Cost(ET) = 16

25 Step 4 ●Remove Steiner vertices from Euler Tour df e a cb gh 1 1 1 1 1 2 1 df e a cb h 2 1 1 2 1 2 Remove g 1 1 1 1 1 2 1 1 2 (a,g)-> (g,d) (a,d) (d,g)-> (g,f) (d,f) (f,g)-> (g,a) (f,a) 1

26 Step 4 ●Remove Steiner vertices from Euler Tour df e a cb 2 2 2 Remove h df e a cb h 2 1 1 2 1 2 2 2 (a,h)-> (h,c) (a,c) (c,h)-> (h,b) (c,b) (b,h)-> (h,a) (b,a) 2 12 2 1 Cost = 15

27 Step 5 ●Obtain a Hamiltonian cycle by removing the duplicates. df e a cb 2 2 2 Remove duplicates 2 a -> d -> f -> a -> c -> b -> a -> e -> a 1 2 df e a cb 2 2 2 2 2 2 1 2 (f,a)-> (a,c) (f,c) (b,a)-> (a,e) (b,e) Hamiltonian cycle “Short-cutting” a -> d -> f -> c -> b -> e -> a

28 Step 5 ●Obtain a Hamiltonian cycle by removing the duplicates. df e a cb 2 2 2 Remove duplicates 2 a -> d -> f -> a -> c -> b -> a -> e -> a 1 2 df e a cb 2 2 2 2 2 2 1 2 (f,a)-> (a,c) (f,c) (b,a)-> (a,e) (b,e) Hamiltonian cycle “Short-cutting” a -> d -> f -> c -> b -> e -> a Because of triangle inequality, the shortcuts do not increase the cost.

29 Step 5 ●Obtain a Hamiltonian cycle by removing the duplicates. df e a cb 2 2 2 Remove duplicates 2 a -> d -> f -> a -> c -> b -> a -> e -> a 1 2 Cost (HC)= 11 df e a cb 2 2 2 2 2 2 1 2 Cost = 15 (f,a)-> (a,c) (f,c) (b,a)-> (a,e) (b,e) Hamiltonian cycle “Short-cutting” a -> d -> f -> c -> b -> e -> a

30 Step 6 ●Step 4: Remove any one arbitrary of the highest cost edge. It becomes to a spanning tree ST. df e a cb 2 2 Remove (a,e) 2 1 2 Cost (ST)= 9Cost(HC) = 11 df e a cb 2 2 2 2 1 2 Hamiltonian cycle Spanning Tree

31 Step 5 ●Step 4: Remove any one arbitrary of the highest cost edge. It becomes to a spanning tree ST. df e a cb 2 2 Remove (a,e) 2 1 2 Cost (ST)= 9Cost(HC) = 11 df e a cb 2 2 2 2 1 2 Hamiltonian cycle Spanning Tree Cost(MST) ≤ Cost (ST)

32 Conclusion ●Conclusion : The minimum spanning tree has cost at most twice the cost of the optimal spanning tree T. Cost(MST) ≤ cost(ST) ≤ cost(HC) ≤ 2*OPT Minimum spanning tree Hamiltonian cycle2*Optimal steiner tree Spanning tree Cost(MST) ≤ 2*OPT

33 Metric Travelling Salesman Problem Himeshi De Silva

34 The Travelling Salesman Problem (TSP) (A complete graph is a simple (no loops/multiple edges) undirected graph where every pair of distinct vertices is connected by a unique edge) (A tour is a path which visits all vertices of a graph and returns to its starting vertex) ❏ NP-Hard Given a complete graph G=(V, E) with non-negative edge costs, find a minimum cost tour visiting each vertex exactly once

35 TSP example Thick edges = 1, thin edges= 2 ➩ Cost of solution = 6 1 6 54 3 2 ❏ No constant factor approximation algorithm for TSP in general

36 Metric TSP ❏ Metric TSP - a relaxed version of the problem allows for approximation ❏ Assumption: The edges of the graph satisfy the triangle inequality Cost(6,4) ≤ Cost(6,5) + Cost(5,4) Still NP-complete, but no longer harder to approximate! 1 6 54 3 2

37 Factor 2 algorithm

38 Example: Step 1 1. Find an MST, T, of G. 1 6 54 3 2 1 6 54 3 2 ➩ Thick edges = 1, thin edges= 2

39 Example: Step 2 2. Double every edge in the MST to obtain an Eulerian graph 1 6 54 3 2

40 Example: Step 3 1→2→1→4→1→3→1→5→1→6→1 3. Find an Eulerian tour,, on the graph 1 6 54 3 2

41 Example: Step 4 T: 1→2→1→4→1→3→1→5→1→6→1 4. Output the tour that visits vertices of the graph in the order of their first appearance in. Let C be this tour. ⇓ C: 1→2→4→3→5→6→1 “Short-cutting” 1 6 54 3 2

42 Result C: 1→2→4→3→5→6→1 1 6 54 3 2 Cost of the tour = 1 + 2 + 1 + 2 + 1 + 1 = 8

43 Factor 2 Analysis Proof: (important observation) Delete any edge from an optimal solution to TSP forms a spanning tree. Cost(T) ≤ OPT (OPT - cost of optimal TSP solution)

44 Factor 2 Analysis Proof: Eulerian tour contains every edge of MST twice: Cost() = 2*Cost(T)

45 Factor 2 Analysis Proof: Eulerian tour contains every edge of MST twice: Cost() = 2*Cost(T) “Short-cutting” steps obey the triangular inequality: Cost(C) ≤ Cost()

46 Factor 2 Analysis Combining all, Cost(T) ≤ OPT Cost() = 2*Cost(T) ≤ 2*OPT Cost(C) ≤ Cost() Cost(C) ≤ 2*OPT

47 Improving the factor to 3/2 - Christofides’ Algorithm Chen Zhenghai

48 Improving the factor Double an MST -> Eulerian graph -> Eulerian tour -> Short-cutting Cheaper way to get Eulerian graph? A graph has an Euler tour iff all its vertices has even degrees Only need to be concerned about the odd degree vertices

49 Minimum weight perfect matching Perfect matching: Every vertex of the graph is incident to exactly one edge of the matching. Input GraphMinimum matching 1Minimum matching 2

50 Handshaking Lemma (Euler) The size of V ′ (odd degree vertices set) is even in undirected graph. Proof. Every edge contributes 2 degree. So the total degree is equal to 2|E|, which is even. Thus the number of odd degree vertices is also even.

51 Metric TSP —Christofides’ Algorithm 1. Find a MST, T, of G. 2. Let V′ be the vertices of odd degree in T. 3. Compute a minimum weight perfect matching M on V ′. 4. Let G′ = T ∪ M. The graph G′ is Eulerian 5. Find an Eulerian tour,, in G′ 6. Output the tour C that visits the vertices in the order of their first appearance in

52 Tight example for Christofides’ algorithm Input: complete graph whose edge weights obey the triangle inequality

53 Tight example for Christofides’ algorithm 1. Find a MST, T, of G.

54 Tight example for Christofides’ algorithm 1. Find a MST, T, of G. 2. Let V′ be the vertices of odd degree in T.

55 Tight example for Christofides’ algorithm 1. Find a MST, T, of G. 2. Let V′ be the vertices of odd degree in T. 3. Compute a minimum weight perfect matching M on V ′.

56 Tight example for Christofides’ algorithm 1. Find a MST, T, of G. 2. Let V′ be the vertices of odd degree in T. 3. Compute a minimum weight perfect matching M on V ′.

57 Tight example for Christofides’ algorithm 1. Find a MST, T, of G. 2. Let V′ be the vertices of odd degree in T. 3. Compute a minimum weight perfect matching M on V ′. 4. Let G′ = T ∪ M. The graph G′ is Eulerian

58 Tight example for Christofides’ algorithm 5. Find an Eulerian tour,, in G′ D -> E -> A -> B -> C -> A -> D

59 Tight example for Christofides’ algorithm 5. Find an Eulerian tour, π, in G′ 6. Output the tour C that visits the vertices in the order of their first appearance in π D -> E -> A -> B -> C -> A -> D ----------------------------------------- D -> E -> A -> B -> C -> D

60 Cont’d Theoretical Analysis and Applications Guo Qi

61 Metric TSP - Factor 3/2 Lemma Let V’ ⊆ V, such that |V’| is even, and let M be a minimum cost perfect matching on V’. Then, Cost(M) ≤ OPT/2. Proof: (Similar technique: “short-cutting”) Consider an optimal TSP tour of G, let ’ be the tour on V’ obtained by short-cutting TSP tour. By triangle inequality: Cost(’) ≤ OPT.

62 Note ’ is the union of two perfect matchings on V’. At least one of the matchings has cost ≤ OPT/2. Thus, Cost(M) ≤ OPT/2. Metric TSP - Factor 3/2

63 Proof: MST lower bound:Cost(T) ≤ OPT. Perfect Matching lower bound:Cost(M) ≤ OPT/2. Hence, Cost() = Cost(T) + Cost(M) ≤ 3/2* OPT. Last, after short-cutting, Cost(C) ≤ Cost() ≤ 3/2* OPT.

64 Applications - Productions of PCBs Printed Circuit Board (PCB) ●Problems: Logical Design, Physical Design Correctness, Placement of Components, Drilling, … ●Example: 442 holes to drill

65 Applications - Productions of PCBs Correct modelling of a printed circuit board drilling problem: Optimize length of a move of the drilling head http://www.math.uwaterloo.c a/tsp/vlsi/index.html Applications - Productions of PCBs

66 Significant Improvements via TSP (Padberg & Rinaldi) BeforeAfter

67 Applications - Productions of PCBs Simens-Problem PCB da1

68 Applications - Tour Route Design http://gebweb.net/optimap/ https://itunes.apple.com/us/app/concor de-tsp/id498366515?mt=8

69 Appendix

70 Lower bound on TSP solution ❏ The lower bound is the cost of an MST in the graph ❏ Deleting any edge from an optimal solution to TSP gives us a spanning tree of the graph i.e. cost of MST ≤ cost of TSP solution If approximation ratio is 2, cost of solution ≤ 2*cost of MST ≤ 2*cost of TSP solution

71 Approximation of TSP For any polynomial time computable function ɑ (n), TSP cannot be approximated within a factor ɑ (n) of unless P = NP Proof As contradiction assume that there exists a factor ɑ (n) polynomial time approximation algorithm. We show that such an algorithm can be used to solve the Hamiltonian cycle problem (Given a graph decide whether a Hamiltonian cycle exists) Hamiltonian cycle - a cycle in an undirected or directed graph that visits each vertex exactly once The Hamiltonian cycle problem H, can be transformed into the TST G as follows.

72 Approximation of TSP contd. If H has no tour, then any tour T of G has cost cost(T) > ɑ (n).n. This includes the tour found by the approximation algorithm. If H has a tour, then G has a tour T* with cost(T*) = n. Since the algorithm is a ɑ (n) - approximation algorithm, it produces a tour T with cost(T) ≤ ɑ (n).n Clearly T is also a tour in H, since it can not traverse any edge with cost ɑ (n).n in G. Therefore, the algorithm is a polynomial time algorithm which can be used to decide the Hamilton Cycle problem contradicting P ≠ NP.

73 Time complexity of Factor 2 algorithm Complexity Analysis: O(m*log n) Kruskal’s Algo O(m) DFS Constant O(m) m: number of edges; n: number of nodes;

74 Complexity Analysis: Metric TSP - Factor 3/2 O(m*log n) Kruskal’s Algo O(n’^4) Blossom Algo DFS O(m) m: number of edges; n: number of nodes; n’: number of nodes in V’;

75

76

77

78

79

80

81

82


Download ppt "Approximation Algorithms Guo QI, Chen Zhenghai, Wang Guanhua, Shen Shiqi, Himeshi De Silva."

Similar presentations


Ads by Google