NP-Complete Problems and Approximation Algorithms

Similar documents
Tractable & Intractable Problems

ECS122A Handout on NP-Completeness March 12, 2018

VIII. NP-completeness

NP-Completeness. Andreas Klappenecker. [based on slides by Prof. Welch]

NP-completeness. Chapter 34. Sergey Bereg

July 18, Approximation Algorithms (Travelling Salesman Problem)

CS 320, Fall Dr. Geri Georg, Instructor 320 NP 1

Data Structures in Java

NP-Completeness. ch34 Hewett. Problem. Tractable Intractable Non-computable computationally infeasible super poly-time alg. sol. E.g.

Algorithms Design & Analysis. Approximation Algorithm

NP-Completeness. Until now we have been designing algorithms for specific problems

Lecture 4: NP and computational intractability

CMSC 441: Algorithms. NP Completeness

NP-Completeness. NP-Completeness 1

Decision Problems TSP. Instance: A complete graph G with non-negative edge costs, and an integer

NP-Completeness. CptS 223 Advanced Data Structures. Larry Holder School of Electrical Engineering and Computer Science Washington State University

1. Introduction Recap

CS/COE

ABHELSINKI UNIVERSITY OF TECHNOLOGY

Data Structures and Algorithms (CSCI 340)

Admin NP-COMPLETE PROBLEMS. Run-time analysis. Tractable vs. intractable problems 5/2/13. What is a tractable problem?

P,NP, NP-Hard and NP-Complete

DAA Unit IV Complexity Theory Overview

NP-Complete problems

Chapter 34: NP-Completeness

Graduate Algorithms CS F-21 NP & Approximation Algorithms

Notes for Lecture 21

CS 583: Algorithms. NP Completeness Ch 34. Intractability

Preliminaries and Complexity Theory

The Complexity Classes P and NP. Andreas Klappenecker [partially based on slides by Professor Welch]

NP-Completeness. f(n) \ n n sec sec sec. n sec 24.3 sec 5.2 mins. 2 n sec 17.9 mins 35.

NP-complete problems. CSE 101: Design and Analysis of Algorithms Lecture 20

Easy Problems vs. Hard Problems. CSE 421 Introduction to Algorithms Winter Is P a good definition of efficient? The class P

Summer School on Introduction to Algorithms and Optimization Techniques July 4-12, 2017 Organized by ACMU, ISI and IEEE CEDA.

In complexity theory, algorithms and problems are classified by the growth order of computation time as a function of instance size.

Design and Analysis of Algorithms

Computer Science 385 Analysis of Algorithms Siena College Spring Topic Notes: Limitations of Algorithms

NP Completeness and Approximation Algorithms

CHAPTER 3 FUNDAMENTALS OF COMPUTATIONAL COMPLEXITY. E. Amaldi Foundations of Operations Research Politecnico di Milano 1

Today s Outline. CS 362, Lecture 24. The Reduction. Hamiltonian Cycle. Reduction Wrapup Approximation algorithms for NP-Hard Problems

Algorithms: COMP3121/3821/9101/9801

Complexity - Introduction + Complexity classes

Computational Complexity

Graph Theory and Optimization Computational Complexity (in brief)

Limitations of Algorithm Power

NP-Complete Reductions 1

Polynomial-time reductions. We have seen several reductions:

Lecture 6 January 21, 2013

NP and Computational Intractability

Automata Theory CS Complexity Theory I: Polynomial Time

Computational Complexity and Intractability: An Introduction to the Theory of NP. Chapter 9

CS 241 Analysis of Algorithms

NP-Complete Problems. More reductions

4. How to prove a problem is NPC

Computational Complexity

Tractability. Some problems are intractable: as they grow large, we are unable to solve them in reasonable time What constitutes reasonable time?

COP 4531 Complexity & Analysis of Data Structures & Algorithms

NP Completeness and Approximation Algorithms

Analysis of Algorithms. Unit 5 - Intractable Problems

NP-Completeness Review

8.3 Hamiltonian Paths and Circuits

COSE215: Theory of Computation. Lecture 20 P, NP, and NP-Complete Problems

DESIGN AND ANALYSIS OF ALGORITHMS. Unit 6 Chapter 17 TRACTABLE AND NON-TRACTABLE PROBLEMS

Unit 6 Chapter 17 TRACTABLE AND NON-TRACTABLE PROBLEMS

The P versus NP Problem. Ker-I Ko. Stony Brook, New York

P, NP, NP-Complete. Ruth Anderson

CS 561, Lecture 12. Jared Saia University of New Mexico

Problem Complexity Classes

P vs. NP. Data Structures and Algorithms CSE AU 1

Introduction to Complexity Theory

NP Complete Problems. COMP 215 Lecture 20

from notes written mostly by Dr. Matt Stallmann: All Rights Reserved

4/12/2011. Chapter 8. NP and Computational Intractability. Directed Hamiltonian Cycle. Traveling Salesman Problem. Directed Hamiltonian Cycle

Algorithm Design Strategies V

1.1 P, NP, and NP-complete

CS 301: Complexity of Algorithms (Term I 2008) Alex Tiskin Harald Räcke. Hamiltonian Cycle. 8.5 Sequencing Problems. Directed Hamiltonian Cycle

Combinatorial Optimization

NP Completeness. CS 374: Algorithms & Models of Computation, Spring Lecture 23. November 19, 2015

Unit 1A: Computational Complexity

Intractable Problems Part One

Lecture 14 - P v.s. NP 1

CMPT307: Complexity Classes: P and N P Week 13-1

Instructor N.Sadagopan Scribe: P.Renjith. Lecture- Complexity Class- P and NP

CS Fall 2011 P and NP Carola Wenk

CSC 1700 Analysis of Algorithms: P and NP Problems

Outline. 1 NP-Completeness Theory. 2 Limitation of Computation. 3 Examples. 4 Decision Problems. 5 Verification Algorithm

Hamiltonian Graphs Graphs

Some Algebra Problems (Algorithmic) CSE 417 Introduction to Algorithms Winter Some Problems. A Brief History of Ideas

Approximation Algorithms

SAT, Coloring, Hamiltonian Cycle, TSP

Travelling Salesman Problem

Quantum Complexity Theory. Wim van Dam HP Labs MSRI UC Berkeley SQUINT 3 June 16, 2003

Polynomial-Time Reductions

Determine the size of an instance of the minimum spanning tree problem.

2 Notation and Preliminaries

P P P NP-Hard: L is NP-hard if for all L NP, L L. Thus, if we could solve L in polynomial. Cook's Theorem and Reductions

Today: NP-Completeness (con t.)

P versus NP. Math 40210, Fall November 10, Math (Fall 2015) P versus NP November 10, / 9

The P = NP Problem Bristol Teachers Circle, June P.D.Welch, University of Bristol

Transcription:

NP-Complete Problems and Approximation Algorithms Efficiency of Algorithms Algorithms that have time efficiency of O(n k ), that is polynomial of the input size, are considered to be tractable or easy Those that require more time or can t be solved are considered to be intractable or hard Then there are problems for which a polynomial time solution is not known these are called NP-Complete problems Only a slight change in problems may have a polynomial time solution, but the problems themselves are not known to have 2

Example Finding the shortest path from a source to a destination in a directed graph has a polynomial time solution Finding the longest simple path between two vertices is NP-Complete. Even finding if a graph contains a simple path with at least a given number of edges is NP- Complete. 3 Class of Problems P - solvable in polynomial time NP - Verifiable in polynomial time. Given a certificate of solution, you can verify in polynomial time if that is correct. NP-Complete - No known polynomial time solution. It is as hard as any problem in NP NP-hard At least as hard as the hardest problem in NP There is a NP-Complete problem that is reducible to it The problem itself does not have to belong to NP 4

Why is it important? If you re looking for a solution to a problem, if you can show that the problem is NP-complete, you would rather look for an approximation algorithm or settle for an easier special case. 5 How to show NP-Complete Often applies to decision problems where you re looking for a yes/no (or) 1/0 solution Though not directly related to optimization problems, you may cast it as one and prove/disprove about the hardness of one and relate to the other 6

How to show NP-Complete Apply reductions Suppose you can show that an instance (sample input) of a problem can be transformed into an instance of another problem for which polynomial solution is known If you can do the transformation in polynomial time If you can show that the answer to the two problems are same for respective given instances You can use such a polynomial-time reduction algorithm to solve problem A in polynomial time 7 How to show NP-Complete Apply reductions For a problem with no known polynomial time solution, using polynomial time reduction to a NP- Complete problem, we can show the first problem is NP-Complete as well the proof here is based on the assumption that the second problem is NP-Complete. 8

Polynomial Time Problems with solution in polynomial time are considered tractable. Even if the order is high to being with, there are hopes of finding more efficient solutions Problems solvable in polynomial time on one model of a machine can be solved in polynomial time on other models as well Composition of polynomial time algorithms leads to polynomial time algorithms 9 Example of NP-Complete Circuit satisfiability problem If an electronic circuit will produce an output of 1, it is said to be satisfiable. If it always produces an output of 0 for any given input, it might as well be removed Determining the satisfiability of an electronic circuit is NP-Complete If you have k inputs to the overall circuit, there are 2 k combinations to check There is no known algorithm that s faster than!(2 k ) 10

Classes of Problems If a problem can be reduced to one of the known NP- Complete problem (and not to a problem with polynomial time) in polynomial time, then you can show that that problem is NP-Complete as well. Several problems can be reduced to the circuit satisfiability problem: Vertex-Cover Hamiltonian cycle Traveling Salesman Problem... 11 Approximation Algorithms While significant problems may not be entirely solvable in polynomial time, things are not totally hopeless You may find the time not prohibitively high for smaller input size You may modify the problem slightly to a meaningful special case and get a polynomial time solution You may find near-optimal solutions in polynomial time these are known as approximation algorithms 12

Approximation Ratio A problem has an approximation ratio of ρ(n), if for any input of size n, the cost C of the solution produced is within a factor of ρ(n) of the cost C * of an optimal solution: max (C/C*, C * /C) <= ρ(n) Such an algorithm is called ρ(n)-approximation algorithm For a minimization problem, the cost may be higher, for maximization problem, the cost may be lower, than the optimal solution The ratio is 1 at the best. An algorithm with lower ratio is better than one with higher ratio 13 Approximation Scheme For a fixed ε, the scheme is a (1 + ε)-approximation algorithm. An approximation scheme is a polynomial-time approximation scheme if for any fixed ε>0, the scheme runs in time polynomial in the size of its input instance. As ε decreases, the time can increase rapidly. Fully polynomial-time approximation schemes have runtime polynomial in both 1/ε and the size n of the input instance, for example O((1/ε) 2 n 3 ) Ideally, a constant factor decrease in ε should result in only (some other) constant factor increase in time 14

Vertex-cover Problem A vertex cover of an undirected graph G= (V,E) is a subset V V such that if (u, v) E, then u V or v V or both. The vertex-cover has vertices that cover all the edges of the original graph In other words, at least one vertex belonging to each edge in V is represented in V 15 Vertex-cover Problem Optimal vertex cover is a minimum size in a given undirected graph Approximation algorithm to get vertex-cover with no more than twice the size of an optimal vertex-cover Runtime O(V+E), polynomial 2-approximation algorithm Approx-Vertex-Cover(G) C <- E = G.E while E " let (u,v) be an arbitrary edge of E C -< C {u, v} remove from E every edge incident on either u or v return C 16

Traveling Salesman Problem NP-Complete You could apply triangle inequality for all vertices, where cost of travel C(u,w) <= C(u, v) + C(v, w) 2-approximation algorithm (no more than twice the cost) with O(V 2 ) time Approx-TSP-Tour(G, c) Select a vertex r G.V to be a root vertex Compute a minimum spanning tree T for G from root r let H be a list of vertices, ordered according to when they are first visited in a pre-order tree walk of T return the hamiltonian cycle H 17 The Set-cover Problem Generalizes the NP-Complete vertex-cover problem NP-hard As size of instance gets larger, size of approximation algorithm grows But growth is logarithmic, so not too bad 18

The Set-cover Problem Given: a finite set X and a family F of subset of X such that every element of X belongs to at least one subset of F Find a minimum size subset E F whose members cover all of X: X = S E S Sample application: Select a minimum size committee among people with varying skills so each skill is represented in the committee 19 Greedy Approx. Algorithm Greedy-Set-Cover(X, F) U <- X E <- while U " select an S F that maximizes S U U <- U - S E <- E {S} O( X F min( X, F )) p(n) approximation algorithm where p(n) = H(max{ S : S F}) H d = #i= 1 to d 1/i if the d th Harmonic number, and H(d) represents H d 20