Hard Problems Sanghyun Park Fall 2002 CSE, POSTECH.

Slides:



Advertisements
Similar presentations
NP-Hard Nattee Niparnan.
Advertisements

Hard Problems Some problems are hard to solve. No polynomial time algorithm is known Most combinatorial optimization problems are hard Popular NP-hard.
JAYASRI JETTI CHINMAYA KRISHNA SURYADEVARA
The Theory of NP-Completeness
© The McGraw-Hill Companies, Inc., Chapter 8 The Theory of NP-Completeness.
Computability and Complexity 23-1 Computability and Complexity Andrei Bulatov Search and Optimization.
RSA ( Rivest, Shamir, Adleman) Public Key Cryptosystem
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.
1 CSE 417: Algorithms and Computational Complexity Winter 2001 Lecture 21 Instructor: Paul Beame.
Transitivity of  poly Theorem: Let ,  ’, and  ’’ be three decision problems such that   poly  ’ and  ’  poly  ’’. Then  poly  ’’. Proof:
The Theory of NP-Completeness
Chapter 11: Limitations of Algorithmic Power
Chapter 11 Limitations of Algorithm Power Copyright © 2007 Pearson Addison-Wesley. All rights reserved.
Clique Cover Cook’s Theorem 3SAT and Independent Set
P, NP, and NP-Complete Suzan Köknar-Tezel.
1 The Theory of NP-Completeness 2 NP P NPC NP: Non-deterministic Polynomial P: Polynomial NPC: Non-deterministic Polynomial Complete P=NP? X = P.
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.
CSCE350 Algorithms and Data Structure
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.
Prabhas Chongstitvatana1 NP-complete proofs The circuit satisfiability proof of NP- completeness relies on a direct proof that L  p CIRCUIT-SAT for every.
DP TSP Have some numbering of the vertices We will think of all our tours as beginning and ending at 1 C(S, j) = length of shortest path visiting each.
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.
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.
EMIS 8373: Integer Programming NP-Complete Problems updated 21 April 2009.
1 Chapter 8 NP and Computational Intractability Slides by Kevin Wayne. Copyright © 2005 Pearson-Addison Wesley. All rights reserved.
1 The Theory of NP-Completeness 2 Cook ’ s Theorem (1971) Prof. Cook Toronto U. Receiving Turing Award (1982) Discussing difficult problems: worst case.
CSE 589 Part VI. Reading Skiena, Sections 5.5 and 6.8 CLR, chapter 37.
Unit 9: Coping with NP-Completeness
NP-Complete Problems. Running Time v.s. Input Size Concern with problems whose complexity may be described by exponential functions. Tractable problems.
Hard Problems Some problems are hard to solve.  No polynomial time algorithm is known.  E.g., NP-hard problems such as machine scheduling, bin packing,
Lecture 6 NP Class. P = ? NP = ? PSPACE They are central problems in computational complexity.
Design and Analysis of Algorithms - Chapter 101 Our old list of problems b Sorting b Searching b Shortest paths in a graph b Minimum spanning tree b Primality.
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.
“One ring to rule them all” Analogy (sort of) Lord of The Rings Computational Complexity “One problem to solve them all” “my preciousss…”
CS6045: Advanced Algorithms NP Completeness. NP-Completeness Some problems are intractable: as they grow large, we are unable to solve them in reasonable.
Chapter 13 Backtracking Introduction The 3-coloring problem
NPC.
CSC 413/513: Intro to Algorithms
CSE 421 Algorithms Richard Anderson Lecture 27 NP-Completeness Proofs.
The Theory of NP-Completeness 1. Nondeterministic algorithms A nondeterminstic algorithm consists of phase 1: guessing phase 2: checking If the checking.
COSC 3101A - Design and Analysis of Algorithms 14 NP-Completeness.
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.
Exhaustive search Exhaustive search is simply a brute- force approach to combinatorial problems. It suggests generating each and every element of the problem.
Hard Problems Some problems are hard to solve.  No polynomial time algorithm is known.  E.g., NP-hard problems such as machine scheduling, bin packing,
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
More NP-Complete and NP-hard Problems
Hard Problems Some problems are hard to solve.
SAT problem SAT – Boolean satisfiability problem
Richard Anderson Lecture 26 NP-Completeness
Lecture 2-2 NP Class.
NP-Completeness (2) NP-Completeness Graphs 7/23/ :02 PM x x x x
NP-Completeness Proofs
Richard Anderson Lecture 26 NP-Completeness
Hard Problems Introduction to NP
Design and Analysis of Algorithm
ICS 353: Design and Analysis of Algorithms
Richard Anderson Lecture 25 NP-Completeness
Richard Anderson Lecture 28 NP-Completeness
Approximation Algorithms
Prabhas Chongstitvatana
CS 3343: Analysis of Algorithms
CSE 6408 Advanced Algorithms.
The Theory of NP-Completeness
Hard Problems Some problems are hard to solve.
Our old list of problems
Presentation transcript:

Hard Problems Sanghyun Park Fall 2002 CSE, POSTECH

Hard Problems Some problems are hard to solve. – No polynomial time algorithm is known. – E.g., NP-hard problems such as machine scheduling, bin packing, 0/1 knapsack Is this necessarily bad? Data encryption relies on difficult to solve problems.

Cryptography encryption algorithm messageencryption key decryption algorithm decryption keymessage transmission channel

Public Key Cryptosystem (RSA) A public encryption method that relies on a public encryption algorithm, a public decryption algorithm, and a public encryption key. Using the public encryption key and public encryption algorithm, everyone can encrypt a message. The decryption key is known only to authorized parties.

Public Key Cryptosystem (RSA) p and q are two prime numbers. n = pq m = (p-1)(q-1) a is such that 1 < a < m and gcd(m,a) = 1. b is such that (ab) mod m = 1. a is computed by generating random positive integers and testing gcd(m,a) = 1 using the extended Euclid’s gcd algorithm. The extended Euclid’s gcd algorithm also computes b when gcd(m,a) = 1.

RSA Encryption and Decryption Message M < n. Encryption key = (a,n). Decryption key = (b,n). Encrypt => E = M a mod n. Decrypt => M = E b mod n.

Breaking RSA Factor n and determine p and q, n = pq. Now determine m = (p-1)(q-1). Now use Euclid’s extended gcd algorithm to compute gcd(m,a). b is obtained as a byproduct. The decryption key (b,n) has been determined.

Security of RSA Relies on the fact that prime factorization is computationally very hard. Let h be the number of bits in the binary representation of n. No algorithm, polynomial in h, is known to find the prime factors of n. Try to find the factors of a 100 bit number.

Satisfiability Problem The permissible values of a boolean variable are true and false. The complement of a boolean variable y is ŷ. A literal is a boolean variable or the complement of a boolean variable. A clause is the logical OR of two or more literals. Let y 1, y 2, y 3, …, y n be n boolean variables.

Satisfiability Problem Example clauses: – y 1 + y 2 + y 3 – y 4 + ŷ 7 + y 8 – y 3 + y 7 + y 9 + y 15 A boolean formula (in conjunctive normal form CNF) is the logical AND of m clauses. F = C 1 C 2 C 3 …C m

Satisfiability Problem F = (y 1 + y 2 + y 3 )(y 4 + ŷ 7 + y 8 )(y 2 + y 5 ) F is true when y 1, y 2 and y 4 (for example) are true.

Satisfiability Problem A boolean formula is satisfiable iff there is at least one true assignment to its variables for which the formula evaluates to true. Determining whether a boolean formula in CNF is satisfiable is NP-hard.

Other Problems Partition – Partition n positive integers s 1, s 2, s 3, …, s n into two groups A and B such that the sum of the numbers in each group is the same. [9,4,6,3,5,1,8] A = [9,4,5] and B = [6,3,1,8] NP-hard

Subset Sum Problem Does any subset of n positive integers s 1, s 2, s 3, …, s n have a sum exactly equal to c? [9,4,6,3,5,1,8] and c = 18 A = [9,4,5] NP-hard

Traveling Salesperson Problem (TSP) Let G be a weighted directed graph. A tour in G is a cycle that includes every vertex of the graph. TSP => Find a tour of shortest length. Problem is NP-hard.

Applications of TSP

Each vertex is a city that is in Joe’s sales district. The weight on edge (u,v) is the time it takes Joe to travel from city u and city v. Once a month, Joe leaves his home city, visits all cities in his district, and returns home. The total time he spends on this tour of his district is the travel time plus the time spent at the cities. To minimize total time, Joe must use a shortest-length tour.

Applications of TSP Tennis practice. Start with a basket of approximately 200 tennis balls. When balls are depleted, we have 200 balls lying on and around the court. The balls are to be picked up by a robot (more realistically, the tennis player). The robot starts from its station and visits each ball exactly once (i.e., picks up each ball) and returns to its station.

Applications of TSP 201 vertex TSP. 200 tennis balls and robot station are the vertices. Complete directed graph. Length of an edge (u,v) is the distance between the two objects represented by vertices u and v. Actually, we may want to minimize the sum of the time needed to compute a tour and the time spent picking up the balls using the computed tour.

Applications of TSP Manufacturing A robot arm is used to drill n holes in a metal sheet. n+1 vertex TSP.

n-Queens Problem A queen that is placed on an n x n chessboard may attack any piece placed in the same column, row, or diagonal.

n-Queens Problem Can n queens be placed on an n x n chessboard so that no queen may attack another queen?

n-Queens Problem

Difficult Problems Many require you to find either a subset or permutation that satisfies some constraints and (possibly also) optimizes some objective function. May be solved by organizing the solution space into a tree and systematically searching this tree for the answer.

Subset Problems Solution requires you to find a subset of n elements. The subset must satisfy some constraints and possibly optimize some objective function. Examples – Partition – Subset sum – 0/1 knapsack – Satisfiability (find subset of variables to be set to true) – Scheduling 2 machines – Packing 2 bins

Permutation Problems Solution requires you to find a permutation of n elements. The permutation must satisfy some constraints and possibly optimize some objective function. Examples – TSP – n-queens

Solution Space Set that includes at least one solution to the problem. Subset problem – n = 2, {00, 01, 10, 11} – n = 3, {000, 001, 010, , 101, 110, 111} Solution space for subset problem has 2 n members. Nonsystematic search of the space for the answer takes O(p2 n ) time, where p is the time needed to evaluate each member of the solution space.

Solution Space Permutation problem – n = 2, {12, 21} – n = 3, {123, 132, 213, 231, 312, 321} Solution space for a permutation problem has n! members. Nonsystematic search of the space for the answer takes O(pn!) time, where p is the time needed to evaluate a member of the solution space.