Lecture 21 Approximation Algorithms
Introduction
Earlier Results on Approximations
• Vertex-Cover
• Traveling Salesman Problem
• Knapsack Problem
Performance Ratio
MAX.for )(
)(sup
MINfor )(
)(sup
inputApprox
inpuOptr
inputOpt
inputApproxr
input
input
Constant-Approximation
• c-approximation is a polynomial-time approximation satisfying:
1 < approx(input)/opt(input) < c for MIN
or
1 < opt(input)/approx(input) < c for MAX
Vertex Cover
• Given a graph G=(V,E), find a minimum subset C of vertices such that every edge is incident to a vertex in C.
Vertex-Cover
• The vertex set of a maximal matching gives 2-approximation, i.e.,
approx / opt < 2
Traveling Salesman
• Given n cities with a distance table, find a minimum total-distance tour to visit each city exactly once.
Traveling Salesman with triangular inequality
• Traveling around a minimum spanning tree is a 2-approximation.
Traveling Salesman with Triangular Inequality
• Minimum spanning tree + minimum-length perfect matching on odd vertices is 1.5-approximation
Minimum perfect matching on odd verticeshas weight at most 0.5 opt.
Lower Bound
1+ε 1+ε
1+ε
1 1
1+ε 1+ε
n
n
nn as
2
3
)1)(12(2
)1(2
Traveling Salesman without Triangular Inequality
Theorem For any constant c> 0, TSP has no c-approximation unless NP=P.
Given a graph G=(V,E), define a distance table on V as follows:
EvucV
Evuvud
),( if ,||
),( if ,1),(
Contradition Argument
• Suppose c-approximation exists. Then we have a polynomial-time algorithm to solve Hamiltonian Cycle as follow:
C-approximation solution < cn
if and only if
G has a Hamiltonian cycle
Knapsack
}. ,max{Output
. such that Choose
.Sort
.any for Hence .any for Assume
}.1 ,0{
t.s.
max
1
1
1
11
2
2
1
1
2211
2211
k
k
i
iG
k
i
i
k
i
i
n
n
ii
i
nn
nn
ccc
sSsk
s
c
s
c
s
c
ioptciSs
x
Sxsxsxs
xcxcxc
2-approximation
.1
1
11
2 GkGG
k
ii
k
ii
cccoptc
coptc
PTAS
• A problem has a PTAS (polynomial-time approximation scheme) if for any ε > 0, it has a (1+ε)-approximation.
Knapsack has PTAS
• Classify: for i < m, ci < a= cG,
for i > m+1, ci > a.• Sort
• For
.2
2
1
1
m
m
s
c
s
c
s
c
;0)(set then , if
},,,1{
IcSs
nmI
Ii
i
1
).(max)(Output
.)(
set and
such that maximum choose then , If
1
1
IcIc
ccIc
sSs
mkSs
Ioutput
k
i
i
Ii
i
Ii
i
k
i
i
Ii
i
Proof. }.in 1 | },...,1{{*Let optxnmiI i
1)(
.1
)(
)()( Hence,
.*)(
*)( then , If
.*)( then , If
1*1
*1
output
output
outputoutput
kIi
im
ii
Iii
m
ii
Ic
opt
optIc
aIcoptIc
aIc
cIcoptsSs
optIcsSs
Time
.)( timegives This
./)1(2||
with hoseconsider tonly need weTherefore,
.2)/)1(2(
then,)/2(1 |I| If .2 Note
)/1(/)1(2
O
GIi
i
G
nnO
I
I
optcac
copt
Fully PTAS
• A problem has a fully PTAS if for any ε>0, it has (1+ε)-approximation running in time poly(n,1/ε).
Fully FTAS for Knapsack
exists.subset such no if ),(
}}.,...,1{
, | {min
and ,
such that i} ..., {1,in indeces ofsubset a is ),(
),(
),(),(
niljic
iI
jcss
Ssjc
jic
Iii
Iii
jicii
jicii
jicii
Pseudo Polynomial-time Algorithm for Knapsak
• Initially,
otherwise
, if {1}
,0 if
),1(
,1for
1
1
nil
cj
j
jc
cc, ... cj nsum
).,1(),(Set
.
but ,),1( 2. Case
);,1(),(Set
,),1( 1. Case
do to0for
do to1for
),1(
jicjic
Sss
nilcjic
jicjic
nilcjic
cj
ni
icjickki
i
i
sum
}.),( | max{Output
}.{),1(),(set else
),1(),(set then
If
.),1( and
,,),1( 4. Case
}.{),1(),(Set
.),1( and
,,),1( 3. Case
),1(),1(
),1(
),1(
niljicjopt
icjicjic
jicjic
sss
niljic
Sssnilcjic
icjicjic
niljic
Sssnilcjic
i
jickk
cjickki
cjickkii
i
cjickkii
i
i
i
Time
• outside loop: O(n)• Inside loop: O(nM) where M=max ci
• Core: O(n log (MS))
• Total O(n M log (MS))
• Since input size is O(n log (MS)), this is a pseudo-polynomial-time due to M=2
3
log M
h
nh
nhhh
h
i
nn
nn
ii
ch
opt
xcxcxcc
ShnhnO
x
x
Sxsxsxs
xcxcxc
M
hncc
)1
1(
show We.Let
)).)1(log()1((
in time computed becan solution optimal Its
}.1 ,0{
s.t.
''' max
Consider
)1('Set
2211
4
2211
2211
)1
11(
1
)1()*)1
)1((*)1
)1(((
)1()*'*'(
)1()''(
*** Suppose
11
11
11
11
.2211
hopt
h
Mopt
hn
Mx
M
hncx
M
hnc
hn
Mxcxc
hn
Mxcxc
xcxcc
xcxcxcopt
nn
nn
nh
nh
nh
nhh
nn
Lecture 3 Complexity of Approximation
• L-reduction
• Two subclass of PTAS
• Set-cover ((ln n)-approximation)
• Independent set (n -approximation)c