NP-COMPLETE Prof. Manjusha Amritkar Assistant Professor Department of Information Technology Hope Foundation’s International Institute of Information.

Slides:



Advertisements
Similar presentations
Analysis of Algorithms
Advertisements

JAYASRI JETTI CHINMAYA KRISHNA SURYADEVARA
Polynomial-time reductions We have seen several reductions:
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 
1 Polynomial Time Reductions Polynomial Computable function : For any computes in polynomial time.
The Theory of NP-Completeness
NP-Complete Problems Problems in Computer Science are classified into
Analysis of Algorithms CS 477/677
NP-complete examples CSC3130 Tutorial 11 Xiao Linfu Department of Computer Science & Engineering Fall 2009.
CSE 421 Algorithms Richard Anderson Lecture 27 NP Completeness.
CSCE350 Algorithms and Data Structure
Tonga Institute of Higher Education Design and Analysis of Algorithms IT 254 Lecture 8: Complexity Theory.
NP Complexity By Mussie Araya. What is NP Complexity? Formal Definition: NP is the set of decision problems solvable in polynomial time by a non- deterministic.
Week 10Complexity of Algorithms1 Hard Computational Problems Some computational problems are hard Despite a numerous attempts we do not know any efficient.
NP-COMPLETENESS PRESENTED BY TUSHAR KUMAR J. RITESH BAGGA.
CSCI 3160 Design and Analysis of Algorithms Tutorial 10 Chengyu Lin.
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 Algorithm : Design & Analysis [23]
NP-Completeness (Nondeterministic Polynomial Completeness) Sushanth Sivaram Vallath & Z. Joseph.
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.
Chapter 11 Introduction to Computational Complexity Copyright © 2011 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1.
NPC.
1 Ch 10 - NP-completeness Tractable and intractable problems Decision/Optimization problems Deterministic/NonDeterministic algorithms Classes P and NP.
CSCI 2670 Introduction to Theory of Computing December 2, 2004.
CSE 421 Algorithms Richard Anderson Lecture 27 NP-Completeness Proofs.
COSC 3101A - Design and Analysis of Algorithms 14 NP-Completeness.
ICS 353: Design and Analysis of Algorithms NP-Complete Problems King Fahd University of Petroleum & Minerals Information & Computer Science Department.
NP-Completeness A problem is NP-complete if: It is in NP
The NP class. NP-completeness
NP-Completeness (2) NP-Completeness Graphs 4/13/2018 5:22 AM x x x x x
NP-Complete Problems.
More NP-complete problems
P & NP.
Chapter 10 NP-Complete Problems.
Computational Complexity Theory
Richard Anderson Lecture 26 NP-Completeness
Advanced Algorithms Analysis and Design
NP-Completeness (2) NP-Completeness Graphs 7/23/ :02 PM x x x x
NP-Completeness (2) NP-Completeness Graphs 7/23/ :02 PM x x x x
Richard Anderson Lecture 26 NP-Completeness
Hard Problems Introduction to NP
NP-Completeness Yin Tat Lee
ICS 353: Design and Analysis of Algorithms
NP-Completeness (2) NP-Completeness Graphs 11/23/2018 2:12 PM x x x x
Richard Anderson Lecture 25 NP-Completeness
CS 583 Fall 2006 Analysis of Algorithms
NP-Complete Problems.
DESIGN PATTERNS : State Pattern
Composition & Resolution of Forces
CS 3343: Analysis of Algorithms
DESIGN PATTERNS : Adapter Pattern
NP-Completeness Yin Tat Lee
P, NP and NP-Complete Problems
Software Design Methodologies and Testing
Differential Equation
BINARY HEAP Prof ajitkumar shitole Assistant Professor Department of computer engineering Hope Foundation’s International Institute of Information.
Hope Foundation’s International Institute of Information.
Essay Writing Writing is an art Prepared by Vaidehi Banerjee
CSE 589 Applied Algorithms Spring 1999
Introduction to Human Computer Interaction
P, NP and NP-Complete Problems
Design procedure for an Integrator
Our old list of problems
RAIK 283 Data Structures & Algorithms
DAA - Introduction Dr. Sashikala Mishra Associate Professor Department of Computer Engineering Hope Foundation’s INTERNATIONAL INSTITUTE OF INFORMATION.
NP-Completeness (2) NP-Completeness Graphs 7/9/2019 6:12 AM x x x x x
Lecture 23 NP-Hard Problems
Presentation transcript:

NP-COMPLETE Prof. Manjusha Amritkar Assistant Professor Department of Information Technology Hope Foundation’s International Institute of Information Technology, I²IT www.isquareit.edu.in

The Traveling Salesman Problem Suppose that you are given the road map of India. You need to find a traversal that covers all the cities/towns/villages of population ≥ 1, 000. And the traversal should have a short distance, say, ≤ 9, 000 kms. You will have to generate a very large number of traversals to find out a short traversal. Suppose that you are also given a claimed short traversal. It is now easy to verify that given claimed traversal is indeed a short traversal. Hope Foundation’s International Institute of Information Technology, I²IT P-14,Rajiv Gandhi Infotech Park MIDC Phase 1, Hinjawadi, Pune – 411057 Tel - +91 20 22933441/2/3 | www.isquareit.edu.in | info@isquareit.edu.in

The Bin Packing Problem Suppose you have a large container of volume 1000 cubic meter and 150 boxes of varying sizes with volumes between 10 to 25 cubic meters. You need to fit at least half of these boxes in the container. You will need to try out various combinations of 75 boxes (there are 1040 combinations) and various ways of laying them in the container to find a fitting. Suppose that you are also given a set of 75 boxes and a way of laying them. It is now easy to verify if these 75 boxes layed out in the given way will fit in the container. Hope Foundation’s International Institute of Information Technology, I²IT P-14,Rajiv Gandhi Infotech Park MIDC Phase 1, Hinjawadi, Pune – 411057 Tel - +91 20 22933441/2/3 | www.isquareit.edu.in | info@isquareit.edu.in

Hall-I Room Allocation Each wing of Hall-I has 72 rooms. Suppose from a batch of 540 students, 72 need to be housed in C-wing. There are several students that are “incompatible” with each other, and so no such pair should be present in the wing. If there are a large number of incompatibilities, you will need to try out many combinations to get a correct one. Suppose you are also given the names of 72 students to be housed. It is now easy to verify if they are all compatible. Hope Foundation’s International Institute of Information Technology, I²IT P-14,Rajiv Gandhi Infotech Park MIDC Phase 1, Hinjawadi, Pune – 411057 Tel - +91 20 22933441/2/3 | www.isquareit.edu.in | info@isquareit.edu.in

Discovery versus Verification In all these problems, finding a solution appears to be far more difficult than checking the correctness of a given solution. Informally, this makes sense as discovering a solution is often much more difficult than verifying its correctness. Can we formally prove this? Leads to the P versus NP problem. Hope Foundation’s International Institute of Information Technology, I²IT P-14,Rajiv Gandhi Infotech Park MIDC Phase 1, Hinjawadi, Pune – 411057 Tel - +91 20 22933441/2/3 | www.isquareit.edu.in | info@isquareit.edu.in

Formalizing Easy-to-solve A problem is easy to solve if the solution can be computed quickly. Gives rise to two questions: I. How is it computed? II. How do we define “quickly”? Hope Foundation’s International Institute of Information Technology, I²IT P-14,Rajiv Gandhi Infotech Park MIDC Phase 1, Hinjawadi, Pune – 411057 Tel - +91 20 22933441/2/3 | www.isquareit.edu.in | info@isquareit.edu.in

Computing Method We will use an algorithm to compute. In practice, the algorithm will run on a computer via a computer program. Hope Foundation’s International Institute of Information Technology, I²IT P-14,Rajiv Gandhi Infotech Park MIDC Phase 1, Hinjawadi, Pune – 411057 Tel - +91 20 22933441/2/3 | www.isquareit.edu.in | info@isquareit.edu.in

Algorithms An algorithm is a set of precise instructions for computation. The algorithm can perform usual computational steps, e.g., assignments, arithmetic and Boolean operations, loops. For us, an algorithm will always have input presented as a sequence of bits. The input size is the number of bits in the input to the algorithm. The algorithm stops after outputting the solution. Hope Foundation’s International Institute of Information Technology, I²IT P-14,Rajiv Gandhi Infotech Park MIDC Phase 1, Hinjawadi, Pune – 411057 Tel - +91 20 22933441/2/3 | www.isquareit.edu.in | info@isquareit.edu.in

Time Complexity of Problems A problem has time complexity TA(n) if there is an algorithm A that solves the problem on every input. Addition has time complexity O(n). Multiplication has time complexity O(n2) Hope Foundation’s International Institute of Information Technology, I²IT P-14,Rajiv Gandhi Infotech Park MIDC Phase 1, Hinjawadi, Pune – 411057 Tel - +91 20 22933441/2/3 | www.isquareit.edu.in | info@isquareit.edu.in

Time Measurement Let A be an algorithm and x be an input to it. Let TA(x) denote the number of steps of the algorithm on input x. Let TA(n) denote the maximum of TA(x) over all inputs x of size n. We will use TA(n) to quantify the time taken by algorithm A to solve a problem on different input sizes. For example, an algorithm A that adds two n bit numbers using school method has TA(n) = O(n). An algorithm B that multiplies two n bits numbers using school method has TA(n) = O(n2) Hope Foundation’s International Institute of Information Technology, I²IT P-14,Rajiv Gandhi Infotech Park MIDC Phase 1, Hinjawadi, Pune – 411057 Tel - +91 20 22933441/2/3 | www.isquareit.edu.in | info@isquareit.edu.in

Quantifying Easy-to-compute The problems of adding and multiplying are definitely easy. Also, if a problem is easy, and another problem can be solved in time n · T(n) where T(n) is the time complexity of the easy problem, then the new problem is also easy. This leads to the following definition: A problem is efficiently solvable if its time complexity is n O(1) . Such problems are also called polynomial-time problems. Hope Foundation’s International Institute of Information Technology, I²IT P-14,Rajiv Gandhi Infotech Park MIDC Phase 1, Hinjawadi, Pune – 411057 Tel - +91 20 22933441/2/3 | www.isquareit.edu.in | info@isquareit.edu.in

The Class P The class P contains all efficiently solvable problems. Specifically, they are the problems that can be solved in time O(n k) for some constant k, where n is the size of input to the problem. Hope Foundation’s International Institute of Information Technology, I²IT P-14,Rajiv Gandhi Infotech Park MIDC Phase 1, Hinjawadi, Pune – 411057 Tel - +91 20 22933441/2/3 | www.isquareit.edu.in | info@isquareit.edu.in

The Class NP NP = Non-Deterministic polynomial time The class NP contains those problems that are “verifiable” in polynomial time. e.g 1. Hamiltonian cycle Hope Foundation’s International Institute of Information Technology, I²IT P-14,Rajiv Gandhi Infotech Park MIDC Phase 1, Hinjawadi, Pune – 411057 Tel - +91 20 22933441/2/3 | www.isquareit.edu.in | info@isquareit.edu.in

Hamiltonian Cycle Determining whether a directed graph has a Hamiltonian cycle does not have a polynomial time algorithm (yet!) However if someone was to give you a sequence of vertices, determining whether or not that sequence forms a Hamiltonian cycle can be done in polynomial time Therefore Hamiltonian cycles are in NP Hope Foundation’s International Institute of Information Technology, I²IT P-14,Rajiv Gandhi Infotech Park MIDC Phase 1, Hinjawadi, Pune – 411057 Tel - +91 20 22933441/2/3 | www.isquareit.edu.in | info@isquareit.edu.in

SAT A boolean formula is satisfiable if there exists some assignment of the values 0 and 1 to its variables that causes it to evaluate to 1. CNF – Conjunctive Normal Form. ANDing of clauses of ORs Hope Foundation’s International Institute of Information Technology, I²IT P-14,Rajiv Gandhi Infotech Park MIDC Phase 1, Hinjawadi, Pune – 411057 Tel - +91 20 22933441/2/3 | www.isquareit.edu.in | info@isquareit.edu.in

(xy)(yz)(xz)(zy) 2-CNF SAT Each or operation has two arguments that are either variables or negation of variables The problem in 2 CNF SAT is to find true/false(0 or 1) assignments to the variables in order to make the entire formula true. Any of the OR clauses can be converted to implication clauses (xy)(yz)(xz)(zy) Hope Foundation’s International Institute of Information Technology, I²IT P-14,Rajiv Gandhi Infotech Park MIDC Phase 1, Hinjawadi, Pune – 411057 Tel - +91 20 22933441/2/3 | www.isquareit.edu.in | info@isquareit.edu.in

2-SAT is in P Create the implication graph x y x y z z Hope Foundation’s International Institute of Information Technology, I²IT P-14,Rajiv Gandhi Infotech Park MIDC Phase 1, Hinjawadi, Pune – 411057 Tel - +91 20 22933441/2/3 | www.isquareit.edu.in | info@isquareit.edu.in

Satisfiability via path finding If there is a path from And if there is a path from Then FAIL! How to find paths in graphs? DFS/BFS and modifications thereof Hope Foundation’s International Institute of Information Technology, I²IT P-14,Rajiv Gandhi Infotech Park MIDC Phase 1, Hinjawadi, Pune – 411057 Tel - +91 20 22933441/2/3 | www.isquareit.edu.in | info@isquareit.edu.in

3 CNF SAT (3 SAT) Not so easy anymore. Implication graph cannot be constructed No known polytime algorithm Is it NP? If someone gives you a solution how long does it take to verify it? Make one pass through the formula and check This is an NP problem Hope Foundation’s International Institute of Information Technology, I²IT P-14,Rajiv Gandhi Infotech Park MIDC Phase 1, Hinjawadi, Pune – 411057 Tel - +91 20 22933441/2/3 | www.isquareit.edu.in | info@isquareit.edu.in

References Contents are referred from following web resources https://www.seas.upenn.edu/~bhusnur4/cit596_sp ring2014/PNP.pptx https://www.cse.iitk.ac.in/users/manindra/present ations/IITKTalk.pdf

THANK YOU For further details, please contact Manjusha Amritkar manjushaa@isquareit.edu.in Department of Information Technology Hope Foundation’s International Institute of Information Technology, I²IT P-14,Rajiv Gandhi Infotech Park MIDC Phase 1, Hinjawadi, Pune – 411057 Tel - +91 20 22933441/2/3 www.isquareit.edu.in | info@isquareit.edu.in