NP-Completeness and Approximability of Knapsack Problem, Study notes of Computer Science

The np-completeness of the knapsack problem and its approximability. Definitions, facts, propositions, and algorithms related to the knapsack problem and its optimization and decision versions. It also mentions the relationship between knapsack and other np-complete problems such as subset sum and vertex cover.

Typology: Study notes

Pre 2010

Uploaded on 08/19/2009

koofers-user-lgh-1
koofers-user-lgh-1 🇺🇸

9 documents

1 / 22

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
CMPSCI 601: Recall From Last Time Lecture 21
To prove
is NP-complete:
Prove
NP.
Prove
, where
is known to be NP-complete.
The following problems are NP-Complete:
SAT (Cook-Levin Theorem)
3-SAT
3-COLOR
CLIQUE
Subset Sum
Knapsack (decision version)
1
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16

Partial preview of the text

Download NP-Completeness and Approximability of Knapsack Problem and more Study notes Computer Science in PDF only on Docsity!

CMPSCI 601: Recall From Last Time Lecture 21

To prove

is NP-complete:

 Prove  NP.

 Prove   , where  is known to be NP -complete.

The following problems are NP-Complete:

 SAT (Cook-Levin Theorem)

 3-SAT

 3-COLOR

 CLIQUE

 Subset Sum

 Knapsack (decision version)

Knapsack

Given objects:

object     weight    value        = max weight I can carry in my knapsack.

Optimization Problem:

choose   

to maximize (^)   

such that (^)   



Decision Problem:

Given!  "!

 $# , can I get total value # while total

weight is 

 ?

CMPSCI 601: Approximability Lecture 21

Fact: NP-complete decision problems are all equiva- lent.

Belief: NP-complete problems require exponential time in the worst case.

Fact: Difficulty of NP Approximation problems varies widely.

Definition 21.

is an NP-optimization problem iff  For each instance ,   ,     is the

set of feasible solutions. We can test in P whether

  .  Each    has a cost   Z. The cost  is computable in   P.

For minimization problems,

OPT     



For maximization problems,

OPT     

 

Four Classes of NP Optimization Problems

INAPPROX no PTIME  -approx alg if P

 NP

APPROX      

 

 

 exists PTIME   -approx alg no PTIME   -approx alg if P

 NP

PTAS   exists PTIME  -approx alg

FPTAS   exists uniform  -approx alg running in time poly(   )

(F)PTAS stands for (Fully) Polynomial-Time Approxima- tion Scheme.

exists P approx alg for
poly in n, 1/ ε
some but not all
all
no ε

APPROX

P

FPTAS (^) Knapsack

PTAS ETSP

Clique TSP

VertexCover MAX SAT^ ∆TSP

INAPPROX

Better: Find a Maximal Matching

  1.  



2. while ( 



 ) do 

  1. pick   
  1.       
  2. delete    from 

The edges picked are a maximal matching , a disjoint set of edges to which we can’t add another disjoint edge. If there are  edges in this matching, we’ve used   nodes in  but any algorithm would have to use at least .

  opt     Best known approx ratio

A Hamilton circuit for an undirected graph is a cycle

that starts and ends at some vertex  and visits every other vertex exactly once.

HC  

has a Hamilton Circuit

Fact 21.5 HC is NP -Complete. (Nicest proof is in Sipser.)

TSP     #   

has a HC of weight  

  #   , 

, let     #        ,

     

     

 if   

 otherwise

Observation 21.6 For any undirected graph ,

HC   

TSP

Corollary 21.7 If TSP has a polynomial-time  -

approximation algorithm for any 

 , then P = NP. Thus, TSP

INAPPROX_._

i k

j TSP: TSP where         

Claim 21.10 Minimum Spanning Tree is a lower bound for

TSP  MST  

TSP_._

Proof: Visualize optimal tour:

Delete one edge and we have a spanning tree. 

Theorem 21.11 c(MST)  

TSP   c(MST)

Proof: The multigraph  MST, made by taking two copies of each edge in the tree, is connected and all its nodes have even degree.

8

(^1 2 ) 1

4

2 3 (^5465)

6

7

8

3

Thus it has an Euler’s tour, providing an    approxi- mation algorithm. 

Christofides Algorithm (1976)

In the MST, only worry about the odd degree nodes.

There are an even number of vertices of odd degree.

In polynomial time we can find a minimum weight per-

fect matching, , on the odd-degree nodes.

MST  is an Eulerian graph.

MST  TSP;   TSP.

Thus, we get a tour at most 1.5 times optimal.   

Euclidean TSP

ETSP: Euclidean distance in plane:

         

       

ETSP has a Polynomial-Time Approximation Scheme (PTAS) [Arora 1997].

Definition 21.12 We say that accepts iff the follow-

ing conditions hold:

1. If

, there exists a proof



 , such that accepts

for every random string  ,

2. If

, for every proof



, rejects for most of the

random strings  ,



Any decision problem

NP has a deterministic, polynomial- time verifier satisfying Definition ??.

By adding randomness to the verifier, we can greatly re- strict its computational power and the number of bits of  that it needs to look at, while still enabling it to accept all of NP.

We say that a verifier is 

   - restricted iff for

all inputs of size , and all proofs



^ ,^ uses at most

  random bits and examines at most

   bits

of its proof,

 .

Let PCP 

    be the set of boolean queries that are

accepted by 

    -restricted verifiers.

Fact 21.13 (PCP Theorem) NP  PCP   

The proof of this theorem is pretty messy, certainly more than we can deal with here. But we can look at the appli- cations of the PCP Theorem to approximation problems.