Computer Algorithms. NP-Complete Problems. CISC 4080 Yanjun Li



Similar documents
Outline. NP-completeness. When is a problem easy? When is a problem hard? Today. Euler Circuits

CAD Algorithms. P and NP

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

NP-complete? NP-hard? Some Foundations of Complexity. Prof. Sven Hartmann Clausthal University of Technology Department of Informatics

Page 1. CSCE 310J Data Structures & Algorithms. CSCE 310J Data Structures & Algorithms. P, NP, and NP-Complete. Polynomial-Time Algorithms

Tutorial 8. NP-Complete Problems

SIMS 255 Foundations of Software Design. Complexity and NP-completeness

Complexity Theory. IE 661: Scheduling Theory Fall 2003 Satyaki Ghosh Dastidar

The Classes P and NP. mohamed@elwakil.net

Lecture 19: Introduction to NP-Completeness Steven Skiena. Department of Computer Science State University of New York Stony Brook, NY

Complexity Classes P and NP

Lecture 7: NP-Complete Problems

2. (a) Explain the strassen s matrix multiplication. (b) Write deletion algorithm, of Binary search tree. [8+8]

CMPSCI611: Approximating MAX-CUT Lecture 20

NP-Completeness I. Lecture Overview Introduction: Reduction and Expressiveness

Why? A central concept in Computer Science. Algorithms are ubiquitous.

Algorithm Design and Analysis

! Solve problem to optimality. ! Solve problem in poly-time. ! Solve arbitrary instances of the problem. #-approximation algorithm.

CSC 373: Algorithm Design and Analysis Lecture 16

Introduction to Algorithms. Part 3: P, NP Hard Problems

A Working Knowledge of Computational Complexity for an Optimizer

1. Nondeterministically guess a solution (called a certificate) 2. Check whether the solution solves the problem (called verification)

One last point: we started off this book by introducing another famously hard search problem:

Chapter Load Balancing. Approximation Algorithms. Load Balancing. Load Balancing on 2 Machines. Load Balancing: Greedy Scheduling

On the Relationship between Classes P and NP

Introduction to Logic in Computer Science: Autumn 2006

Discuss the size of the instance for the minimum spanning tree problem.

Approximation Algorithms

5.1 Bipartite Matching

NP-completeness and the real world. NP completeness. NP-completeness and the real world (2) NP-completeness and the real world

Computational complexity theory

Quantum Monte Carlo and the negative sign problem

Reductions & NP-completeness as part of Foundations of Computer Science undergraduate course

Theoretical Computer Science (Bridging Course) Complexity

! Solve problem to optimality. ! Solve problem in poly-time. ! Solve arbitrary instances of the problem. !-approximation algorithm.

OHJ-2306 Introduction to Theoretical Computer Science, Fall

The Classes P and NP

P versus NP, and More

CoNP and Function Problems

Welcome to... Problem Analysis and Complexity Theory , 3 VU

CPSC 211 Data Structures & Implementations (c) Texas A&M University [ 313]

Near Optimal Solutions

Tetris is Hard: An Introduction to P vs NP

Single machine parallel batch scheduling with unbounded capacity

8.1 Min Degree Spanning Tree

Introduction to computer science

JUST-IN-TIME SCHEDULING WITH PERIODIC TIME SLOTS. Received December May 12, 2003; revised February 5, 2004

Applied Algorithm Design Lecture 5

11. APPROXIMATION ALGORITHMS

How To Solve A Minimum Set Covering Problem (Mcp)

Notes on NP Completeness

V. Adamchik 1. Graph Theory. Victor Adamchik. Fall of 2005

Bicolored Shortest Paths in Graphs with Applications to Network Overlay Design

Why Study NP- hardness. NP Hardness/Completeness Overview. P and NP. Scaling 9/3/13. Ron Parr CPS 570. NP hardness is not an AI topic

! X is a set of strings. ! Instance: string s. ! Algorithm A solves problem X: A(s) = yes iff s! X.

Chapter. NP-Completeness. Contents

Transportation Polytopes: a Twenty year Update

Ian Stewart on Minesweeper

Guessing Game: NP-Complete?

Problem Set 7 Solutions

Answer: (a) Since we cannot repeat men on the committee, and the order we select them in does not matter, ( )

Exponential time algorithms for graph coloring

Classification - Examples

Can linear programs solve NP-hard problems?

Euler Paths and Euler Circuits

1 Definitions. Supplementary Material for: Digraphs. Concept graphs

On the independence number of graphs with maximum degree 3

Automated SEO. A Market Brew White Paper

ALGEBRA 2 CRA 2 REVIEW - Chapters 1-6 Answer Section

On the k-path cover problem for cacti

Quantum and Non-deterministic computers facing NP-completeness

Data Structures and Algorithms Written Examination

ON THE COMPLEXITY OF THE GAME OF SET.

Graph Security Testing

CHOOSING THE BEST HEURISTIC FOR A NP-PROBLEM

Scheduling Home Health Care with Separating Benders Cuts in Decision Diagrams

Fundamentals of algorithms

Handout #Ch7 San Skulrattanakulchai Gustavus Adolphus College Dec 6, Chapter 7: Digraphs

Distributed Computing over Communication Networks: Maximal Independent Set

Boulder Dash is NP hard

Chapter 1. NP Completeness I Introduction. By Sariel Har-Peled, December 30, Version: 1.05

MATHEMATICAL ENGINEERING TECHNICAL REPORTS. An Improved Approximation Algorithm for the Traveling Tournament Problem

Analysis of Computer Algorithms. Algorithm. Algorithm, Data Structure, Program

Analysis of Algorithms I: Binary Search Trees

Diagonalization. Ahto Buldas. Lecture 3 of Complexity Theory October 8, Slides based on S.Aurora, B.Barak. Complexity Theory: A Modern Approach.

MATHEMATICS: CONCEPTS, AND FOUNDATIONS Vol. III - Logic and Computer Science - Phokion G. Kolaitis

Theorem (informal statement): There are no extendible methods in David Chalmers s sense unless P = NP.

Million Dollar Mathematics!

Cycles and clique-minors in expanders

Many algorithms, particularly divide and conquer algorithms, have time complexities which are naturally

136 CHAPTER 4. INDUCTION, GRAPHS AND TREES

Lecture 30: NP-Hard Problems [Fa 14]

Transcription:

Computer Algorithms NP-Complete Problems NP-completeness The quest for efficient algorithms is about finding clever ways to bypass the process of exhaustive search, using clues from the input in order to dramatically narrow down the search space. NP-completeness is a form of bad news. Evidence that many important problems can't be solved quickly. 1

Computational Complexity Theory This subject is dedicated to classifying problems by how hard they are. Yes-or-no problems We care more about Does a certain structure exist rather than how do I find the structure. We will discuss the classification defined in terms of yes-or-no problems. Classification of Problems P : Problems that can be solved in polynomial time. T(n) = O(n c ) Example: sorting, minimum spanning tree E : Problems that can be solved in exponential time if no polynomial-time algorithm can be developed for it. T(n) = O(n u(n) ) 2

Classification of Problems NP : Nondeterministic polynomial time. Nondeterministic is guessing a solution. A problem is in NP if you can quickly (in polynomial time) test whether a solution is correct (without worrying about how hard it might be to find the solution). Problems in NP are still relatively easy: if only we could guess the right solution, we could then quickly test it. Classification of Problems Undecidable: For some problems, we can prove that there is no algorithm that always solves them, no matter how much time is allowed. There are as many problems as there are real numbers, and only as many programs as there are integers, so there are not enough programs to solve all the problems. 3

Long Simple Paths A simple path in a graph is just one without any repeated edges or vertices. Problem of finding long simple path: Given a graph G, vertices s and t, and a number k, does there exist a simple path from s to t with at least k edges? We do not know whether it is in P. So far, no algorithm running in polynomial time that solves this problem. It is in NP: Testing whether the answer is correct could be done in linear time. Examination Scheduling A school has n courses and m days in which to schedule examinations. An optimal schedule would be one where no student has to take two examinations on the same day. There are O(m n ) possible different schedules. It is in NP: it is difficult to find a good one, it is easy to check a schedule to see how near perfect it is. 4

Knapsack Given n items, each with a weight and a value, is there a collection of items with total weight less than W, which has a total value greater than g? A dynamic programming scheme for KNAPSACK with running time O(nW), which is exponential in the input size since it involves W rather than logw. And we have the usual exhaustive algorithm as well, which looks at all subsets of items - all 2 n of them. It is in NP : it is easy to test whether a solution is correct. Hamiltonian Cycle Does a given graph G have a cycle visiting each vertex exactly once? It is in NP : Perform an exhaustive search for all possible path ( not polynomial time) Test whether one path is a Hamiltonian cycle (in polynomial time) 5

Traveling Salesman Problem In the traveling salesman problem (TSP) we are given n vertices and all n(n-1)/2 distances (cost) between them, as well as a budget b. We are asked to find a tour, a cycle that passes through n vertex exactly once, of total cost is b or less. It is in NP : In fact, n factorial different tours are possible. And, if we have a tour, we can easily check to see the cost of it. Problems of complexity theory The most famous open problem in theoretical science is whether P = NP. In other words, if it's always easy to check a solution, should it also be easy to find the solution? It's false. But we also don't have a proof... 6

Reduction One problem is easier than another. A is easier than B (A < B) if we have an algorithm for solving A that uses a small number of calls to a subroutine for B. Easier means if one problem can be solved in polynomial time, so can the other. It is possible for the algorithms for A to be slower than those for B, even though A < B. If A < B, and B is in P, so is A. Reduction Example Hamiltonian cycle vs. longest simple path Solution with longest simple path as subroutine for each edge (u,v) of G if there is a simple path of length n-1 from u to v return yes //path + edge from a cycle return no This solution does O(m) work outside m calls to the subroutine. Hamiltonian cycle < longest simple path 7

NP-completeness A problem A in NP is NP-complete when, for every other problem B in NP, B < A. Theorem: an NP-complete problem exists. if A < B and B < C, then A < C. if A is NP-complete, B is in NP, and A < B, B is NPcomplete. We start with one specific problem that we prove NP-complete, and we then prove that it's easier than lots of others which must therefore also be NP-complete. Hamiltonian cycle is known to be NP-complete. 8

What we should do? Use a heuristic : a solution to a reasonable fraction of the common cases. Solve the problem approximately instead of exactly. Use an exponential time solution anyway. If you really have to solve the problem exactly. 9