The Classes P and NP. mohamed@elwakil.net



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

Complexity Classes P and NP

CAD Algorithms. P and NP

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

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

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

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

On the Relationship between Classes P and NP

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

Computational complexity theory

Quantum and Non-deterministic computers facing NP-completeness

OHJ-2306 Introduction to Theoretical Computer Science, Fall

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

Lecture 7: NP-Complete Problems

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

Theoretical Computer Science (Bridging Course) Complexity

Tutorial 8. NP-Complete Problems

Notes on NP Completeness

Introduction to Logic in Computer Science: Autumn 2006

Exponential time algorithms for graph coloring

Chapter 7 Uncomputability

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

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

Chapter 6: Graph Theory

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

CMPSCI611: Approximating MAX-CUT Lecture 20

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

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

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

Algorithm Design and Analysis

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

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

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

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

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

Applied Algorithm Design Lecture 5

Quantum Monte Carlo and the negative sign problem

Introduction to computer science

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

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

The P versus NP Solution

IE 680 Special Topics in Production Systems: Networks, Routing and Logistics*

On the k-path cover problem for cacti

The Union-Find Problem Kruskal s algorithm for finding an MST presented us with a problem in data-structure design. As we looked at each edge,

Honors Class (Foundations of) Informatics. Tom Verhoeff. Department of Mathematics & Computer Science Software Engineering & Technology

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

Boulder Dash is NP hard

Can linear programs solve NP-hard problems?

A Fast Algorithm For Finding Hamilton Cycles

ONLINE DEGREE-BOUNDED STEINER NETWORK DESIGN. Sina Dehghani Saeed Seddighin Ali Shafahi Fall 2015

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

11. APPROXIMATION ALGORITHMS

5. A full binary tree with n leaves contains [A] n nodes. [B] log n 2 nodes. [C] 2n 1 nodes. [D] n 2 nodes.

The Classes P and NP

1 Definitions. Supplementary Material for: Digraphs. Concept graphs

Minesweeper as a Constraint Satisfaction Problem

Guessing Game: NP-Complete?

Evaluation of Complexity of Some Programming Languages on the Travelling Salesman Problem

8.1 Min Degree Spanning Tree

What are the place values to the left of the decimal point and their associated powers of ten?

Reminder: Complexity (1) Parallel Complexity Theory. Reminder: Complexity (2) Complexity-new

CIS 700: algorithms for Big Data

CS5310 Algorithms 3 credit hours 2 hours lecture and 2 hours recitation every week

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

The K-Observer Problem in Computer Networks

A Working Knowledge of Computational Complexity for an Optimizer

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

How To Solve The Line Connectivity Problem In Polynomatix

CSC 373: Algorithm Design and Analysis Lecture 16

Automata Theory. Şubat 2006 Tuğrul Yılmaz Ankara Üniversitesi

NP-Completeness and Cook s Theorem

Compact Representations and Approximations for Compuation in Games

Chapter 1. Computation theory

Algebraic Computation Models. Algebraic Computation Models

SOLVING NARROW-INTERVAL LINEAR EQUATION SYSTEMS IS NP-HARD PATRICK THOR KAHL. Department of Computer Science

CSE 326, Data Structures. Sample Final Exam. Problem Max Points Score 1 14 (2x7) 2 18 (3x6) Total 92.

MATHEMATICAL THOUGHT AND PRACTICE. Chapter 7: The Mathematics of Networks The Cost of Being Connected

5.1 Bipartite Matching

Tetris is Hard: An Introduction to P vs NP

Measuring the Performance of an Agent

Classification - Examples

INTEGER PROGRAMMING. Integer Programming. Prototype example. BIP model. BIP models

Chapter. NP-Completeness. Contents

Million Dollar Mathematics!

A hybrid ACO algorithm for the Capacitated Minimum Spanning Tree Problem

CSE 135: Introduction to Theory of Computation Decidability and Recognizability

Bicolored Shortest Paths in Graphs with Applications to Network Overlay Design

Data Mining Cluster Analysis: Basic Concepts and Algorithms. Lecture Notes for Chapter 8. Introduction to Data Mining

1 Definition of a Turing machine

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

Solutions to Homework 6

Transcription:

Intractable Problems The Classes P and NP Mohamed M. El Wakil mohamed@elwakil.net 1

Agenda 1. What is a problem? 2. Decidable or not? 3. The P class 4. The NP Class 5. TheNP Complete class 2

What is a problem? A problem is a question to be answered. What is the value of X/Y? A problem usually has parameters. X, and Y A decision problem, is a version of the problem with only two possible answers: Yes or No! Given two numbers X, and Y, does Y evenly divide X? An instance: a specific problem instance Does 3 evenly divide 6? 3

Decidable or not? A decidable problem, is a problem that could be solved using a computer. An undecidable problem, is a problem that t can never be solved using a computer, neither now or in the future. Only decidable problems! 4

Classification We need to classify problems in terms of their computability. Three classes: P class NP Class NP Complete class 5

P class, wrt Computers Problems with at least one algorithm that solves the problem in polynomial ltime wrt to the input size. Polynomial time The number of steps needed relates polynomially to the size of the input. O(n 2 ), O(n 9 ), O(n c ), where c is a constant. but NOT O(n!), O(2 n ), when n is the size of the input. 6

P class, wrt Turing Machines Problems solvable in polynomial time using a Dt Deterministic iiti Turing Machine (DTM) bl belong to the class P. Polynomial time The number of moves needed relates polynomially to the size of the input. n 2, 17n 3, 9n 4, but NOT 2 n DTM A Turing machine with a tape, head, transition function, and a set of states. 7

P Problem (MWST) Minimum Weight Spanning Tree Given a weighted graph G, find the minimum weight spanning tree. In other words, convert the given graph into a tree, that includes allthe nodes of the original graph, and minimizes the summation of weights of the edges in the resulting tree. 8

MWST Example Problem Instance Source: http://en.wikipedia.org/wiki/kruskal's_algorithm 9

Kruskal's s algorithm The MWST problem belongs bl to the P class of problems, since there is an algorithm that solves it in polynomial ltime. Kruskal's algorithm O(n 2 ) Create a forest F (a set of trees), where each vertex in the graph is a separate tree Create a set S containing all the edges in the graph While S is nonempty Remove an edge with minimum weight from S If that edge connects two different trees, then add it to the forest, combining two trees into a single tree Otherwise discard that edge 10

MWST Example Possible Solution Source: http://en.wikipedia.org/wiki/kruskal's_algorithm 11

NP class, wrt Turing Machines Problems solvable in polynomial time using a Non Deterministic Turing Machine (NDTM) belong to the class NP. NDTM A DTM, with two stages of processing: guessing, and checking. 12

Non Deterministic Turing Machine Guessing: Guess a solution, and then write it down to the tape. Checking: Evaluate the guess to decide whether it solves the problem or not. The number of guessed solutions, can be either polynomial or exponential. If the number of guessed solutions is polynomial, l then, the NDTM is equivalent to a DTM. 13

NP class, wrt Computers Problems that can be solved within an exponential time wrt the input size. This includes problems that can be solved din polynomial time. 14

Important A DTM is a NDTM that has a polynomial number of guesses. According to the dfiii definition of NP, the MWST problem is an NP problem. 15

NP Problem Example Travelling Salesman Problem (TSP) Given a number of cities and the costs of traveling from any city to any other city, what is the cheapest round trip route that visits each city exactly once andthen returns to the starting city? Source: http://en.wikipedia.org/wiki/traveling_salesman_problem problem 16

Solving the TSP There is no one single algorithm that solves this problem in polynomial time The only way, is to enumerate all possible itineraries and checking them one by one. For n cities, there are n! routes 17

Polynomial Time Reduction A problem P1, is polynomially reducible to problem P2, if there is a process that takes an instance of P1 as an input, and outputs a corresponding instance of P2 in polynomial time. P1: a * b P2: ((a+b) 2 a 2 b 2 )/2 18

NP Complete Class A problem P is NP Complete If: P is in NP For every problem L in NP, there is a polynomial time reduction from L to P. If P1 is NP Complete, and there is polynomial l time reduction from P1 to P2, then P2 is NP Complete. 19

NP complete lt problems family tree 20

The NP World Source: http://en.wikipedia.org/wiki/complexity_classes_p_and_np 21

Intractable Problems The Classes P and NP Mohamed M. El Wakil mohamed@elwakil.net 22