Coping with NP-Completeness

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

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

Partha Sarathi Mandal

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

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

Approximation Algorithms

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

Lecture 8: The Traveling Salesman Problem

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

Theorem 2.9: nearest addition algorithm

1 Variations of the Traveling Salesman Problem

35 Approximation Algorithms

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

APPROXIMATION ALGORITHMS FOR GEOMETRIC PROBLEMS

CS270 Combinatorial Algorithms & Data Structures Spring Lecture 19:

Module 6 NP-Complete Problems and Heuristics

Module 6 NP-Complete Problems and Heuristics

GRAPH THEORY and APPLICATIONS. Matchings

Greedy algorithms Or Do the right thing

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

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

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

Approximation Algorithms

Module 6 NP-Complete Problems and Heuristics

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

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

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

1 The Traveling Salesman Problem

Greedy Approximations

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

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

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

Approximation Algorithms

2 Approximation Algorithms for Metric TSP

Notes 4 : Approximating Maximum Parsimony

Christofides Algorithm

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

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

Adjacent: Two distinct vertices u, v are adjacent if there is an edge with ends u, v. In this case we let uv denote such an edge.

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

1 The Traveling Salesman Problem

Let G = (V, E) be a graph. If u, v V, then u is adjacent to v if {u, v} E. We also use the notation u v to denote that u is adjacent to v.

Basic Approximation algorithms

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

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

Improved Approximations for Graph-TSP in Regular Graphs

Polynomial time approximation algorithms

31.6 Powers of an element

Introduction to Algorithms

P and NP CISC4080, Computer Algorithms CIS, Fordham Univ. Instructor: X. Zhang

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

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

Assignment 5: Solutions

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

1 Better Approximation of the Traveling Salesman

1 The Traveling Salesperson Problem (TSP)

Part II. Graph Theory. Year

Introduction to Approximation Algorithms

Algorithm Design and Analysis

P and NP CISC5835, Algorithms for Big Data CIS, Fordham Univ. Instructor: X. Zhang

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

Traveling Salesperson Problem (TSP)

Graphs and Algorithms 2015

Theory of Computing. Lecture 10 MAS 714 Hartmut Klauck

NP-Hardness. We start by defining types of problem, and then move on to defining the polynomial-time reductions.

Chapter 9 Graph Algorithms

CMPSCI611: The SUBSET-SUM Problem Lecture 18

EECS 203 Lecture 20. More Graphs

Chapter 9 Graph Algorithms

1 Matching in Non-Bipartite Graphs

1. The following graph is not Eulerian. Make it into an Eulerian graph by adding as few edges as possible.

Graphs and Algorithms 2016

Matching Algorithms. Proof. If a bipartite graph has a perfect matching, then it is easy to see that the right hand side is a necessary condition.

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

CS154, Lecture 18: PCPs, Hardness of Approximation, Approximation-Preserving Reductions, Interactive Proofs, Zero-Knowledge, Cold Fusion, Peace in

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

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

Slides on Approximation algorithms, part 2: Basic approximation algorithms

Optimal tour along pubs in the UK

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

Chapter 9 Graph Algorithms

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

Notes for Lecture 24

Final. Name: TA: Section Time: Course Login: Person on Left: Person on Right: U.C. Berkeley CS170 : Algorithms, Fall 2013

Ma/CS 6b Class 4: Matchings in General Graphs

Vertex Cover Approximations

NP-Completeness. Algorithms

Last topic: Summary; Heuristics and Approximation Algorithms Topics we studied so far:

Approximation Algorithms: The Primal-Dual Method. My T. Thai

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

Number Theory and Graph Theory

(Refer Slide Time: 01:00)

Improved Approximations for Graph-TSP in Regular Graphs

Advanced Methods in Algorithms HW 5

Design and Analysis of Algorithms

Graph Theory. Connectivity, Coloring, Matching. Arjun Suresh 1. 1 GATE Overflow

Graphs and Network Flows IE411. Lecture 21. Dr. Ted Ralphs

/633 Introduction to Algorithms Lecturer: Michael Dinitz Topic: Approximation algorithms Date: 11/27/18

P NP. Approximation Algorithms. Computational hardness. Vertex cover. Vertex cover. Vertex cover. Plan: Vertex Cover Metric TSP 3SAT

Transcription:

Coping with NP-Completeness Siddhartha Sen Questions: sssix@cs.princeton.edu Some figures obtained from Introduction to Algorithms, nd ed., by CLRS

Coping with intractability Many NPC problems are important in industry and must be solved Methods for coping: Special cases Average case Approximation algorithms Intelligent brute force Heuristics

Special cases -CNF-SAT can be solved in p-time, but 3-CNF- SAT and higher are NPC Uses strongly connected components VERTEX-COVER for bipartite graphs can be solved in p-time, but NPC in general Uses maximum matching

Approximation algorithms Returns near-optimal solution to a minimization/maximization problem Algorithm has approximation ratio (n) 1 if cost C of solution is within factor (n) of cost C* of optimal solution, for any input of size n: Maximization: 0 < C C*, ratio is C*/C Minimization: 0 < C* C, ratio is C/C*

Types of approximation algorithms (n) may be: Constant, e.g. Growing function of input size n, e.g. log n Approximation scheme: (1 + ) for fixed > 0 Approximation scheme that runs in p-time in n, e.g. O(n / ), is a polynomial-time approximation scheme (PTAS) If additionally p-time in 1/, e.g. O((1/) n 3 ), it is a fully polynomial-time approximation scheme

Approximate VERTEX-COVER VERTEX-COVER = {G, k : graph G = (V, E) has vertex cover of size k} Optimization version: Find vertex cover of G of minimum size Idea: Find maximal matching greedily

APPROX-VC (G) C 0 E = E while E Ø Select from E an arbitrary edge (u, v) C C U {u, v} Remove from E every edge incident to u or v return C

Theorem. APPROX-VC is a p-time -approximation algorithm for VERTEX-COVER Proof. Running time is O(E). C is vertex cover since edge only removed if has endpoint in C. Show C C*. Let A be set of edges selected from E A is a (maximal) matching since no two edges share common endpoint C* A Each selected edge has neither endpoint in C, so C = A A C* C = A Similar idea of lower-bounding optimal solution (when unknown) used in competitive analysis

Approximate TSP TSP = {G, d, k : G = (V, E) is a complete graph, d is cost function from V V Z, k Z, and G has tour of cost at most k} Tour is cycle that visits each vertex exactly once Optimization version: Find a minimum tour of G Use d(l) to denote total cost of edges in L Assume triangle inequality: d(x, y) + d(y, z) d(x, z) Idea: Find a minimum spanning tree

APPROX-TSP (G) Select arbitrary vertex r V to be root Find a minimum spanning tree T from r in G Let C be list of vertices from preorder walk of T return C

APPROX-TSP s solution Optimal solution

Theorem. APPROX-TSP is a p-time -approximation algorithm for TSP Proof. Runtime is time to find MST + preorder traversal, i.e. p-time. C is tour because includes all vertices (definition of MST). Show d(c) d(c*) Removing one edge from C* gives spanning tree, so d(t) d(c*) Full walk of T traverses each edge twice; since C is contracted version of full walk, d(c) d(t) By triangle inequality, can delete any vertex from full walk without increasing cost

1.5-approximation for TSP Let O be set of odd-degree vertices in T; find minimum-cost perfect matching M over O O is connected by complete graph and O is even, so perfect matching exists Find Eulerian tour on T U M, delete repeated vertices T U M is connected, has even-degree vertices only, so Eulerian tour exists Triangle inequality lets us delete vertices

Why is this a 1.5 approximation? d(t) d(c*) as before Show d(m) d(c*)/, see below d(t U M) 1.5d(C*) Let C O * be optimal tour of O, let e 1, e,, e k be its edge set (Eulerian path). Both e 1, e 3,, e k-1 and e, e 4,, e k are perfect matchings, so one has cost d(c O *)/ d(c*)/

PTAS for SUBSET-SUM SUBSET-SUM = {S, t : S N, t N and a subset S S s.t. t = ss s} Optimization version: Find subset whose sum is closest to t without exceeding t Idea: Maintain list of sums of all subsets so far, but trim list

APPROX-SUBSET-SUM(S, t, ) 1 n S L 0 0 3 for i 1 to n 4 do L i MERGE(L i-1, L i-1 + x i ) 5 L i TRIM(L i, /n) 6 remove from L i every element > t 7 return largest value z* in L n

APPROX-SUBSET-SUM(S, t, ) 1 n S L 0 0 3 for i 1 to n 4 do L i MERGE(L i-1, L i-1 + x i ) 5 L i TRIM(L i, /n) 6 remove from L i every element > t 7 return largest value z* in L n TRIM removes every y in L i for which z still in L i s.t.:. y 1 n z y

S = {104, 10, 01, 101}, t = 308, = 0.40, /n = 0.05 line : L 0 = 0 line 4: L 1 = 0, 104 line 5: L 1 = 0, 104 line 6: L 1 = 0, 104 line 4: L = 0, 10, 104, 06 line 5: L = 0, 10, 06 line 6: L = 0, 10, 06 line 4: L 3 = 0, 10, 01, 06, 303, 407 line 5: L 3 = 0, 10, 01, 303, 407 line 6: L 3 = 0, 10, 01, 303 line 4: L 4 = 0, 101, 10, 01, 03, 30, 303, 404 line 5: L 4 = 0, 101, 01, 30, 404 line 6: L 4 = 0, 101, 01, 30

Theorem. APPROX-SUBSET-SUM is a fully PTAS for SUBSET-SUM Proof. If y* is optimal solution, need to show y*/z* 1 +. By induction on i and recalling trimming equation, can show: n i n n z y y z y 1 * * 1 1 1 e

To show p-time, bound length of L i. After trimming, successive elements z, z must satisfy z /z > 1 + /n size of L i is at most: ln 4 )ln / (1 ) / ln(1 ln log / 1 t n t n n n t t n