Approximation Algorithms

Slides:



Advertisements
Similar presentations
Instructor Neelima Gupta Table of Contents Approximation Algorithms.
Advertisements

Design and Analysis of Algorithms Approximation algorithms for NP-complete problems Haidong Xue Summer 2012, at GSU.
Great Theoretical Ideas in Computer Science for Some.
Reducibility Class of problems A can be reduced to the class of problems B Take any instance of problem A Show how you can construct an instance of problem.
Approximation Algorithms for TSP
1 The TSP : Approximation and Hardness of Approximation All exact science is dominated by the idea of approximation. -- Bertrand Russell ( )
© The McGraw-Hill Companies, Inc., Chapter 8 The Theory of NP-Completeness.
Combinatorial Algorithms
Lecture 21 Approximation Algorithms Introduction.
Chapter 10 Complexity of Approximation (1) L-Reduction Ding-Zhu Du.
Great Theoretical Ideas in Computer Science.
1 Discrete Structures & Algorithms Graphs and Trees: II EECE 320.
Approximation Algorithms: Combinatorial Approaches Lecture 13: March 2.
The Evolution Trees From: Computational Biology by R. C. T. Lee S. J. Shyu Department of Computer Science Ming Chuan University.
Approximation Algorithms: Concepts Approximation algorithm: An algorithm that returns near-optimal solutions (i.e. is "provably good“) is called an approximation.
1 Optimization problems such as MAXSAT, MIN NODE COVER, MAX INDEPENDENT SET, MAX CLIQUE, MIN SET COVER, TSP, KNAPSACK, BINPACKING do not have a polynomial.
The Theory of NP-Completeness
E.G.M. PetrakisAlgorithms and Complexity1 The sphere of algorithmic problems.
Approximation Algorithms for the Traveling Salesperson Problem.
NP-Complete Problems (Fun part)
9-1 Chapter 9 Approximation Algorithms. 9-2 Approximation algorithm Up to now, the best algorithm for solving an NP-complete problem requires exponential.
9-1 Chapter 9 Approximation Algorithms. 9-2 Approximation algorithm Up to now, the best algorithm for solving an NP-complete problem requires exponential.
Network Optimization Problems: Models and Algorithms
Approximation Algorithms Motivation and Definitions TSP Vertex Cover Scheduling.
1 NP-Complete Problems (Fun part) Polynomial time vs exponential time –Polynomial O(n k ), where n is the input size (e.g., number of nodes in a graph,
Approximation Algorithms
1 Traveling Salesman Problem Algorithms and Networks 2014/2015 Hans L. Bodlaender Johan M. M. van Rooij.
Algorithms for Network Optimization Problems This handout: Minimum Spanning Tree Problem Approximation Algorithms Traveling Salesman Problem.
1 Introduction to Approximation Algorithms. 2 NP-completeness Do your best then.
The Traveling Salesperson Problem Algorithms and Networks.
Chapter 12 Coping with the Limitations of Algorithm Power Copyright © 2007 Pearson Addison-Wesley. All rights reserved.
The Traveling Salesman Problem Approximation
University of Texas at Arlington Srikanth Vadada Kishan Kumar B P Fall CSE 5311 Solving Travelling Salesman Problem for Metric Graphs using MST.
1 Introduction to Approximation Algorithms. 2 NP-completeness Do your best then.
Advanced Algorithm Design and Analysis (Lecture 13) SW5 fall 2004 Simonas Šaltenis E1-215b
Great Theoretical Ideas in Computer Science.
Approximation Algorithms for Knapsack Problems 1 Tsvi Kopelowitz Modified by Ariel Rosenfeld.
Chapter 15 Approximation Algorithm Introduction Basic Definition Difference Bounds Relative Performance Bounds Polynomial approximation Schemes Fully Polynomial.
Approximation Algorithms
Princeton University COS 423 Theory of Algorithms Spring 2001 Kevin Wayne Approximation Algorithms These lecture slides are adapted from CLRS.
The Traveling Salesman Problem Over Seventy Years of Research, and a Million in Cash Presented by Vladimir Coxall.
CSE 589 Part VI. Reading Skiena, Sections 5.5 and 6.8 CLR, chapter 37.
Unit 9: Coping with NP-Completeness
1 Approximation Algorithm Updated on 2012/12/25. 2 Approximation Algorithm Up to now, the best algorithm for solving an NP-complete problem requires exponential.
Approximation Algorithms for TSP Tsvi Kopelowitz 1.
“One ring to rule them all” Analogy (sort of) Lord of The Rings Computational Complexity “One problem to solve them all” “my preciousss…”
Approximation Algorithms Guo QI, Chen Zhenghai, Wang Guanhua, Shen Shiqi, Himeshi De Silva.
Approximation Algorithms by bounding the OPT Instructor Neelima Gupta
Instructor Neelima Gupta Table of Contents Introduction to Approximation Algorithms Factor 2 approximation algorithm for TSP Factor.
Traveling Salesman Problem DongChul Kim HwangRyol Ryu.
1 Minimum Spanning Tree: Solving TSP for Metric Graphs using MST Heuristic Soheil Shafiee Shabnam Aboughadareh.
TU/e Algorithms (2IL15) – Lecture 11 1 Approximation Algorithms.
Hard Problems Some problems are hard to solve.
Optimization problems such as
Approximation Algorithms
Hamiltonian Cycle and TSP
Hamiltonian Cycle and TSP
Great Theoretical Ideas in Computer Science
Approximation Algorithms
Approximation Algorithms
Heuristics Definition – a heuristic is an inexact algorithm that is based on intuitive and plausible arguments which are “likely” to lead to reasonable.
Approximation Algorithms for TSP
Discrete Mathematics for Computer Science
Richard Anderson Lecture 28 Coping with NP-Completeness
Approximation Algorithms
The Traveling Salesperson Problem
Approximation Algorithms
Lecture 24 Vertex Cover and Hamiltonian Cycle
Presentation transcript:

Approximation Algorithms Pasi Fränti 20.10.2014

Approximation algorithms Optimal algorithm too slow Heuristic algorithm too uncertain Provide result with guarantee:

Bin packing problem Consider a set of bins (capacity 1) and a set of items xi of size wi[0,1]. GOAL: pack the items into as few bins as possible Finding the optimal solution is a NP-hard problem (exponential time)

1-approximation algorithm! Bin packing example Greedy algorithm Items: [0.4, 0.7, 0.5, 0.2, 0.9, 0.6] 0.9 0.9 1.0 0.9 0.7 0.6 0.4 1-approximation algorithm!

Traveling Salesman Problem ASSUMPTION: All pairwise distances exist and they obey triangular inequality: w(a,c) ≤ w(a,b)+w(b,c) GOAL: find the shortest possible route that visits each city once and returns to the origin city Finding optimal route is slow (NP-hard)

Approximation algorithm TSP-appro(V, E) T  MST(V, E); R  WALK-OF-TREE(T); //depth-first  A-B-C-B-H-B-A-D-E-F-E-G-E-D-A S  SHORTCUTS(R); // skip redundant  A-B-C-H-D-E-F-G-A A D E B F G C H

Algorithm example Graph with N=8 nodes F H C B 7

Algorithm example Minimum spanning tree 2 A D E G F H C B 11.9 2 2 2 2 2 5 8

Algorithm example Tree traversal 2 A D E G F H C B 23.8 2 2 2 2 2 2 2 2 2 2 5 2 5 A-B-C-B-H-B-A-D-E-F-E-G-E-D-A 9

Algorithm example Shortcuts D E G F H C B 19.1 20 2 2 2 17 2 2 5 A-B-C-B-H-B-A-D-E-F-E-G-E-D-A 10

Algorithm example Final result D E G F H C B 19.1 A-B-C-H-D-E-F-G-A 11

Analysis of error bound 1-approximation algorithm Tree traversal includes all edges twice: Cutting one link from TSP is spanning tree, but not necessarily the minimum: Tree traversal includes all edges twice:

Christofides algorithm Christofides(V, E) T  MST(V, E); Find Euler tour: D  FindOddNodes(T); M  PerfectMatch(D); H  T+M; R  EulerTour(H); S  SHORTCUTS(R);

Christofides example Minimum spanning tree 2 A D E G F H C B 11.9 2 2 2 2 2 5 14

Christofides example Detect the nodes with odd degree B 15

Christofides example Matching the nodes B 2 2 5 16

Christofides example Merging MST and the matching B 17

Christofides example Euler tour 2 A D E G F H C B 17.0 2 2 2 2 2 2 5 2 5 A-B-C-B-H-F-E-G-E-D-A 18

Christofides example Shortcuts 2 A D E G F H C B 15.5 2∙2 2 2 2 2 5 5 A-B-C-B-H-F-E-G-E-D-A 19

Christofides example Shortcuts G F H C B 20

Error bounds for Christofides MST + Matching Christofides produces TSP which is at most 50% longer than the optimum: Proof: The algorithm combines MST with the minimum-weight perfect matching: Shortcuts can only shorten the tour. 21

Error bounds for Christofides Links from matching Let v1, v2, …, v2m be the odd nodes of T. Skipping the rest of the nodes in TSP gives path that consists of two matchings: M1 ={(v1, v2), …, (v2m-1, v2m)} M2 ={(v2, v3), …, (v2m, v1)} Odd nodes Due to optimality of matching: TSP v1 v2 v3 v4 v2m v2m-1 … Links complementing tour Links from matching

Error bounds for Christofides 0.5-approximation algorithm Cutting one link from TSP is spanning tree, but not necessarily the minimum: Combining this with the matching: Thus we have:

Empty space for notes

Pseudo polynomial knapsack Input: Weight of N items {w1, w2, ..., wn} Cost of N items {c1, c2, ..., cn} Knapsack limit s Goal: Select for knapsack: {x1,x2,…xn} so that Problem is NP hard Pseudo polynomial solution exist Used for approximation algorithm

Pseudo polynomial knapsack Dynamic programming algorithm KNAPSACK (c[1,n], w[1,n], s} RETURNS x[1,n] R  {(∅,0)} FOR i 1 TO n DO FOR (S,c)  R DO IF ΣjS wj+wi ≤ s THEN R  R∪{(S∪{i},c+ci)} FOR (S,c), (S’,c)  R DO IF ΣjS wj ≤ ΣjS’ wj THEN R  R\{(S’,c)} ELSE R  R\{(S,c)} (S,c)  (S,c’)R for which c’ is max! FOR i1 TO n DO IF iS THEN x[i]1 ELSE x[i]0 RETURN x; Include if item fits in If same cost prune out weaker solution New comby

Pseudo polynomial knapsack Time complexity Sample input: wi={1,1,2,4,12} ci ={1,2,2,10,4} s=15 All combinations: ∅ {1} {2} {1,2} {3} {1,3} {2,3} {1,2,3} … 1 2 3 Time complexity: O(nc) where c = cost of optimal solution …but

Approximation algorithm Scaling the input Original input: Scale down input Modified input: Solve by DP Solve by DP wi ={1,1,2,4,12} ci ={1,2,2,10,4} S =15 wi ={1,1,2,4,12} ci/d ={1,1,1,5,2} S =15

Approximation algorithm Error bound Optimal for original Optimal for scaled ∙ d/d Truncate xi optimal for scaled and thus bigger z ≥ z-1 = c Σyi≤ n

Approximation algorithm nd/c-approximation algorithm Result of algorithm: Optimal result: Revise Choosing d = ε∙c/n, we can get any ε-approximation Value c is not known but upper limited: c ≤ n∙cmax Time complexity: Note:

Empty space for notes 1 2 4 A B C D 3 4 1 3 E F ?

Acknowledgements Contributions by Sharon Guardado and Pekka T. Kilpeläinen to TSP example and its proof appreciated.