Lecture. Today Problem set 9 out (due next Thursday) Topics: –Complexity Theory –Optimization versus Decision Problems –P and NP –Efficient Verification.

Slides:



Advertisements
Similar presentations
NP-Hard Nattee Niparnan.
Advertisements

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,
Department of Computer Science & Engineering
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.
Computability and Complexity 13-1 Computability and Complexity Andrei Bulatov The Class NP.
Complexity Theory CSE 331 Section 2 James Daly. Reminders Project 4 is out Due Friday Dynamic programming project Homework 6 is out Due next week (on.
Hardness Results for Problems P: Class of “easy to solve” problems Absolute hardness results Relative hardness results –Reduction technique.
1 CSE 417: Algorithms and Computational Complexity Winter 2001 Lecture 21 Instructor: Paul Beame.
NP-Complete Problems Reading Material: Chapter 10 Sections 1, 2, 3, and 4 only.
The Theory of NP-Completeness
NP-Complete Problems Problems in Computer Science are classified into
Analysis of Algorithms CS 477/677
NP-Completeness NP-Completeness Graphs 4/17/2017 4:10 AM x x x x x x x
CSE 421 Algorithms Richard Anderson Lecture 27 NP Completeness.
Chapter 11: Limitations of Algorithmic Power
Toward NP-Completeness: Introduction Almost all the algorithms we studies so far were bounded by some polynomial in the size of the input, so we call them.
1 CSE 417: Algorithms and Computational Complexity Winter 2001 Lecture 22 Instructor: Paul Beame.
Chapter 11 Limitations of Algorithm Power Copyright © 2007 Pearson Addison-Wesley. All rights reserved.
Hardness Results for Problems P: Class of “easy to solve” problems Absolute hardness results Relative hardness results –Reduction technique.
Hardness Results for Problems
Complexity Theory: The P vs NP question Lecture 28 (Dec 4, 2007)
1.1 Chapter 1: Introduction What is the course all about? Problems, instances and algorithms Running time v.s. computational complexity General description.
The Theory of NP-Completeness 1. Nondeterministic algorithms A nondeterminstic algorithm consists of phase 1: guessing phase 2: checking If the checking.
MCS312: NP-completeness and Approximation Algorithms
Chapter 11 Limitations of Algorithm Power. Lower Bounds Lower bound: an estimate on a minimum amount of work needed to solve a given problem Examples:
A. Levitin “Introduction to the Design & Analysis of Algorithms,” 3rd ed., Ch. 11 ©2012 Pearson Education, Inc. Upper Saddle River, NJ. All Rights Reserved.
Computational Complexity Polynomial time O(n k ) input size n, k constant Tractable problems solvable in polynomial time(Opposite Intractable) Ex: sorting,
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.
Theory of Computing Lecture 15 MAS 714 Hartmut Klauck.
Great Theoretical Ideas in Computer Science.
Approximation Algorithms
CSC 172 P, NP, Etc. “Computer Science is a science of abstraction – creating the right model for thinking about a problem and devising the appropriate.
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.
CSE 3813 Introduction to Formal Languages and Automata Chapter 14 An Introduction to Computational Complexity These class notes are based on material from.
1 Lower Bounds Lower bound: an estimate on a minimum amount of work needed to solve a given problem Examples: b number of comparisons needed to find the.
CSC401 – Analysis of Algorithms Chapter 13 NP-Completeness Objectives: Introduce the definitions of P and NP problems Introduce the definitions of NP-hard.
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.
1 Design and Analysis of Algorithms Yoram Moses Lecture 11 June 3, 2010
COMPSCI 102 Introduction to Discrete Mathematics.
CSE373: Data Structures & Algorithms Lecture 22: The P vs. NP question, NP-Completeness Lauren Milne Summer 2015.
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.
Lecture 6 NP Class. P = ? NP = ? PSPACE They are central problems in computational complexity.
NP-Complete problems.
CS 3343: Analysis of Algorithms Lecture 25: P and NP Some slides courtesy of Carola Wenk.
CS6045: Advanced Algorithms NP Completeness. NP-Completeness Some problems are intractable: as they grow large, we are unable to solve them in reasonable.
Lecture 25 NP Class. P = ? NP = ? PSPACE They are central problems in computational complexity.
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.
COSC 3101A - Design and Analysis of Algorithms 14 NP-Completeness.
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.
ICS 353: Design and Analysis of Algorithms NP-Complete Problems King Fahd University of Petroleum & Minerals Information & Computer Science Department.
The Theory of NP-Completeness
The NP class. NP-completeness
Chapter 10 NP-Complete Problems.
EMIS 8373: Integer Programming
Decision trees Polynomial-Time
NP-Completeness Yin Tat Lee
ICS 353: Design and Analysis of Algorithms
Chapter 34: NP-Completeness
Chapter 11 Limitations of Algorithm Power
The Theory of NP-Completeness
Instructor: Aaron Roth
Algorithms CSCI 235, Spring 2019 Lecture 36 P vs
Presentation transcript:

Lecture

Today Problem set 9 out (due next Thursday) Topics: –Complexity Theory –Optimization versus Decision Problems –P and NP –Efficient Verification –NP- Completeness –Section: Network Flow

So Far... Algorithmic Techniques : Divide and Conquer, Greedy, Dynamic Programming, DFS) Data Structures: Trees, Heaps, Graphs Practice: many problems even if try every trick in the book, nothing seems to work Some Problems: Intrinsic Difficulty -- Domain of complexity Theory

Complexity Theory Halting problem: Given a computer program and an input, does the program halt on that input? -- Unsolvable Today: Look at problems which are Solvable but not efficiently

The Clique Problem Def: Let G=(V,E) be an undirected graph. A clique of G is a subset V’ of the vertices s.t. for all u,v in V’, (u,v) is an edge. I.e clique is a complete sub-graph of G

Optimization Problems Optimization: minimize of maximize some value Optimization Problem for Clique: Given graph G, find size of the largest clique. How to solve this problem? –For j = |V| down-to 1 try all subsets of j vertices, if find clique, output j. Time: 2 O(|V|) VERY SLOW! –Is there a “tractable” (efficient) algorithm? –What do you mean by tractable (efficient)?

Traveling Salesman problem Def: Given n cities and cost cij for traveling between every two cities, what is the cost of the cheapest way to visit every city exactly once and return to starting city. How to solve this problem? Try all possible orderings of cities, and evaluate each orderings cost, output the cheapest cost. Time: n! (for n cities ) Is there a “tractable” (efficient) algorithm?

Q:What do we mean by efficient: A: Polynomial Time Algorithms Defn: An algorithm runs in polynomial time if there exists k s.t. the running time is O(n k ) on any problem instance of size n. Q1: What do we mean by “size n”? Q2: Why is this a reasonable choice for “efficient”

Encoding A: Any problem instance can be encoded as a sequence of 0’s and 1’s Assume all numbers in encoding are in binary? Size of problem instance = length of encoding Multiple arguments are coded into 1 string. Choice of the encoding doesn’t matter as long as can compute one from another in polynomial time

Example : Factoring Given number n, determine m that divides n Suppose n is encoded in unary: …1 then check all numbers m=2,…,sqrt(n), takes O(sqrt(n) ) = O(sqrt(L)) divisions Suppose n is encoded in binary, L=log n, same procedure takes O(2 L/2 ) divisions L=n

Pitfalls Some functions don’t look like polynomials but are bounded above by one. E.g n log n<O(n 2 ) Sometime what you think is polynomial isn’t. Example: Take as input where G is a graph of n nodes, and k an integer. An algorithm of running time o(n k ) for this input, is NOT polynomial. Why? Because k is an input to the problem --- The constant in the polynomial should be independent of the input size.

Justification of ‘Efficient = Polynomial Time” Exponential time scales badly -- 2 n for n=1000 is larger than number of atoms in universe Want our theory of efficient algorithms to be model-independent (I.e hold for any reasonable model of computer). The polynomial-time definition of “efficiency” ensures this Bulk of problems that are solvable in polynomial time that are of practical interest, are bounded by small polynomial: MST, shortest path, numerical operation.

Polynomial Time Algorithms Most problems so far have poly time algorithms Q: Does Clique have a poly time algorithm? Q: Does TSP have a poly time algorithm? A: No one knows. TOC community would be surprised if answer is positive.

Decision Problems: Y/N output Decision problem for clique: Given, G=(V,E) is an undirected graph, k is an integer, does G have a clique of size k? For purely technical reason in complexity theory easier to deal with decision problems. Comment: Even though seems less natural, as complexity theory task is to show that certain problems cannot be solved efficiently, showing it for decision version implies it for corresponding optimization problem. Note: A polynomial time procedure for the clique decision problem should run in time poly(m,n,log k) where n=|V|, m=|E|

Theorem (for clique): optimization problem solvable in polynomial time iff decision problem solvable in polynomial time Proof (for clique): (opt dec) Find max clique size, compare with k (dec opt) Binary search. Natural Question: true for other problems? Yes…when the thing to be optimized has a polynomial # of possible values in the zize o fthe input instance

Search vs. Decision Search problem for clique: Given, either find a clique of size k, or say none exists. Theorem:Search Problem is solvable in polynomial time iff Decision problem is solved in polynomial time Proof: Suppose we have a magic-algorithm MB s.t MB( ) = yes iff there exists a clique of size k. Then, on : Run MB( ), if MB( ) = no, output no, else Order edges of G from 1,…,m, initialize G’= G, I=1 1. run MB( ) where G’ = G- edge I 2. If MB( ) = no, then G’=G + edge I, I= I+1, else I=I If I>n, output edge set of G’, else goto 1

Formal Languages Def: a formal language is a set of binary strings. Every decision problem can be viewed as a language CLIQUE = { : G has a clique of size k} (I.e binary encodings of all graphs G that have clique of size k) TSP = { : G has a TS Tour of cost < k} In general, for decision problem D, the corresponding language is L={x in S n : D(x)=1} where S n is the encoding alphabet. (e.g. for binary encoding S={0,1}

Decision Problem: Given where G is a graph, u, v vertices, and integer k>0, is there a path from u to v in G of length < k? Corresponding language: PATH = { : G is a graph, u,v vertices, k>=0 integer, and there is a path from u and v in G whose length is < k} Example: decision problem /corresponding language PATH

Algorithms and Decision Problems An algorithm accepts x if A(x)=1 An algorithm rejects x if A(x) =0 Might do neither, Language L is accepted by A: L={x, A(x)=1} Language L is decided by A: if A accepts L and A halts on all inputs

Class P P = { L in {0,1}*: there exists algorithm A s.t. L is accepted by A in polynomial time} P - class of languages accepted by a polynomial time algorithms Examples: shortest path, MST, sorting. Q: Clique ? TSP? A: No one knows, big open problem

Class NP NP: class of languages accepted by a non-deterministic algorithm in polynomial time What does this mean? Interpretation 1: A non-deterministic algorithm has many possible outcomes (like a probabilistic algorithm) but we require –if x is a YES instance, then Pr(A(x)=YES) >0 –if x is a NO instance, then Pr(A(x)=NO) = 1.

NP: Efficient Verification (version 2 informally ) NP : class of languages(problems) for which the YES instances have short proofs that the answer is YES. proof of polynomial size (in input size) that can be verified in polynomial time Example: CLIQUE in NP, since for all in CLIQUE there exists a short proof: subset of vertices V’ of size >=k, size of proof = O(|V|) verifying Procedure: check that for all u,v in V’, (u,v) in E time = O(|V| 2 ) Short Proof = Certificate

NP: Efficient Verification (formally) NP = {L s.t. there exists polynomial -time algorithm A, and integer k>0 s.t. x in L there exists y, |y|<|x| k, A(x,y) =YES x out L for all y, A(x,y) =NO} y= “short proof”= certificate Language verified by A, is L= {x, there exists y s.t. A(x,y)= YES} NP: class of polynomial time verifiable problems (EVEN IF they are hard to solve)

Theorem : P NP Let L be in P, then there a polynomial time algorithm which decides L, and can be converted into a verification algorithm HOW? BIG QUESTION: is P= NP Open for 25 years What we DO know: If we can solve CLIQUE in poly-time, then P=NP. NP-completeness (next time) UI

Summarize Decision Problems, Languages P: polynomial time solvable decision problems ( languages) Certificate:evidence that allows us to verify in polynomial time that an input is in a given language NP: polynomial time verifiable languages