approximation algorithms

22
Approximation Algorithms Department of Mathematics and Computer Science Drexel University

Upload: tess

Post on 06-Jan-2016

56 views

Category:

Documents


0 download

DESCRIPTION

Approximation Algorithms. Department of Mathematics and Computer Science Drexel University. Today’s Lecture:. Simple Algorithm for Bin-Packing Maximum Cut Approximation algorithm for graph coloring Approximation algorithm for set cover. The Bin-Packing Problem:. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Approximation Algorithms

Approximation Algorithms

Department of Mathematics and Computer ScienceDrexel University

Page 2: Approximation Algorithms

Today’s Lecture:

Simple Algorithm for Bin-Packing Maximum Cut Approximation algorithm for graph coloring Approximation algorithm for set cover

Page 3: Approximation Algorithms

The Bin-Packing Problem: INSTANCE: Finite set I of rational numbers

{a1,…,an} with ai (0,1]

SOLUTION: Partition {B1,…,Bk} of I into k bins such that the sum of the numbers in each bin is at most 1

MEASURE: Cardinality of the partition, i.e., k

Page 4: Approximation Algorithms

The Algorithm: Polynomial-time 2-approximation algorithm for

MINIMUM BIN PACKING (Next Fit algorithm)

begin for each number a

if a fits into the last open bin then assign a to this binelse open new bin and assign a to this bin

return fend.

Page 5: Approximation Algorithms

Theorem:Number of bins used by the algorithm is at

most 2A, where A is the sum of all numbers.Proof: For each pair of consecutive bins, the sum of the

number included in these two bins is greater than 1.

Each feasible solution uses at least A bins Best case each bin is full (i.e., the sum of its numbers is

1). Performance ratio is at most 2.

Page 6: Approximation Algorithms

Tightness: Let I={1/2,1/2n,1/2,1/2n,…,1/2,1/2n} contain 4n

items.

...

2n bins

2n items of size 1/2n

optimal packing Next Fit packing

...

n bins

2 it

ems

of s

ize

1/2

2n items of size 1/2n.

..

...

Page 7: Approximation Algorithms

Maximum Cut: INSTANCE: Graph G=(V,E)

SOLUTION: Partition of V into disjoint sets V1 and V2

MEASURE: Cardinality of the cut, i.e., the number of edges with one endpoint in V1 and one endpoint in V2

Page 8: Approximation Algorithms

The Algorithm:Polynomial-time 2-approximation algorithm

for MAXIMUM CUT

beginV1:=ø;

repeatif exchanging one node between V1 and V2 =V- V1

improves the cut thenperform the exchange;

until a local optimum is reached;return f

end.

Page 9: Approximation Algorithms

Theorem: We prove that any local optimum contains at

least half of the m edges Notation:

c= # of edges of the cut i= # of edges inside V1

o= # of edges outside V1

m=c+i+o, that is, i+o=m-c

For any node v, i(v)= # of edges between v and a node in V1

o(v)= # of edges between v and a node not in V1

Page 10: Approximation Algorithms

Proof: V1 is a local optimum: for any v V1, i(v)-o(v) 0

and, for any v not in V1, o(v)-i(v) 0.

Summing over all nodes in V1, we have 2i-c 0

Summing over all nodes not in V1, we have 2o-c 0 That is, i+o-c 0 That is, m-2c 0 That is, c m/2

Page 11: Approximation Algorithms

Graph Vertex Coloring: Given a graph G=(V,E), on n vertices and m edges, find a

mapping from vertex set to k-colors such that no two end-points of an edge will receive the same color.

The Decision problem: Given an instance of GVC, and an integer k* , is it possible to k*

color the vertices of the graph?

Optimization problem: Given an instance of GVC, find the smallest possible value for k* ,

for which a vertex coloring of G exists.

Input-dependent Optimization problem: Same assumptions as optimization version, except we would like to

use as few colors as possible to find the actual mapping.

Page 12: Approximation Algorithms

The Algorithm: The following is a polynomial-time n/logn-approximation algorithm

for MINIMUM GRAPH COLORING

begin i:=0; U:=V;

while U ø dobegin

i:=i+1;V[i]:=ø;W:=U;H:=graph induced by W;

while W ø dobegin

v=node of minimum degree in H; insert v inV[i];delete v and its neighbors from W;U:=U-V[i]

endend

end.

Page 13: Approximation Algorithms

What is the Algorithm doing?

During each iteration, we will look at the left over from the graph U (initially U denotes the vertex set of G) and try to use a new colors to color a sub graph W.

Once we are done with sub-graph W, it will be removed from the graph, i.e. the graph is shrinking after this step, (U=U-V[i]).

But we will need to use new colors for the rest of U. The inner loop will identify all vertices receiving a

particular color “i”. The outer-loop will identify number of required colors

for whole G.

Page 14: Approximation Algorithms

Performance Guarantee: To begin with, if we know the graph is k-colorable, and

we show the algorithm uses at most 3|V|/logk|V| colors: At any iteration of the inner loop, H the induced graph on

vertex set W is k-colorable (since the whole graph is k-colorable).

By pigenwhole principle, it contains an independent set of at least |W|/k nodes of degree at most |W|(k-1)/k.

As a result at least |W|/k nodes will be carried to next iteration of inner loop, i.e., during j-the iteration of inner loop the size of the set is at least |W|/kj . Consequently, there is at least logk|W| iterations for inner loop, i.e. |V[i]| is at least logk|U|

Page 15: Approximation Algorithms

Continued: Observe that U is a shirking set, starts with the whole V and

eventually becomes empty. At each step, the size of U goes down by at least logk|U| (the

vertices receiving color i). During the iterations for which |U| |V|/logk|V|, we have

logk|U| (1 /2)logk|V|. As a result the first time |U| < |V|/logk|V| we have only used at

most 2|V|/logk|V| in outer-loop. To color the left-over |V|/logk|V|,we will use at most |V|/logk|V|

new color. The is the algorithm uses at most 3|V|/logk|V| colors for G.

Page 16: Approximation Algorithms

Finally:

The algorithms uses 3n/logoptn, that is equal to 3n log OPT /log n.

The perfoamnce gurantee of the algorithm is: 3n/log n.

Page 17: Approximation Algorithms

Minimum Set-Cover: INSTANCE: Collection C of subsets of a

finite set S.

SOLUTION: A set cover for S, i.e., a subset C’ of C such that every element in S belongs to at least one member of C’

MEASURE: |C’|

Page 18: Approximation Algorithms

Johnson’s algorithm : Polynomial-time logarithmic approximation

algorithm for MINIMUM SET COVERbegin

U:=S; C’:=ø;for any ci do c’i := ci ;repeat

i:=index of c’ with maximum cardinality;insert ci in C’; U := U-{elements of c’i };delete all elements of ci from all c’;

until U:=øend.

Page 19: Approximation Algorithms

Performance Guarantee: We prove that the performance ratio of the

algorithm is at most ∑1 i k (1/i) where k is the maximum cardinality of the sets in C

Let a1 ,...,a|C’| be the sequence of indices obtained by the algorithm

Let cji be the surviving part of ci before index aj

has been chosen The intersection of ci and cj

aj is equal to cj

i - cj+1i

li denote largest index j such that cji is not empty

Page 20: Approximation Algorithms

Theorem 1: For any i, H(|ci|) 1 j |C’| (|ci cj

aj |/|cj

aj|) where H(n)= 1 i n (1/i).

Proof:

|)(||)(|

|)(||)(|(

|)|/(1

|)|/1(

|)|/|)||(|

|)|/|)||(||)|/|(|

1

1

1

1 ||||1

1

1 ||1||

1

1

'||1

1

'||1

1

1

ii

lj

ji

ji

lj cck

ji

lj ckc

ji

lj

ji

ji

ji

Cj

ja

ji

ji

Cj

ja

jai

cHcH

cHcH

ck

c

ccc

cccccc

i

ij

ij

i

ij

ij

i

i

jjj

Page 21: Approximation Algorithms

Theorem 2:For any set cover C’’,

ci C’’ 1 j |C’| (|ci cjaj |/|cj

aj|) |C’|

Proof:

|'|

|)|/|(|

|)(||)|/1(|)|/|(|

'||1

'||1 '''' '||1

C

cc

cccccc

Cj

ja

ja

Cj Cc

jai

ja

Cc Cj

ja

jai

jj

i

jj

i

jj

Page 22: Approximation Algorithms

Finally:

.ratio eperformanc desired

thehave we,1ln1ln)( Since

|'|)(|*| isthat

|'|)( that have we,|| Since

.|'||)(|imply That will

|'||)|/|(| and

|)|/|(||)(| have We

*

*

* '||1

'||1

nkKH

CKHC

CKHkc

CcH

Cccc

ccccH

Cci

Cci

Cc Cj

ja

jai

Cj

ja

jaii

i

i

i

jj

jj