Presentation for use with the textbook, Algorithm Design and Applications, by M. T. Goodrich and R. Tamassia, Wiley, Approximation Algorithms

Similar documents
Matching 4/21/2016. Bipartite Matching. 3330: Algorithms. First Try. Maximum Matching. Key Questions. Existence of Perfect Matching

Approximation Algorithms

COMP 355 Advanced Algorithms Approximation Algorithms: VC and TSP Chapter 11 (KT) Section (CLRS)

Partha Sarathi Mandal

Unit 8: Coping with NP-Completeness. Complexity classes Reducibility and NP-completeness proofs Coping with NP-complete problems. Y.-W.

Traveling Salesman Problem (TSP) Input: undirected graph G=(V,E), c: E R + Goal: find a tour (Hamiltonian cycle) of minimum cost

CS 4407 Algorithms. Lecture 8: Circumventing Intractability, using Approximation and other Techniques

NP Completeness. Andreas Klappenecker [partially based on slides by Jennifer Welch]

35 Approximation Algorithms

Assignment 5: Solutions

CMSC 451: Lecture 22 Approximation Algorithms: Vertex Cover and TSP Tuesday, Dec 5, 2017

Notes for Lecture 24

Approximation Algorithms

CS270 Combinatorial Algorithms & Data Structures Spring Lecture 19:

Greedy algorithms Or Do the right thing

APPROXIMATION ALGORITHMS FOR GEOMETRIC PROBLEMS

Approximation Algorithms

Theorem 2.9: nearest addition algorithm

1 Minimum Spanning Trees (MST) b 2 3 a. 10 e h. j m

Best known solution time is Ω(V!) Check every permutation of vertices to see if there is a graph edge between adjacent vertices

Module 6 NP-Complete Problems and Heuristics

Module 6 P, NP, NP-Complete Problems and Approximation Algorithms

Lecture 8: The Traveling Salesman Problem

Coping with NP-Completeness

Lecture 13. Reading: Weiss, Ch. 9, Ch 8 CSE 100, UCSD: LEC 13. Page 1 of 29

val(y, I) α (9.0.2) α (9.0.3)

Design and Analysis of Algorithms

Algorithm Design and Analysis

1 The Traveling Salesperson Problem (TSP)

Module 6 NP-Complete Problems and Heuristics

Coping with the Limitations of Algorithm Power Exact Solution Strategies Backtracking Backtracking : A Scenario

Travelling Salesman Problem. Algorithms and Networks 2015/2016 Hans L. Bodlaender Johan M. M. van Rooij

Module 6 NP-Complete Problems and Heuristics

Traveling Salesman Problem. Algorithms and Networks 2014/2015 Hans L. Bodlaender Johan M. M. van Rooij

More NP-complete Problems. CS255 Chris Pollett May 3, 2006.

Introduction to Approximation Algorithms

Autumn Minimum Spanning Tree Disjoint Union / Find Traveling Salesman Problem

CSE 548: Analysis of Algorithms. Lecture 13 ( Approximation Algorithms )

COMP Analysis of Algorithms & Data Structures

Approximation Algorithms

Announcements Problem Set 5 is out (today)!

COP 4531 Complexity & Analysis of Data Structures & Algorithms


Minimum Spanning Trees

(Refer Slide Time: 01:00)

1 The Traveling Salesman Problem

Chapter 9 Graph Algorithms

Chapter 9 Graph Algorithms

University of New Mexico Department of Computer Science. Final Examination. CS 362 Data Structures and Algorithms Spring, 2006

CMSC Introduction to Algorithms Spring 2012 Lecture 16

CS261: A Second Course in Algorithms Lecture #16: The Traveling Salesman Problem

Technische Universität München, Zentrum Mathematik Lehrstuhl für Angewandte Geometrie und Diskrete Mathematik. Combinatorial Optimization (MA 4502)

Introduction to Algorithms

1 Variations of the Traveling Salesman Problem

CSE 100 Minimum Spanning Trees Prim s and Kruskal

CSE331 Introduction to Algorithms Lecture 15 Minimum Spanning Trees

Theory of Computing. Lecture 10 MAS 714 Hartmut Klauck

Chapter 9. Greedy Technique. Copyright 2007 Pearson Addison-Wesley. All rights reserved.

Approximation Algorithms

Euler and Hamilton paths. Jorge A. Cobb The University of Texas at Dallas

Decision Problems. Observation: Many polynomial algorithms. Questions: Can we solve all problems in polynomial time? Answer: No, absolutely not.

Fall CS598CC: Approximation Algorithms. Chandra Chekuri

Stanford University CS261: Optimization Handout 1 Luca Trevisan January 4, 2011

Chapter 9 Graph Algorithms

An O(log n/ log log n)-approximation Algorithm for the Asymmetric Traveling Salesman Problem

Slides on Approximation algorithms, part 2: Basic approximation algorithms

3 Euler Tours, Hamilton Cycles, and Their Applications

11/22/2016. Chapter 9 Graph Algorithms. Introduction. Definitions. Definitions. Definitions. Definitions

1 Better Approximation of the Traveling Salesman

Optimal tour along pubs in the UK

CSE 100: B+ TREE, 2-3 TREE, NP- COMPLETNESS

Outline. CS38 Introduction to Algorithms. Approximation Algorithms. Optimization Problems. Set Cover. Set cover 5/29/2014. coping with intractibility

Chapter Design Techniques for Approximation Algorithms

Minimum spanning trees

NP-Complete Problems

Questions? You are given the complete graph of Facebook. What questions would you ask? (What questions could we hope to answer?)

15-451/651: Design & Analysis of Algorithms November 4, 2015 Lecture #18 last changed: November 22, 2015

CAD Algorithms. Categorizing Algorithms

Lecture 24: More Reductions (1997) Steven Skiena. skiena

Constructive and destructive algorithms

Question Points Score TOTAL 55 TOTAL (Calibrated) 50

1 The Traveling Salesman Problem

Introduction to Optimization

Minimum-Spanning-Tree problem. Minimum Spanning Trees (Forests) Minimum-Spanning-Tree problem

Lecture 1. 2 Motivation: Fast. Reliable. Cheap. Choose two.

The k-center problem Approximation Algorithms 2009 Petros Potikas

Spanning Trees 4/19/17. Prelim 2, assignments. Undirected trees

Spanning Trees. Lecture 22 CS2110 Spring 2017

NP-complete Reductions

Basic Approximation algorithms

Approximation Algorithms

23.2 Minimum Spanning Trees

What is a minimal spanning tree (MST) and how to find one

Institute of Operating Systems and Computer Networks Algorithms Group. Network Algorithms. Tutorial 4: Matching and other stuff

NP-Hard (A) (B) (C) (D) 3 n 2 n TSP-Min any Instance V, E Question: Hamiltonian Cycle TSP V, n 22 n E u, v V H

Spanning Trees, greedy algorithms. Lecture 22 CS2110 Fall 2017

V1.0: Seth Gilbert, V1.1: Steven Halim August 30, Abstract. d(e), and we assume that the distance function is non-negative (i.e., d(x, y) 0).

Prove, where is known to be NP-complete. The following problems are NP-Complete:

Department of Computer Applications. MCA 312: Design and Analysis of Algorithms. [Part I : Medium Answer Type Questions] UNIT I

Lecture 1. Introduction

Transcription:

Presentation for use with the textbook, Algorithm Design and Applications, by M. T. Goodrich and R. Tamassia, Wiley, 2015 Approximation Algorithms 1

Bike Tour Suppose you decide to ride a bicycle around Ireland you will start in Dublin the goal is to visit Cork, Galway, Limerick, and Belfast before returning to Dublin What is the best itinerary? how can you minimize the number of kilometers yet make sure you visit all the cities?

Optimal Tour If there are only 5 cities it s not too hard to figure out the optimal tour the shortest path is most likely a loop any path that crosses over itself will be longer than a path that travels in a big circle

Exhaustive Search: Too Many Tours There is a problem with the exhaustive search strategy the number of possible tours of a map with n cities is (n 1)! / 2 n! is the product n (n 1) (n 2)... 2 1 The number of tours grows incredibly quickly as we add cities to the map #cities #tours 5 12 6 60 7 360 8 2,520 9 20,160 10 181,440 The number of tours for 25 cities: 310,224,200,866,619,719,680,000

The Traveling Salesman Computer scientists call the problem of finding an optimal path between n points the traveling salesman problem (TSP) The TSP is a famous problem first posed by Irish mathematician W. R. Hamilton in the 19th century intensely studied in operations research and other areas since 1930 This tour of 13,500 US cities was generated by an advanced algorithm that used several tricks to limit the number of possible tours Required 5 CPU-years http://www.tsp.gatech.edu/

Dealing with Hard Combinatorial Problems (CP) 1. For many Combinatorial Problems (CP), not all instances are hard to solve. Some special cases can be solved easily, e.g, graph coloring is hard, but trees can be two-colored easily. 2. For small problems, it may be possible to solve them using backtracking search or branch-andbound algorithms. 3. Look for good-enough approximate solutions. 4. Use random algorithms to find solutions with high probability.

Bin Packing Bin Packing Problem The bins (capacity 1) 1.7.2.4.2.1.6.2.4.2.1.6.7 Items to be packed

Bin Packing Bin Packing Problem 1.7.2.4.2.1.6 Optimal Packing.2.7.1.4.6.2 Optimal solution: C* = 4

First Fit Packing Algorithm Bin Packing Problem.7.2.4.2.1.6.1.2.6.7.4.2 Optimal solution: C* = 4 First Fit Packing Algorithm (FF): For each item s i, find the first bin (from left to right) which can hold s i..1.2 FF solution: C = 5.7.2.4.6 C C * 2

Best Fit Packing Algorithm Bin Packing Problem.7.2.4.2.1.6 Best Fit Packing Algorithm (BF): For each item s i, find the most-full bin which can hold s i..1.2 BF solution: C = 5.7.2.4.6 C C * 2

First Fit Decreasing Packing Algorithm Bin Packing Problem.7.2.4.2.1.6 First Fit Decreasing (FFD): First sort the items in decreasing order, then apply FF..7.6.4.2.2.1.1.2.7.4.6.2 FFD solution: C = C* = 4 C C * 2

Best Fit Decreasing Packing Algorithm Bin Packing Problem.7.2.4.2.1.6 Best Fit Decreasing (BFD): First sort the items in decreasing order, then apply BF..7.6.4.2.2.1.1.2.7.4.6.2 BFD solution: C = C* = 4 C C * 2

Next Fit Packing Algorithm Bin Packing Problem.7.2.4.2.1.6.2.7.1.4.6.2 C* = 4 Next Fit Packing Algorithm: If the current bin cannot hold s i, start a new bin (good for online application)..7.2.2.4.1.6 C = 6

Bin Packing Approximation Algorithms: Not always optimal solution, but with some performance guarantee (eg, no worst than twice the optimal) Even though we don t know what the optimal solution is!!!

Approximation Terminology Given an instance I of an optimization problem, let C * = OPT(I) be the cost of an optimal solution, and let C be the cost of the solution of an approximation algorithm. The algorithm has an approximation ratio of ρ(n) if, for all solutions max(c/c *,C * /C) ρ(n). We say that an approximation algorithm with an approximation ration of ρ(n) is a ρ(n)- approximation algorithm.

Approximation Terminology (2) An approximation scheme is an approximation algorithm that takes an instance and an ε > 0, and produces a (1+ε) approximation (ρ(n) = 1+ε). If an approximation scheme runs in polynomial time in the size its input when given any ε, we say it is a polynomial-time approximation scheme. Note that the running time could still increase rapidly as ε decreases.

Approximate Bin Packing Algorithms: C* = OPT(I), C is the approximate cost 1 B 1 B 2 B 3 B C-1 B C s(b 1 )+s(b 2 ) > 1 s(b 2 )+s(b 3 ) > 1 s i = s(b i ): total size of items in B i Let s 1 + s 2 + + s m = S Then C* S From 2S > C 1 We have 2C* 2S C s(b C-1 )+s(b C ) > 1 s(b 1 ) > 0, s(b C ) > 0 2(s(B 1 )+s(b 2 )+ + s(b C )) > C 1 Or 2S > C 1

Approximate Bin Packing Algorithms Theorem First-Fit: C 17/10C* + 2 First-Fit Decreasing: C 11/9C* + 4

Vertex Cover Problem Let G=(V, E). The subset S of V that meets every edge of E is called the vertex cover. The Vertex Cover problem is to find a vertex cover of the minimum size. It is a hard COP. 19

20 Examples of vertex cover

Approximating Vertex Cover The following algorithm is a 2-approximation algorithm for the vertex-cover optimization problem: Choose an edge e from G. Add both e s endpoints (say u and v) to the vertex cover. Remove all edges incident to u and v. Repeat while there are edges left.

APPROX_VERTEX_COVER(G) 1 C 2 E' E( G) 3 while E' 4 do let ( u, v ) be an arbitrary edge of E' 5 C C { u, v} 6 remove from E' every edge incident on either u or v 7 return C

a d e c b g f a d e c b g f a d e c b g f a d e c b g f a d e c b g f a d e c b g f C = 6, C* = 3 Complexity: O(E) Optimal solution Approx. solution

Theorem C*: the size of optimal solution C: the size of approximate solution A: the set of edges selected in step 4 APPROX_VERTEX_COVER has ratio bound of 2. Proof. Let A be the set of selected edges. C 2 A A C * When one edge is selected, 2 vertices are added into C. No two edges in A share a common endpoint due to step 6. C 2C *

Vertex Cover: Greedy Algorithm 2 Idea: Keep finding a vertex which covers the maximum number of edges. Greedy Algorithm 2: 1. Find a vertex v with maximum degree. 2. Add v to the solution and remove v and all its incident edges from the graph. 3. Repeat until all the edges are covered. How good is this algorithm? 25

Vertex Cover: Greedy Algorithm 2 OPT = 6, all red vertices. SOL = 11, if we are unlucky in breaking ties. First we might choose all the green vertices. Then we might choose all the blue vertices. And then we might choose all the orange vertices. 26

Vertex Cover: Greedy Algorithm 2 k! vertices of degree k Not a constant factor approximation algorithm! Generalizing the example! k!/k vertices of degree k k!/(k-1) vertices of degree k-1 k! vertices of degree 1 OPT = k!, all top vertices. SOL = k! (1/k + 1/(k-1) + 1/(k-2) + + 1) k! log(k), all bottom vertices. 27

Euclidian Traveling Salesman Problem The costs in the traveling salesman problem do not need to represent distances (e.g., they may be things like airline fares). If the costs do represent geometric distances, they obey the triangle inequality for all vertices u, v, and w: c(u,w) c(u,v) + c(v,w) The problem remains very hard. b 5 4 a 7 c

Euclidian Traveling Salesman Problem Euclidian Traveling Salesman Problem is the Traveling Salesman Problem with the Triangle Inequality. The following is a 2-approximation of TSP with the triangle inequality: compute a minimum spanning tree T of the weighted clique order the vertices according to a preorder walk on T return this order as the TSP tour

Euclidian Traveling Salesman Problem root a b e g f h a b e g f MST h c d c d a b e g f Pre-Order walk h a b e g f h Hamiltonian Cycle c d c d 30

Euclidian Traveling Salesman Problem APPROX-TSP-TOUR(G, W) 1 select a vertex r Є V[G] to be root. 2 compute a MST for G from root r using Prim Alg. 3 L = list of vertices in preorder walk of that MST. 4 return L as the Hamiltonian cycle. 31

Traveling salesman problem Pre-order Solution This is polynomial-time 2-approximation algorithm. (Why?) Because: APPROX-TSP-TOUR is O(V 2 ) C(MST) C(H*) C(W) = 2C(MST) C(W) 2C(H*) C(H) C(W) C(H) 2C(H*) Optimal H*: optimal soln W: Preorder walk H: approx soln & triangle inequality 32

Set Cover SET COVER: Given a set U of elements, a collection S 1, S 2,..., S m of subsets of U, and an integer k, does there exist a collection of k of these sets whose union is equal to U? Sample application. m available pieces of software. Set U of n capabilities that we would like our system to have. The i th piece of software provides the set S i U of capabilities. Goal: achieve all n capabilities using fewest pieces of software. Ex: U = { 1, 2, 3, 4, 5, 6, 7 } k = 2 S 1 = {3, 7} S 4 = {2, 4} S 2 = {3, 4, 5, 6} S 5 = {5} S 3 = {1} S 6 = {1, 2, 6, 7} 33

Set Cover (Greedy Algorithm) OPT-SET-COVER: Given a collection of m sets, find the smallest number of them whose union is the same as the whole collection of m sets? OPT-SET-COVER is a hard COP. Greedy approach produces an O(log n)-approximation algorithm. 34

Greedy Set Cover Analysis Consider the moment in our algorithm when a set S j is added to C, and let k be the number of previously uncovered elements in S j. We pay a total charge of 1 to add this set to C, so we charge each previously uncovered element i of S j a charge of c(i) = 1/k. Thus, the total size of our cover is equal to the total charges made. To prove an approximation bound, we will consider the charges made to the elements in each subset S j that belongs to an optimal cover, C. So, suppose that S j belongs to C. Let us write S j = {x 1, x 2,..., x nj } so that S j s elements are listed in the order in which they are covered by our algorithm. 35

Greedy Set Cover Analysis, cont. 36