Introduction to Algorithms

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

Notes for Lecture 24

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

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

Design and Analysis of Algorithms

Approximation Algorithms

Greedy algorithms Or Do the right thing

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

Module 6 NP-Complete Problems and Heuristics

Module 6 NP-Complete Problems and Heuristics

Assignment 5: Solutions

Module 6 NP-Complete Problems and Heuristics

Theory of Computing. Lecture 10 MAS 714 Hartmut Klauck

Introduction to Algorithms

Lecture 8: The Traveling Salesman Problem

1 Variations of the Traveling Salesman Problem

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

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

1 Better Approximation of the Traveling Salesman

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

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

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

(Refer Slide Time: 01:00)

Theorem 2.9: nearest addition algorithm

CS270 Combinatorial Algorithms & Data Structures Spring Lecture 19:

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

Questions... How does one show the first problem is NP-complete? What goes on in a reduction? How hard are NP-complete problems?

2 Approximation Algorithms for Metric TSP

Optimal tour along pubs in the UK

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

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).

Approximation Algorithms

Coping with NP-Completeness

35 Approximation Algorithms

Advanced Methods in Algorithms HW 5

Partha Sarathi Mandal

CSE331 Introduction to Algorithms Lecture 15 Minimum Spanning Trees

P and NP (Millenium problem)

Approximation Algorithms

Introduction to Approximation Algorithms

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

Algorithm Design and Analysis

Slides on Approximation algorithms, part 2: Basic approximation algorithms

Notes for Recitation 9

Approximation Algorithms

Greedy Algorithms. Previous Examples: Huffman coding, Minimum Spanning Tree Algorithms

CMPSCI611: The SUBSET-SUM Problem Lecture 18

1 The Traveling Salesman Problem

Basic Approximation algorithms

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

1 The Traveling Salesman Problem

Greedy Approximations

1 The Traveling Salesperson Problem (TSP)

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

CSCE 350: Chin-Tser Huang. University of South Carolina

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

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

Problem Set 2 Solutions

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

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

CSE 331: Introduction to Algorithm Analysis and Design Graphs

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

Vertex Cover Approximations

Class Overview. Introduction to Artificial Intelligence COMP 3501 / COMP Lecture 2. Problem Solving Agents. Problem Solving Agents: Assumptions

APPROXIMATION ALGORITHMS FOR GEOMETRIC PROBLEMS

Stanford University CS359G: Graph Partitioning and Expanders Handout 18 Luca Trevisan March 3, 2011

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

Approximation Algorithms

Name: Lirong TAN 1. (15 pts) (a) Define what is a shortest s-t path in a weighted, connected graph G.

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

Introduction to Graph Theory

Dynamic programming. Trivial problems are solved first More complex solutions are composed from the simpler solutions already computed

Mathematical Tools for Engineering and Management

Fall CS598CC: Approximation Algorithms. Chandra Chekuri

SPANNING TREES. Lecture 21 CS2110 Spring 2016

Traveling Salesperson Problem (TSP)

CSE 417 Branch & Bound (pt 4) Branch & Bound

6 Randomized rounding of semidefinite programs

Algorithms for Euclidean TSP

MITOCW watch?v=zm5mw5nkzjg

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

10/31/18. About A6, Prelim 2. Spanning Trees, greedy algorithms. Facts about trees. Undirected trees

Spanning Trees, greedy algorithms. Lecture 20 CS2110 Fall 2018

Exact Algorithms for NP-hard problems


Approximation slides 1. An optimal polynomial algorithm for the Vertex Cover and matching in Bipartite graphs

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

11. APPROXIMATION ALGORITHMS

Graphs: Introduction. Ali Shokoufandeh, Department of Computer Science, Drexel University

Design and Analysis of Algorithms

8 Matroid Intersection

CS 6783 (Applied Algorithms) Lecture 5

Greedy Algorithms 1 {K(S) K(S) C} For large values of d, brute force search is not feasible because there are 2 d {1,..., d}.

Steiner Trees and Forests

Discrete mathematics II. - Graphs

Approximability Results for the p-center Problem

Introduction to Algorithms / Algorithms I Lecturer: Michael Dinitz Topic: Approximation algorithms Date: 11/18/14

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

Coverage Approximation Algorithms

COP 4531 Complexity & Analysis of Data Structures & Algorithms

Transcription:

Introduction to Algorithms 6.046J/18.401J Lecture 24 Prof. Piotr Indyk

Dealing with Hard Problems What to do if: Divide and conquer Dynamic programming Greedy Linear Programming/Network Flows does not give a polynomial time algorithm? Piotr Indyk Introduction to Algorithms December 8, 2004 L24.2

Dealing with Hard Problems Solution I: Ignore the problem Can t do it! There are thousands of problems for which we do not know polynomial time algorithms For example: Traveling Salesman Problem (TSP) Set Cover Piotr Indyk Introduction to Algorithms December 8, 2004 L24.3

Traveling Salesman Problem Traveling Salesman Problem (TSP) Input: undirected graph with lengths on edges Output: shortest cycle that visits each vertex exactly once Best known algorithm: O(n 2 n ) time. Piotr Indyk Introduction to Algorithms December 8, 2004 L24.4

Set Covering Set Cover: Bank robbery problem: X={plan, shoot, safe, Input: subsets S 1 S n of X, drive, scary} i S i = X, X =m Sets: Output: C {1 n}, such S Joe ={plan, safe} that i C S i = X, and C drive} minimal Best known algorithm:. O(2 n m) time(?) S Jim ={shoot, scary, Piotr Indyk Introduction to Algorithms December 8, 2004 L24.5

Dealing with Hard Problems Exponential time algorithms for small inputs. E.g., (100/99) n time is not bad for n < 1000. Polynomial time algorithms for some (e.g., average-case) inputs Polynomial time algorithms for all inputs, but which return approximate solutions Piotr Indyk Introduction to Algorithms December 8, 2004 L24.6

Approximation Algorithms An algorithm A is ρ-approximate, if, on any input of size n: The cost C A of the solution produced by the algorithm, and The cost C OPT of the optimal solution are such that C A ρ C OPT We will see: 2-approximation algorithm for TSP in the plane ln(m)-approximation algorithm for Set Cover Piotr Indyk Introduction to Algorithms December 8, 2004 L24.7

Comments on Approximation C A ρ C OPT makes sense only for minimization problems For maximization problems, replace by C A 1/ρ C OPT Additive approximation C A ρ + C OPT also makes sense, although difficult to achieve Piotr Indyk Introduction to Algorithms December 8, 2004 L24.8

2-approximation for TSP Compute MST T An edge between any pair of points Weight = distance between endpoints Compute a tree-walk W of T Each edge visited twice Convert W into a cycle C using shortcuts Piotr Indyk Introduction to Algorithms December 8, 2004 L24.9

2-approximation: Proof Let C OPT be the optimal cycle Cost(T) Cost(C OPT ) Removing an edge from C gives a spanning tree, T is a spanning tree of minimum cost Cost(W) = 2 Cost(T) Each edge visited twice Cost(C) Cost(W) Triangle inequality Cost(C) 2 Cost(C OPT ) Piotr Indyk Introduction to Algorithms December 8, 2004 L24.10

Approximation for Set Cover Greedy algorithm: Initialize C= Repeat until all elements are covered: Choose S i which contains largest number of yet-not-covered elements Add i to C Mark all elements in S i as covered Piotr Indyk Introduction to Algorithms December 8, 2004 L24.11

Greedy Algorithm: Example X={1,2,3,4,5,6} Sets: S 1 ={1,2} S 2 ={3,4} S 3 ={5,6} S 4 ={1,3,5} Algorithm picks C={4,1,2,3} Not optimal! Piotr Indyk Introduction to Algorithms December 8, 2004 L24.12

ln(m)-approximation Notation: C OPT = optimal cover k= C OPT Fact: At any iteration of the algorithm, there exists S j which contains at 1/k fraction of yet-not-covered elements Proof: by contradiction. If all sets cover <1/k fraction of yet-not-covered elements, there is no way to cover them using k sets But C OPT does that! Therefore, at each iteration greedy covers 1/k fraction of yet-not-covered elements Piotr Indyk Introduction to Algorithms December 8, 2004 L24.13

ln(m)-approximation Let u i be the number of yet-not-covered elements at the end of step i=0,1,2, We have u i+1 u i (1-1/k) u 0 =m Therefore, after t=k ln m steps, we have u t u 0 (1-1/k) t m (1-1/k) k ln m < m 1/e ln m =1 I.e., all elements are covered by the k ln m sets chosen by greedy algorithm Opt size is k greedy is ln(m)-approximate Piotr Indyk Introduction to Algorithms December 8, 2004 L24.14

Approximation Algorithms Very rich area Algorithms use greedy, linear programming, dynamic programming E.g., 1.01-approximate TSP in the plane Sometimes can show that approximating a problem is as hard as finding exact solution! E.g., 0.99 ln(m)-approximate Set Cover Piotr Indyk Introduction to Algorithms December 8, 2004 L24.15