Title: EMIS 8373: Integer Programming
1EMIS 8373 Integer
Programming
- NP-Complete Problems
- updated 21 April 2009
2The Class of NP-Complete Problems (NPC)
- A problem q is NP-complete if
- It is in NP and,
- Any other problem p in NP is polynomial reducible
to q. - Implications of q being NP-complete
- If q is NP-complete then q is at least as hard as
every other problem in NP. - If there is an efficient (polynomial) algorithm
for q, then there is an efficient algorithm for
every problem in NP (i.e., P NP).
3Boolean Algebra
- A Boolean variable can either be true or false.
- There are three operators in Boolean algebra
- x ? y true if x true and y true, and false
otherwise. - x ? y true if at least one of x and y is true.
- ?x true if x is false, and false if x is true.
4Boolean Formulae
- A Boolean formula is satisfiable if there exists
at least one truth assignment of its variables
such that it evaluates to true. - Example f(x1,x2,x3) ?x3 ? (x1 ? ?x2 ? x3)
- f(true,true,false) true
- f(false,false,false) true
- f is satisfiable.
- (x1 ? ?x2 ? x3) is an example of a clause
containing the literals x1 , ?x2 , and x3 .
5An Unsatisfiable Formula
Suppose x1 is true gt x3 must also be true to
satisfy clause 4 gt x2 must also be true to
satisfy clause 3 gt all three variables are true
gt clause 5 is false gt the formula evaluates to
false
Suppose x1 is false gt x2 must also be false to
satisfy clause 2 gt x3 must also be false to
satisfy clause 3 gt all three variables are
false gt clause 1 is false gt the formula
evaluates to false
6The Satisfiability (SAT) Problem
- Input A set of m clauses C1, C2, , Cm
involving n Boolean variables x1, x2, , xn. - Note that a clause contains only ? and ?
operators. - Question Is C1? C2 ? ? Cm satisfiable?
- Cooks Theorem (1971) SAT is NP-Complete.
- Every problem in NP is polynomial reducible to
SAT. - If there is a polynomial-time algorithm for SAT,
then there is a polynomial-time algorithm for
every problem in NP.
7Binary Integer Programming (BIP)
- Instance
- A set of n binary variables x1, x2, , xn, and
- m constraints
ai1x1 ai2x2 ainxn ? (, or
?) bi - Question Is the following problem feasible?
8BIP is NP-Complete
- Show that BIP is in NP
- The size of a BIP instance is O(mn).
- The complexity of checking a proposed solution to
an instance of BIP is O(mn). - Each constraint requires n multiplications, n-1
additions, and one comparison to verify. - Show that some other NP-complete problem can be
formulated as BIP with a polynomial reduction.
9BIP is NP-Complete Reduction from SAT
- Let x1, x2, , xn, be the binary variables in the
BIP instance. - For each clause Ci in the SAT instance let ci be
a constraint in the BIP instance - Let Bi be the set of literals in Ci with a ?
operator and let Ai be the other literals in Ci - Add the following constraint to the BIP instance
- The reduction is clearly polynomial since the BIP
has the same size as the SAT instance.
10Example SAT to BIP Reduction
11Proof yes SAT ? yes BIP
12Proof yes BIP ? yes SAT
Setting literal xi true in the SAT formula if
variable xi 1 in the BIP solution and xi
false otherwise ensures that each clause
evaluates to true since at least one Ai literal
will be true or at least one Bi literal will be
false.
13Complexity of BIP
- SAT is NP-complete (Cooks theorem)
- BIP is in NP
- BIP is at least as hard as SAT (reduction)
- BIP is NP-complete
14The Clique Problem
- Input An undirected graph G (V, E), and an
integer k. - Question Is there a k-clique in G?
- A k-clique is a subset U ? V of k nodes such that
for every pair of nodes in i ? U and j ? U, the
edge (i, j) ? E.
15Show that CLIQUE is NP-Complete
- Show that CLIQUE is in NP
- We can verify whether or not a given set of k
nodes is a clique in O(k2) time. - Show that some other NP-complete problem is
polynomial reducible to CLIQUE. - Give an efficient formulation of some other
NP-complete problem as CLIQUE - We will use a reduction from SAT
16Reduction from SAT to CLIQUE
- Let f C1? C2 ? ? Cm be the SAT instance where
Ci (?i1 or ?i2 or or ?i,s(i)) and s(i) is the
number of literals in clause i. - Say that a pair of literals x and ?x are
complementary. - Let G (V, E) where
- V ?ij 1 ? i ? m and 1 ? j ? s(i)
- (?ij, ?hk) is an edge in E if i ? h, and ?ij and
?hk are not complementary - Let k m
17Example Reduction of SAT to CLIQUE
18Example Reduction SAT to CLIQUE
19Example Reduction SAT to CLIQUE
20Correctness of the Reduction
- The graph will have at most mn nodes and fewer
than (mn)(mn-1)/2 edges. Therefore the time to
construct the graph is polynomial in the number
of variables and clauses of the SAT instance.
21Correctness of the Reduction Feasible SAT ?
Feasible Clique
- Consider a truth assignment that makes the
Boolean formula true. - At least one literal in each clause must be true.
- Select one such literal from each clause.
- This gives us k literals.
- Since no pair of these k literals can be
complementary, the corresponding set of k nodes
in G forms a clique. - Thus, a yes instance of SAT yields a yes
instance of Clique.
22Correctness of the Reduction Feasible Clique
? Feasible SAT
- Suppose that G contains a k-clique.
- Consider the k literals that correspond to the
nodes in the k-clique. - Each literal must come from a different clause.
- No pair of the k literals can be complementary
(otherwise there would be no edge between the
corresponding nodes). - Setting each of the k literals to true makes the
formula evaluate to true. - Thus, the given SAT instance must be satisfiable.
23STABLE SET
- Input A graph G (V, E), and an integer k.
- Question Is there a set of k vertices U ? V such
that there are no edges between any pair of
vertices in U?
24STABLE SET is NP-Complete
- Given a set of k nodes in V, we can verify that
there are no edges between them in O(k2) time.
Thus, STABLE SET is in NP. - Reduction Let G (V, E), k be an instance of
CLIQUE and let H (V, F) be the complement of G
where (i, j) ? F if (i, j) ? E, and (i, j) ? F if
(i, j) ? E. - If v1, v2, , vk is a clique in G, then it is a
stable set in H. - If v1, v2, , vk is a stable set in H, then it
is a clique in G.
25Reducing CLIQUE to STABLE SET
G
3
2
H
3
2
1
1
5
4
5
4
3-Clique 2, 3, 4
Stable Set 2, 3, 4
26Tree of Reductions (Karp 72)
SAT
CLIQUE
3-SAT
BIP
STABLE SET
TSP
3D-Matching
3-Exact Cover
0-1 Knapsack
Integer Knapsack
27Cooks theorem
SAT
CLIQUE
BIP
STABLE SET
TSP
0-1 Knapsack
28Recognition vs. Optimization TSP Example
Is there a TSP tour of length k or less?
3
3
2
4
5
1
k 35
yes
7
3
1
7
no
5
k 5
2
yes
k (35 5)/2 20
5
4
1
yes
k ? (205)/2 ?13
no
k (135)/2 9
no
k (139)/2 11
yes
k (1311)/2 12
29Optimization vs. Recognition
- An optimization problem is said to be NP-hard if
its recognition problem is NP-complete. - Many important optimization problems are NP-hard.
- NP-hard problems are considered theoretically
intractable (difficult to solve). - A problem can be NP-hard in general, but have
special cases that are polynomial. - Example MCNFP (easy) is a special case of ILP
(hard).