CS 583 Fall 2006 Analysis of Algorithms

Slides:



Advertisements
Similar presentations
Analysis of Algorithms
Advertisements

Complexity Classes: P and NP
NP-Hard Nattee Niparnan.
Department of Computer Science & Engineering
Complexity class NP Is the class of languages that can be verified by a polynomial-time algorithm. L = { x in {0,1}* | there exists a certificate y with.
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 
Complexity 15-1 Complexity Andrei Bulatov Hierarchy Theorem.
1 Introduction to Computability Theory Lecture12: Reductions Prof. Amos Israeli.
Tractable and intractable problems for parallel computers
1 Module 9 Recursive and r.e. language classes –representing solvable and half-solvable problems Proofs of closure properties –for the set of recursive.
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
Chapter 11: Limitations of Algorithmic Power
Chapter 11 Limitations of Algorithm Power Copyright © 2007 Pearson Addison-Wesley. All rights reserved.
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:
CSCE350 Algorithms and Data Structure
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.
MS 101: Algorithms Instructor Neelima Gupta
Tonga Institute of Higher Education Design and Analysis of Algorithms IT 254 Lecture 8: Complexity Theory.
Prabhas Chongstitvatana1 NP-complete proofs The circuit satisfiability proof of NP- completeness relies on a direct proof that L  p CIRCUIT-SAT for every.
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.
Prabhas Chongstitvatana1 NP-Complete What is an algorithm What is a proof What is a hard problem NP-Complete problems -- practical problems that are strongly.
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.
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.
Umans Complexity Theory Lectures Lecture 1a: Problems and Languages.
NP-COMPLETE PROBLEMS. Admin  Two more assignments…  No office hours on tomorrow.
NP-Algorithms Tractable vs Intractable Some problems are intractable: as they grow large, we are unable to solve them in reasonable time.
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.
CS6045: Advanced Algorithms NP Completeness. NP-Completeness Some problems are intractable: as they grow large, we are unable to solve them in reasonable.
1 CPSC 320: Intermediate Algorithm Design and Analysis July 30, 2014.
NP-Completeness  For convenience, the theory of NP - Completeness is designed for decision problems (i.e. whose solution is either yes or no).  Abstractly,
Lecture. Today Problem set 9 out (due next Thursday) Topics: –Complexity Theory –Optimization versus Decision Problems –P and NP –Efficient Verification.
COSC 3101A - Design and Analysis of Algorithms 14 NP-Completeness.
34.NP Completeness. Computer Theory Lab. Chapter 34P.2.
CSE 332: NP Completeness, Part II Richard Anderson Spring 2016.
Conceptual Foundations © 2008 Pearson Education Australia Lecture slides for this course are based on teaching materials provided/referred by: (1) Statistics.
Chapters 11 and 12 Decision Problems and Undecidability.
ICS 353: Design and Analysis of Algorithms NP-Complete Problems King Fahd University of Petroleum & Minerals Information & Computer Science Department.
NP-Complete Problems.
Data Structures and Algorithm Analysis Lecture 24
P & NP.
Chapter 10 NP-Complete Problems.
Advanced Algorithms Analysis and Design
Analysis and design of algorithm
ICS 353: Design and Analysis of Algorithms
Decidable Languages Costas Busch - LSU.
Chapter 34: NP-Completeness
Chapter 11 Limitations of Algorithm Power
NP-Complete Problems.
Prabhas Chongstitvatana
NP-completeness The Chinese University of Hong Kong Fall 2008
Prabhas Chongstitvatana
P, NP and NP-Complete Problems
P, NP and NP-Complete Problems
The Polynomial Hierarchy Enumeration Problems 7.3.3
Our old list of problems
RAIK 283 Data Structures & Algorithms
ADVANCED COMPUTATIONAL MODELS AND ALGORITHMS
Presentation transcript:

CS 583 Fall 2006 Analysis of Algorithms NP-Completeness CS 583 Fall 2006 Analysis of Algorithms 1/16/2019 CS583 Fall'06: NP-Completeness

CS583 Fall'06: NP-Completeness Outline HW2/3 Status Overview Showing a problem to be NPC Polynomial time Abstract problems Encodings Verification in Polynomial Time NP-completeness Self-test 34.1-2, 34.2-3 Final exam details 1/16/2019 CS583 Fall'06: NP-Completeness

CS583 Fall'06: NP-Completeness HW 2/3 Status It is very likely that HW2 grades have been lost. HW2 solutions are posted on the web. Therefore, HW3 becomes “mandatory” to avoid losing 10 points. The deadline is extended to Saturday, December 9 (midnight). The online submission needs to be e-mailed to the instructor. The answers will posted on 12/10. If HW2 grades are recovered before 12/16, they will be taken into account. 1/16/2019 CS583 Fall'06: NP-Completeness

CS583 Fall'06: NP-Completeness Overview Three classes of problems: Class P consists of those problems that are solvable in polynomial time. An algorithm runs in O(nk) for some constant k, where n is the size of the input. Class NP consists of problems that are “verifiable” in polynomial time. It can be verified in polynomial time that a given solution is feasible. A problem is in the class NPC if it is in NP, and is as “hard” as any other problem in NP. If any NP-complete problem can be solved in polynomial time, then every problem in NP has a polynomial time algorithm. Most computer scientists believe NPC problems are intractable, i.e. P  NP. 1/16/2019 CS583 Fall'06: NP-Completeness

Showing a Problem to be NPC Decision problems versus optimization problems. Many problems of interest are optimization problems: Each feasible solution has an associated value, and we wish to find the one with the best value. For example, the graph coloring problem: use the least number of colors, so that no two adjacent vertices are colored the same. NP-completeness applies to decision problems: The answer to a problem is “yes” or “no”. For example, the graph coloring decision problem: can a graph be colored with k colors? An optimization problem can be cast to a decision problem. The decision problem is “easier” as once an optimization problem is solved, its related decision problem is solved as well. 1/16/2019 CS583 Fall'06: NP-Completeness

CS583 Fall'06: NP-Completeness Reductions We show that one decision problem is no easier or harder than another one. Suppose we have a decision problem A that we wish to solve in polynomial time. Assume we have a decision problem B that we can solve in polynomial time. Develop a procedure that converts an instance (input)  of A into instance  of B as follows. The transformation takes polynomial time. The answers are the same: the answer for  is “yes” if and only if the answer for  is also “yes”. 1/16/2019 CS583 Fall'06: NP-Completeness

CS583 Fall'06: NP-Completeness Reductions (cont.) Such procedure is called a reduction algorithm as it allows solving A in polynomial time: Given an instance  of A, use a polynomial-time reduction algorithm to transform it to an instance  of B. Run B in polynomial time on input . Use the answer for  as the answer for . It can be shown that if it is proven that A is intractable, then B cannot be solved in polynomial time as well. Proof: by contradiction. 1/16/2019 CS583 Fall'06: NP-Completeness

CS583 Fall'06: NP-Completeness A First NPC Problem The technique of reduction relies on having a problem known to be NP-complete. Hence we need to start with some NPC problem. The “first” such problem we use is the circuit-satisfiability problem: Given a boolean combinational circuit composed of AND, OR, and NOT gates, We wish to know if there’s any set of boolean inputs to this circuit that causes its output to be 1. 1/16/2019 CS583 Fall'06: NP-Completeness

CS583 Fall'06: NP-Completeness Polynomial time The polynomial time problems are considered tractable for the following reasons: A problem that runs in (n100) is practically intractable. However, In practice there are very few such problems. When a problem running in (n100) is solved, it is likely that much better algorithms are discovered. A problem that can be solved in polynomial time in one model, can be solved in P time in another. Parallel algorithms. Class P has closure properties. An algorithm composed of P-time algorithms is also polynomial. 1/16/2019 CS583 Fall'06: NP-Completeness

CS583 Fall'06: NP-Completeness Abstract Problems An abstract problem Q is a binary relation on a set I of problem instances, and a set S of solutions: Q: I  S, e.g., (i1, s1)  Q, where i1  I, s1  S. Decision problems have a yes/no solution: S = {0, 1} Example: graph coloring decision problem COLOR: If i = (G, k) is an instance of the problem COLOR, then COLOR(i) = 1 (yes) if graph G can be colored with k colors COLOR(i) = 0 (no) otherwise Recall that more practical optimization problems can be recast as decision problems. 1/16/2019 CS583 Fall'06: NP-Completeness

CS583 Fall'06: NP-Completeness Concrete Problems An encoding of a set S of abstract objects is a mapping e from S to the set of binary strings. Example: natural numbers (set N={0,1,2,...}) can be represented as binary numbers: e(3) = 11, e(4) = 100, ... , e(17) = 10001 An algorithm that “solves” some abstract decision problem takes an encoding of a problem instance as input. A problem whose instance set is a set of binary strings is called a concrete problem. An algorithm solves a concrete problem in O(T(n)) time, where n = |i| A problem is polynomial-time solvable if T(n) = nk for some constant k. The complexity class P is a set of concrete decision problems that are polynomial-time solvable. 1/16/2019 CS583 Fall'06: NP-Completeness

Formal-Language Framework The machinery of formal-language theory is very convenient for decision problems. An alphabet  is a finite set of symbols. A language L over  is any set of strings made up of symbols from . For example,  ={0,1}, L = {10,11,101, ...} – prime numbers An empty string is denoted by , An empty language is denoted by . The language of all strings over  is denoted *. For example,  ={0,1}, * = {, 0 , 1, 00, 10, 11, 101, ...} – the set of all binary strings. 1/16/2019 CS583 Fall'06: NP-Completeness

Formal-Language Framework (cont.) Operations on languages: Union and intersection follow directly from set operations. The complement of L is  L = * - L. The concatenation of two languages L1 and L2 is the language L = {x1x2: x1  L1 and x2  L2} The closure, or Kleene star of language L is L* = {}  L  L2  L3  ... Hence, the set of instances for any decision problem Q is simply the set *, where  = {0,1}. 1/16/2019 CS583 Fall'06: NP-Completeness

Formal-Language Framework (cont.) Q is a language L over  = {0,1}, where L = {x  * : Q(x) = 1} Expressing the relation between decision problems and algorithms. An algorithm A accepts a string x  {0,1}* if given input x, the algorithm outputs A(x) = 1. An algorithm rejects x if A(x) = 0. The language accepted by A is L = {x  {0,1}* : A(x) = 1} A language L is decided by A if every binary string in L is accepted by A, and every binary string not in L is rejected by A. 1/16/2019 CS583 Fall'06: NP-Completeness

Formal-Language Framework (cont.) A language L is accepted in polynomial time by algorithm A if: it is accepted by A, and there is a constant k such that for any x  L, |x| = n it accepts x in O(nk). A language L is decided in polynomial time if: there is a constant k such that for any x  {0,1}*, |x| = n, A correctly decides whether x  L in O(nk). Thus, to accept a language, an algorithm only needs to consider strings in L, but to decide it, it needs to consider every string in {0,1}*. The complexity class P: P = {L  {0,1}* : there exists an algorithm A that decides L in polynomial time} 1/16/2019 CS583 Fall'06: NP-Completeness

Hamiltonian Cycle Problem A hamiltonian cycle of a graph G=(V,E) is a simple cycle that contains all vertices in V. A graph that contains a hamiltonian cycle is called hamiltonian. The Hamiltonian cycle problem defined in a formal language: HAM-CYCLE = {<G> : G is a hamiltonian graph} Brute-force algorithm: Take each permutation of vertices and check if it’s a hamiltonian graph. Running time: Assume the encoding is its adjacency matrix of size n. The number of vertices m = (n1/2). There are m! possible permutations of vertices. The running time of such algorithm is (m!) = (n1/2!) = (2n1/2) – not polynomial! 1/16/2019 CS583 Fall'06: NP-Completeness

Verification Algorithm When a certain permutation of vertices is given, it can be verified if it’s a hamiltonian cycle in O(n2) time. A verification algorithm is a two-argument algorithm A: One argument is an input string x. The other argument is a binary string y called a certificate. A verifies an input x if there exists a certificate y such that A(x,y) = 1 The language verified by A is L = {x  {0,1}* : there exists y  {0,1}* such that A(x,y) = 1} A verifies L if for any string x  L, there is a certificate y that A can use to prove that x  L. In the HAM-CYCLE problem, the certificate is the list of vertices in some hamiltonian cycle. If the graph is hamiltonian, the cycle is sufficient to verify the fact. If it is not hamiltonian, no such certificate exists. 1/16/2019 CS583 Fall'06: NP-Completeness

The Complexity Class NP NP is the class of languages that can be verified by a polynomial-time algorithm A(x,y): L = {x  {0,1}* : there exists a certificate y with |y| = O(|x|c) such that c is constant and A(x,y) = 1} We say that algorithm A verifies language L in polynomial time. If L P, then L NP If there is a polynomial time algorithm to decide L, it can be converted to a verification algorithm to ignore the certificate. Hence P  NP. It is unknown if P = NP The class of NP-complete algorithms makes this question even more intriguing: If one NPC algorithm can be solved in polynomial time, then every problem in NP has a polynomial time solution! 1/16/2019 CS583 Fall'06: NP-Completeness

CS583 Fall'06: NP-Completeness Final Exam Taking the exam: The exam will be available to take in a classroom. The exam will be available online on case-by-case basis only. The exceptions will be granted based on good cause. The online version will be distributed by e-mail. The NEW session will be open during the exam for student questions. The student evaluations will be taken before the exam. Exam details: It is an “open everything” exam. The duration is 2.5 hours, -- from 7:45 to 10:15. It consists of 4 main problems (10 points each), and 2 bonus questions (2 points each). The exam covers the contents of all classes, although it will contain more questions from the second half of the course (after the midterm exam). Overall grading: A: 90+ points B+: 85+; B: 80+; B-: 75+ C: 65+; D: 60+ 1/16/2019 CS583 Fall'06: NP-Completeness