Computational problems, algorithms, runtime, hardness

Slides:



Advertisements
Similar presentations
Analysis of Algorithms
Advertisements

NP-Hard Nattee Niparnan.
Polynomial-time reductions We have seen several reductions:
What is Intractable? Some problems seem too hard to solve efficiently. Question 1: Does an efficient algorithm exist?  An O(a ) algorithm, where a > 1,
Sep 12, 2013 Lirong Xia Introduction to computation.
NP-complete and NP-hard problems Transitivity of polynomial-time many-one reductions Concept of Completeness and hardness for a complexity class Definition.
The Theory of NP-Completeness
1 NP-Complete Problems. 2 We discuss some hard problems:  how hard? (computational complexity)  what makes them hard?  any solutions? Definitions 
Great Theoretical Ideas in Computer Science for Some.
CSC5160 Topics in Algorithms Tutorial 2 Introduction to NP-Complete Problems Feb Jerry Le
Introduction to Approximation Algorithms Lecture 12: Mar 1.
Computability and Complexity 13-1 Computability and Complexity Andrei Bulatov The Class NP.
CSE332: Data Abstractions Lecture 27: A Few Words on NP Dan Grossman Spring 2010.
© 2006 Pearson Addison-Wesley. All rights reserved14 A-1 Chapter 14 Graphs.
NP-complete and NP-hard problems Transitivity of polynomial-time many-one reductions Definition of complexity class NP –Nondeterministic computation –Problems.
1 Optimization problems such as MAXSAT, MIN NODE COVER, MAX INDEPENDENT SET, MAX CLIQUE, MIN SET COVER, TSP, KNAPSACK, BINPACKING do not have a polynomial.
NP-Complete Problems Reading Material: Chapter 10 Sections 1, 2, 3, and 4 only.
12/3CSE NP-complete CSE Algorithms NP Completeness Approximations.
Approximation Algorithms
The Theory of NP-Completeness
CSE 326: Data Structures NP Completeness Ben Lerner Summer 2007.
NP-complete and NP-hard problems
Analysis of Algorithms CS 477/677
1 CSE 417: Algorithms and Computational Complexity Winter 2001 Lecture 22 Instructor: Paul Beame.
P, NP, and NP-Complete Suzan Köknar-Tezel.
NP-complete and NP-hard problems. Decision problems vs. optimization problems The problems we are trying to solve are basically of two kinds. In decision.
1 Introduction to Approximation Algorithms Lecture 15: Mar 5.
The Theory of NP-Completeness 1. Nondeterministic algorithms A nondeterminstic algorithm consists of phase 1: guessing phase 2: checking If the checking.
The Theory of NP-Completeness 1. What is NP-completeness? Consider the circuit satisfiability problem Difficult to answer the decision problem in polynomial.
Scott Perryman Jordan Williams.  NP-completeness is a class of unsolved decision problems in Computer Science.  A decision problem is a YES or NO answer.
1 The Theory of NP-Completeness 2012/11/6 P: the class of problems which can be solved by a deterministic polynomial algorithm. NP : the class of decision.
Nattee Niparnan. Easy & Hard Problem What is “difficulty” of problem? Difficult for computer scientist to derive algorithm for the problem? Difficult.
Complexity Classes (Ch. 34) The class P: class of problems that can be solved in time that is polynomial in the size of the input, n. if input size is.
1 Introduction to Approximation Algorithms. 2 NP-completeness Do your best then.
MIT and James Orlin1 NP-completeness in 2005.
TECH Computer Science NP-Complete Problems Problems  Abstract Problems  Decision Problem, Optimal value, Optimal solution  Encodings  //Data Structure.
CSC 413/513: Intro to Algorithms NP Completeness.
Polynomial-time reductions We have seen several reductions:
Week 10Complexity of Algorithms1 Hard Computational Problems Some computational problems are hard Despite a numerous attempts we do not know any efficient.
CSE 024: Design & Analysis of Algorithms Chapter 9: NP Completeness Sedgewick Chp:40 David Luebke’s Course Notes / University of Virginia, Computer Science.
EMIS 8373: Integer Programming NP-Complete Problems updated 21 April 2009.
CSCI 3160 Design and Analysis of Algorithms Tutorial 10 Chengyu Lin.
1 The Theory of NP-Completeness 2 Cook ’ s Theorem (1971) Prof. Cook Toronto U. Receiving Turing Award (1982) Discussing difficult problems: worst case.
NP-Complete Problems. Running Time v.s. Input Size Concern with problems whose complexity may be described by exponential functions. Tractable problems.
1 Chapter 34: NP-Completeness. 2 About this Tutorial What is NP ? How to check if a problem is in NP ? Cook-Levin Theorem Showing one of the most difficult.
NP-COMPLETE PROBLEMS. Admin  Two more assignments…  No office hours on tomorrow.
NP-Complete problems.
NP-complete Problems Prof. Sin-Min Lee Department of Computer Science.
NP-Complete Problems Algorithm : Design & Analysis [23]
CS 3343: Analysis of Algorithms Lecture 25: P and NP Some slides courtesy of Carola Wenk.
CSE 589 Part V One of the symptoms of an approaching nervous breakdown is the belief that one’s work is terribly important. Bertrand Russell.
CPS Computational problems, algorithms, runtime, hardness (a ridiculously brief introduction to theoretical computer science) Vincent Conitzer.
CS6045: Advanced Algorithms NP Completeness. NP-Completeness Some problems are intractable: as they grow large, we are unable to solve them in reasonable.
Chapter 11 Introduction to Computational Complexity Copyright © 2011 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1.
NP Completeness Piyush Kumar. Today Reductions Proving Lower Bounds revisited Decision and Optimization Problems SAT and 3-SAT P Vs NP Dealing with NP-Complete.
CSC 413/513: Intro to Algorithms
Young CS 331 D&A of Algo. NP-Completeness1 NP-Completeness Reference: Computers and Intractability: A Guide to the Theory of NP-Completeness by Garey and.
The Theory of NP-Completeness 1. Nondeterministic algorithms A nondeterminstic algorithm consists of phase 1: guessing phase 2: checking If the checking.
Introduction to NP Instructor: Neelima Gupta 1.
1 1. Which of these sequences correspond to Hamilton cycles in the graph? (a) (b) (c) (d) (e)
1 The Theory of NP-Completeness 2 Review: Finding lower bound by problem transformation Problem X reduces to problem Y (X  Y ) iff X can be solved by.
The NP class. NP-completeness Lecture2. The NP-class The NP class is a class that contains all the problems that can be decided by a Non-Deterministic.
34.NP Completeness. Computer Theory Lab. Chapter 34P.2.
Conceptual Foundations © 2008 Pearson Education Australia Lecture slides for this course are based on teaching materials provided/referred by: (1) Statistics.
ICS 353: Design and Analysis of Algorithms NP-Complete Problems King Fahd University of Petroleum & Minerals Information & Computer Science Department.
Computational problems, algorithms, runtime, hardness
Lecture 22 Complexity and Reductions
NP-Completeness Yin Tat Lee
Linear Programming Duality, Reductions, and Bipartite Matching
CPS 173 Computational problems, algorithms, runtime, hardness
Presentation transcript:

Computational problems, algorithms, runtime, hardness (a brief introduction to theoretical computer science) slides by Vincent Conitzer

Set Cover (a computational problem) We are given: A finite set S = {1, …, n} A collection of subsets of S: S1, S2, …, Sm We are asked: Find a subset T of {1, …, m} such that Uj in TSj= S Minimize |T| Decision variant of the problem: we are additionally given a target size k, and asked whether a T of size at most k will suffice

Set Cover (a computational problem) One instance of the set cover problem: S = {1,2,3,4,5,6}, S1 = {1,2,4}, S2 = {3,4,5}, S3 = {1,3,6}, S4 = {2,3,5}, S5 = {4,5,6}, S6 = {1,3} Can you see why it is hard?

Visualizing Set Cover S = {1, …, 6}, S1 = {1,2,4}, S2 = {3,4,5}, S3 = {1,3,6}, S4 = {2,3,5}, S5 = {4,5,6}, S6 = {1,3} 2 3 4 1 6 5

Using glpsol to solve set cover instances How do we model set cover as an integer program? See examples

Algorithms and runtime We would see: the runtime of glpsol on set cover instances increases rapidly as the instances’ sizes increase if we drop the integrality constraint, can scale to larger instances Questions: Using glpsol on our integer program formulation is but one algorithm – maybe other algorithms are faster? different formulation; different optimization package (e.g., CPLEX); simply going through all the combinations one by one; … What is “fast enough”? Do (mixed) integer programs always take more time to solve than linear programs? Do set cover instances fundamentally take a long time to solve?

A simpler problem: sorting Given a list of numbers, sort them (Really) dumb algorithm: Randomly perturb the numbers. See if they happen to be ordered. If not, randomly perturb the whole list again, etc. Reasonably smart algorithm: Find the smallest number. List it first. Continue on to the next number, etc. Smart algorithm (MergeSort): It is easy to merge two lists of numbers, each of which is already sorted, into a single sorted list So: divide the list into two equal parts, sort each part with some method, then merge the two sorted lists into a single sorted list … actually, to sort each of the parts, we can again use MergeSort!

Polynomial time Let |x| be the size of problem instance x Let a be an algorithm for the problem Suppose that for any x, runtime(a,x) < cf(|x|) for some constant c and function f Then we say algorithm a’s runtime is O(f|x|) a is a polynomial-time algorithm if it is O(f(|x|)) for some polynomial function f P is the class of all problems that have at least one polynomial-time algorithm Many people consider an algorithm efficient if and only if it is polynomial-time

Two algorithms for a problem 2n 2n2 runtime run of algorithm 1 run of algorithm 2 Algorithm 1 is O(n2) (a polynomial-time algorithm) Algorithm 2 is not O(nk) for any constant k (not a polynomial-time algorithm) The problem is in P

Linear programming and (mixed) integer programming LP and (M)IP are also computational problems LP is in P Ironically, the most commonly used LP algorithms are not polynomial-time as an upper bound (but “usually” polynomial time) (M)IP is not known to be in P Most people consider being in P unlikely

Reductions Sometimes you can reformulate problem A in terms of problem B so that solving B solves A (i.e., reduce A to B) E.g., we have seen how to formulate several problems as linear programs or integer programs In this case problem A is at most as hard as problem B (B could be harder) For example, could get a cookie by donating blood, but donating blood is tougher. Since LP is in P, all problems that we can formulate using LP are in P Caveat: only true if the linear program itself can be created in polynomial time!

NP (“nondeterministic polynomial time”) Recall: decision problems require a yes or no answer NP: the class of all decision problems such that if the answer is yes, there is a simple proof of that E.g., “does there exist a set cover of size k?” If yes, then just show which subsets to choose! Technically: The proof must have polynomial length The correctness of the proof must be verifiable in polynomial time

P vs. NP Open problem: is it true that P=NP? The most important open problem in theoretical computer science (maybe in mathematics?) $1,000,000 Clay Mathematics Institute Prize Most people believe P is not NP If P were equal to NP… Current cryptographic techniques can be broken in polynomial time Computers can probably solve many difficult mathematical problems… … including the other Clay Mathematics Institute Prizes! 

NP-hardness A problem is NP-hard if the following is true: Suppose that it is in P Then P=NP So, trying to find a polynomial-time algorithm for it is like trying to prove P=NP Set cover is NP-hard Typical way to prove problem Q is NP-hard: Take a known NP-hard problem Q’ Reduce it to your problem Q (in polynomial time) E.g., (M)IP is NP-hard, because we have already reduced set cover to it (M)IP is more general than set cover, so it can’t be easier A problem is NP-complete if it is 1) in NP, and 2) NP-hard

ABSOLUTELY NOT A PROOF OF NP-HARDNESS: Reductions: To show problem Q is easy: reduce Problem known to be easy (e.g., LP) Q To show problem Q is (NP-)hard: Problem known to be (NP-)hard (e.g., set cover, (M)IP) reduce Q ABSOLUTELY NOT A PROOF OF NP-HARDNESS: reduce Q MIP

Independent Set In the below graph, does there exist a subset of vertices, of size 4, such that there is no edge between members of the subset? General problem (decision variant): given a graph and a number k, are there k vertices with no edges between them? NP-complete

Reducing independent set to set cover 2 1 3 , k=4 5 4 6 9 8 7 In set cover instance (decision variant), let S = {1,2,3,4,5,6,7,8,9} (set of edges), for each vertex let there be a subset with the vertex’s adjacent edges: {1,4}, {1,2,5}, {2,3}, {4,6,7}, {3,6,8,9}, {9}, {5,7,8} target size = #vertices - k = 7 - 4 = 3 Claim: answer to both instances is the same (why??) So which of the two problems is harder?

Weighted bipartite matching 3 4 5 2 1 6 1 3 7 Match each node on the left with one node on the right (can only use each node once) Minimize total cost (weights on the chosen edges)

Weighted bipartite matching… minimize cij xij where cij is edge cost and xij =1 if edge from i to j is chosen subject to for every i, Σj xij = 1 for every j, Σi xij = 1 for every i, j, xij ≥ 0 Theorem [Birkhoff-von Neumann]: this linear program always has an optimal solution consisting of just integers and typical LP solving algorithms will return such a solution So weighted bipartite matching is in P