29
Lecture 21 Approximation Algorithms Introduction

Lecture 21 Approximation Algorithms Introduction

Embed Size (px)

Citation preview

Page 1: Lecture 21 Approximation Algorithms Introduction

Lecture 21 Approximation Algorithms

Introduction

Page 2: Lecture 21 Approximation Algorithms Introduction

Earlier Results on Approximations

• Vertex-Cover

• Traveling Salesman Problem

• Knapsack Problem

Page 3: Lecture 21 Approximation Algorithms Introduction

Performance Ratio

MAX.for )(

)(sup

MINfor )(

)(sup

inputApprox

inpuOptr

inputOpt

inputApproxr

input

input

Page 4: Lecture 21 Approximation Algorithms Introduction

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

Page 5: Lecture 21 Approximation Algorithms Introduction

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.

Page 6: Lecture 21 Approximation Algorithms Introduction

Vertex-Cover

• The vertex set of a maximal matching gives 2-approximation, i.e.,

approx / opt < 2

Page 7: Lecture 21 Approximation Algorithms Introduction

Traveling Salesman

• Given n cities with a distance table, find a minimum total-distance tour to visit each city exactly once.

Page 8: Lecture 21 Approximation Algorithms Introduction

Traveling Salesman with triangular inequality

• Traveling around a minimum spanning tree is a 2-approximation.

Page 9: Lecture 21 Approximation Algorithms Introduction

Traveling Salesman with Triangular Inequality

• Minimum spanning tree + minimum-length perfect matching on odd vertices is 1.5-approximation

Page 10: Lecture 21 Approximation Algorithms Introduction

Minimum perfect matching on odd verticeshas weight at most 0.5 opt.

Page 11: Lecture 21 Approximation Algorithms Introduction

Lower Bound

1+ε 1+ε

1+ε

1 1

1+ε 1+ε

n

n

nn as

2

3

)1)(12(2

)1(2

Page 12: Lecture 21 Approximation Algorithms Introduction

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),(

Page 13: Lecture 21 Approximation Algorithms Introduction

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

Page 14: Lecture 21 Approximation Algorithms Introduction

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

Page 15: Lecture 21 Approximation Algorithms Introduction

2-approximation

.1

1

11

2 GkGG

k

ii

k

ii

cccoptc

coptc

Page 16: Lecture 21 Approximation Algorithms Introduction

PTAS

• A problem has a PTAS (polynomial-time approximation scheme) if for any ε > 0, it has a (1+ε)-approximation.

Page 17: Lecture 21 Approximation Algorithms Introduction

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

Page 18: Lecture 21 Approximation Algorithms Introduction

).(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

Page 19: Lecture 21 Approximation Algorithms Introduction

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

Page 20: Lecture 21 Approximation Algorithms Introduction

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

Page 21: Lecture 21 Approximation Algorithms Introduction

Fully PTAS

• A problem has a fully PTAS if for any ε>0, it has (1+ε)-approximation running in time poly(n,1/ε).

Page 22: Lecture 21 Approximation Algorithms Introduction

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

Page 23: Lecture 21 Approximation Algorithms Introduction

Pseudo Polynomial-time Algorithm for Knapsak

• Initially,

otherwise

, if {1}

,0 if

),1(

,1for

1

1

nil

cj

j

jc

cc, ... cj nsum

Page 24: Lecture 21 Approximation Algorithms Introduction

).,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

Page 25: Lecture 21 Approximation Algorithms Introduction

}.),( | 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

Page 26: Lecture 21 Approximation Algorithms Introduction

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

Page 27: Lecture 21 Approximation Algorithms Introduction

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

Page 28: Lecture 21 Approximation Algorithms Introduction

)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

Page 29: Lecture 21 Approximation Algorithms Introduction

Lecture 3 Complexity of Approximation

• L-reduction

• Two subclass of PTAS

• Set-cover ((ln n)-approximation)

• Independent set (n -approximation)c