Professional Documents
Culture Documents
Muhammad Abrar Ashraf: MS190400027 NP-Complete Example Theory of Computation (CS701)
Muhammad Abrar Ashraf: MS190400027 NP-Complete Example Theory of Computation (CS701)
Muhammad Abrar Ashraf: MS190400027 NP-Complete Example Theory of Computation (CS701)
Ashraf
MS190400027
NP-Complete Example
Theory of Computation (CS701)
Objectives
• What are P & NP problems
• What are NP-Hard problems
• What are NP-Complete Problems
• 3-partition problem
P & NP Problems
• The class P and Deterministic Turing Machine
• Given a decision problem X, if there is a polynomial time Deterministic Turing
Machine program that solves X, then X is belong to P
• Informally, there is a polynomial time algorithm to solve the problem
Continue…
• The class NP and Non-deterministic Turing Machine
• Given a decision problem X.
If there is a polynomial time Non-deterministic Turing machine program that solves
X, then X belongs to NP
• Given a decision problem X.
For every instance I of X,
(a) guess solution S for I, and
(b) check “is S a solution to I?”
If (a) and (b) can be done in polynomial time, then X belongs to NP.
Continue…
• One of the most important open problem in theoretical compute science :
Is P=NP ?
Most likely “No”.
Currently, there are many known (decision) problems in NP, and there is
no solution to show anyone of them in P.
NP-Hard Problem
• A problem is NP-hard if an algorithm for solving it can be translated into
one for solving any NP-problem (nondeterministic polynomial time)
problem.
• NP-hard therefore means "at least as hard as any NP-problem," although it
might, in fact, be harder.
NP-Complete Problems
• Stephen Cook introduced the notion of NP-Complete Problems.
• This makes the problem “P = NP ?” much more interesting to study.
• A problem which is both NP (verifiable in nondeterministic polynomial
time) and NP-hard (any NP-problem can be translated into this problem).
Examples of NP-hard problems include the Hamiltonian cycle and
traveling salesman problems.
3-Partition problem
• The 3-partition problem is an NP-complete problem in computer science.
• The problem is to decide whether a given multiset of integers can be
partitioned into triples that all have the same sum.
Continue…
• More precisely, given a multiset S of n = 3 m positive integers, can S be
partitioned into m triplets S1, S2, …, Sm.
• Such that the sum of the numbers in each subset is equal?
• The subsets S1, S2, …, Sm must form a partition of S in the sense that
they are disjoint and they cover S.
Continue…
• Let B denote the (desired) sum of each subset Si,
• or equivalently, let the total sum of the numbers in S be Bm .
• The 3-partition problem remains strongly NP-complete when every
integer in S is strictly between B/4 and B/2.
• The 3-partition problem is similar to the partition problem, which in turn
is related to the subset sum problem. In the partition problem, the goal is
to partition S into two subsets with equal sum.
Example
• The set { 20, 23, 25, 49, 45, 27, 40, 22, 19 }
• can be partitioned into the three set
• { 20, 25, 45 },
• { 23, 27, 40 },
• { 49, 22, 19 }
• each of which sum to 90.
NP-Completeness
• The 3-partition problem remains NP-complete even when the integers in S are
bounded above by a polynomial in n.
• In other words, the problem remains NP-complete even when representing the
numbers in the input instance in unary. i.e., 3-partition is NP-complete in the
strong sense or strongly NP-complete. This property, and 3-partition in general,
is useful in many reductions where numbers are naturally represented in unary.
• In contrast, the partition problem is known to be NP-complete only when the
numbers are encoded in non-unary system, and have value exponential in n.
THANKS