/
Approximation Through Scaling Approximation Through Scaling

Approximation Through Scaling - PowerPoint Presentation

cheryl-pisano
cheryl-pisano . @cheryl-pisano
Follow
386 views
Uploaded On 2016-07-08

Approximation Through Scaling - PPT Presentation

Algorithms and Networks 20142015 Hans L Bodlaender Johan M M van Rooij Capproximation Optimization problem output has a value that we want to maximize or minimize An algorithm A is an ID: 395563

approximation opt time algorithm opt approximation algorithm time solution items polynomial weight total instance knapsack input problem inputs set

Share:

Link:

Embed:

Download Presentation from below link

Download Presentation The PPT/PDF document "Approximation Through Scaling" is the property of its rightful owner. Permission is granted to download and print the materials on this web site for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.


Presentation Transcript

Slide1

Approximation Through Scaling

Algorithms

and Networks 2014/2015

Hans L.

Bodlaender

Johan M. M. van RooijSlide2

C-approximation

Optimization problem: output has a value that we want to

maximize

or

minimize

An algorithm A is an

C-approximation algorithm

, if for all inputs X, we have that (with OPT the optimal value)

value(A(X)) / OPT ≤ C (

minimisation

), or

OPT / value(A(X)) ≤ C (

maximisation

)Slide3

PTAS

A

Polynomial Time Approximation Scheme

is an

algorithm, that gets two inputs:

the

“usual” input X, and a real value

e

>0.

For each fixed

e

>0, the algorithm

Uses

polynomial time

Is an (1+

e

)-approximation algorithmSlide4

FPTAS

A

Fully

Polynomial Time Approximation Scheme

is an algorithm, that gets two inputs: the “usual” input X, and a real value

e

>0, and

For each fixed

e

>0, the algorithm

Is an (1+

e

)-approximation algorithm

The algorithm uses time that is polynomial in the size of X and 1/

e

.Slide5

Example:

Knapsack

Given:

n

items each with a positive integer weight w(

i

) and integer value v(

i

) (1 ≤

i

n

), and an integer B.

Question: select items with total weight at most B such that the total value is as large as possible.Slide6

Dynamic Programming for Knapsack

Let P be the maximum value of all items.

We can solve the problem in O(n

2

P) time with dynamic programming:

Tabulate M(

i,Q

): minimum total weight of a subset of items 1, …,

i

with total value Q for Q at most

nP

M(0,0) =

0

M(0,

Q

) =

, if Q>0

M(i+1,Q) = min{ M(

i,Q

), M(

i,Q

-v(i+1)) + w(i+1)

}Slide7

Scaling for Knapsack

Take input for knapsack

Throw away all items that have weight larger than B (they are never used)

Let c be some constant

Build new input: do not change weights, but set new values v’(

i

)

=

ë

v(

i

) / c

û

Solve scaled instance with DP optimally

Output this solution: approximates solution for original instanceSlide8

The Question is….

How do we set c, such that

Approximation ratio good enough

Polynomial timeSlide9

Approximation ratio

Consider optimal solution Y for original problem, value OPT

Value in scaled instance: at least OPT/c – n

At most

n

items, for each v(

i

)/c -

ë

v(

i

)/c

û

<1

So, DP finds a solution of value at least OPT/c –n for scaled problem

So, value of approximate solution for original instance is at least c*(OPT/c –n) = OPT -

ncSlide10

Setting c

Set c =

e

P

/(2n)

This is a

FPTAS

Running time:

Largest value of an item is at most P/c = P / (

e

P

/(2n)) = 2n/

e

.

Running time is O(n

2

* 2n/

e

) =

O(n

3

/

e

)

Approximation: … next Slide11

e

-approximation

Note that each item is a solution (we removed items with weight more than B).

So OPT ≥ P.

Algorithm gives solution of value at least:

OPT –

nc

= OPT – n(

e

P

/ (2n) ) = OPT –

e

/2 P

OPT / (OPT –

e

/2 P) ≤ OPT / (OPT –

e

/2 OPT)

= 1/(1-

e

/2) ≤ 1+

eSlide12

Comments

Technique works for many problems

.. But

not always …