1 finite-state online algorithms and their automated competitive analysis takashi horiyama kazuo...

Post on 17-Dec-2015

218 Views

Category:

Documents

2 Downloads

Preview:

Click to see full reader

TRANSCRIPT

1

Finite-State Online Algorithms and Their

Automated Competitive Analysis

Takashi HoriyamaKazuo IwamaJun Kawahara

Graduate School of Informatics, Kyoto University, Japan

2

What is the Automated Analysis?

Analysis of algorithms

Automated Analysis by a computer.

We construct a general framework for automated analysis.

Apply to …

Online Knapsack Problem

the competitive ratioupper bound 1.334 1.301

this methodtight

from the theoretical point of view, we need comprehensive performance analysis

reduce # of cases by professional senseand techniques

ordinary approach

our approach

(explained later)

3

Online Knapsack Problem (OKP)

• The player has a bin (size: 1.0)

• Input items: u1, u2,… (0 < ui <= 1.0)

• The player does not know next item.• Action : puts it into the bin or discards it• Goal: to maximize the content of the bin

0.6 0.70.40.60.7

Online

Ex.) 0.6, 0.7, 0.4 are given in this order.

If he knows his future inputs…

0.6

0.4

4

Evaluation Measure• The online algorithm is evaluated by the

Competitive Ratio (CR).

CR =the benefit of Offlinethe benefit of Online

Ex) 0.6, 0.7, 0.4 are given in this order.

CR

=1.4210.7Online

0.7

If Offline choose…

0.6

0.4

this benefit is 0.7 this benefit is 1

worst case of

5

0.4

0.30.20.4

Relaxation of the Condition

• The optimal CR of the 1-bin Online Knapsack Problem (OKP) is 1.618 [Iwama, Taketomi, 2002]

• We introduce a buffer bin which allows exchanging items between the

two bins.Revocable Online Knapsack Problem (ROKP)

0.5 0.50.3 0.30.20.4

relaxation of the condition

main bin buffer bin

benefit = main bin

6

Our Main Results

upper 1.334  

13 case analysis by hand [ Iwama, Masanishi 2003 ]

lower 1.281 lower 1.301

upper 1.301

automated analysis

old new result

CR

OKP

upper bound 1.618   

lower bound 1.618CR

ROKP

7

Brief History of Our Project

upper 1.334  

lower 1.281

old (by hand)

CR

[ Iwama, Masanishi 2003 ]

1.334  

automated analysis

1.281

By improving the base algorithm

1.301

important hint

8

Automated Proof by a Computer

• This is the theoretical and mathematical proof.

• two major difficulties– Each input item takes a real value between 0 and 1.– The number of states must be finite (# of items in the bin

also).

cf) a numerical simulation0.0398 0.0319 0.9912 0.5764 0.7843 0.7490 0.5983 0.0432 0.27630.8468 0.9678 0.3982 0.6355 0.6631 0.6097 0.9667 0.3445 0.6335…0.6219 0.9784 0.9735 0.5505 0.1740 0.6999 0.8499 0.6960 0.6565

generate random values as item sizes, and calculate the CR

9

Past Results Using a Computer

• The four color problem [Appel and Haken, 1977]

• Kepler conjecture [Hales 1997]• A 7/8-approximation algorithm for MAX 3SAT [Zwick, 2002]

A computer is used to enumerate the finite pattern in above problems.

our method We deal with infinite items directly.(representing finite states)

10

Proof of the lower bound (1.301)

0.409

0.6800.769

The player X discards…

(Case 1) 0.680 item.

(Case 2) 0.409 item.

(Case 3) 0.769 item.

(t: a real root of 4x3 + 5x2 – x – 4 = 0)

Theorem 1Let X be any online algorithm for ROKP. Then CR(X) > 1/t – ε = 1.301.

Proof: The adversary inputs 0.608, 0.409, 0.769.

11

Proof of the lower bound (1.301)

0.680, 0.409,0.769

0.680

0.409

0.769

CR=1.301

inputdisc

ard

input 0.320 (Case 1) discards 0.680.

The Adversary inputs 0.320 (and stops).

CR = 0.680 + 0.320

0.769= 1.301

adversary(Offline)

player X(Online)

0.6800.4090.7690.320

0.6800.4090.7690.320

0.320

0.6800.769

12

Proof of the lower bound (1.301)

0.680, 0.409,0.769

0.680

0.409

0.769

0.592

CR=1.301

inputdisc

ard

input 0.320

CR=1.301

input 0.591

(Case 1) discards 0.680.

(Case 2) discards 0.409.

(Case 3) discards 0.769.

The Adversary inputs 0.320.

CR = 0.680 + 0.320

0.769= 1.301

The Adversary inputs 0.591.

CR = 0.409 + 0.591

0.769= 1.301

The next input is 0.592.

input

13

Adversary’s Strategyfor the lower bound (1.301)

0.680

0.409

0.769

0.592

CR=1.301

0.68

00.409

0.592

0.320,0.359

CR=1.471

CR=1.301 CR=

1.401

CR=1.301

CR=1.301

CR=1.304

discard

0.6

80

0.40

9

0.32

0

0.359

input 0.320

CR=1.301

input 0.591

input 0.320

input 0.591

input 0.320

input 0.6800.680, 0.409,0.769

input

input

input

14

Outline of the Proof

lower 1.301

upper 1.301

prove by using a computer

ROKP

Design an online algorithm A.

Theorem2 The online algorithm A achieves the CR 1.301.

CR

1. Enumerate all states2. Prove CR < 1.301 for each state

The process of the proof

already proved

now proving

15

Designing Online Algorithm A

When the item u is given...

・ If room exists for the current item, hold u.

・ If the main bin has benefit >= t,

     then discard all the other items.

・ Otherwise discard some item(s).

t =1 / 1.301 = 0.77

XS SS XL

0 10.590.23 0.41

0.540.77

MMML LL

1-t 1-t2 t2 t2t-10.46

MS

2-2t

ALG decides discarding

item(s) into bins.

the classification on the sizes of the items

16

How to Discard items• If there are two or more items in the same class, the player discards one of them.     ex) LL, LL, MM --> discard LL• If there are two items in SS and an item in LL,     SS + SS < LL --> discard LL.      SS + SS >= LL for all combinations --> discard SS.• Otherwise (exception),

– MS, ML, LL --> discard ML.– MM, ML, LL --> discard ML.

17

Proof of the upper bound

State0

SS is given

SS

State1

MS is g

iven

MS

State2…

LL is given…

LL

State3

2. Prove CR < 1.301 for each state.

1. Enumerate all states (making state diagram).

SS

State4

SS

SSCR < 1.301

CR < 1.301

CR < 1.301

CR < 1.301

CR < 1.301

18

1. Enumerate all states.empty

SS MS MMML

LL

SS, SS SS, MS SS, MM

MSSS MM

ENDSTATE

ML LL

SS, LL

?t SS + ML 1≦ ≦

SSMS MM

MLLL

19

Can SS and LL be held in the same bin?

• case by case.

0.3

0.60.4

0.7

SS

LLSS

LL

SS + LL <= 1 SS + LL > 1

can hold the two cannot

other case divisionSS + MS < tSS + MS >= t

SS : 0.23 ~ 0.41L L : 0.59 ~ 0.77

20

Can SS and LL be held in the same bin?

SS1

StateiSS1

StatejLL1LL1

is given, and

SS1 + LL1

1≦

LL1 is given, and

SS1 + LL

1 > 1

SS1

Statek

LL1

SS1 + LL1 1≦

SS1 + LL1 > 1

necessary to memorizeas ‘condition’

END_STATE

21

If items are discarded,…empty

LL

SS, LL …

SS

…SS, LL

LL

LLH

ALG selects discardingitem(s) amongSS, LL, LL.

necessary to memorize as ‘history’

LL

22

Why states are finite?

• state : current items, history, and condition• “Current items” are finite clearly (XS can be ignored).• “History” is finite. Because we need not memorize more

number.

For example, the player can put at most two items in MS into one bin.

We memorize “MS+H2” which means “MS × two or more”.

t =1 / 1.301 = 0.77

XS SS XL

0 10.590.23 0.41

0.540.77

MMML LL

1-t 1-t2 t2 t2t-10.46

MS

2-2t

23

Why states are finite?

• state : current items, history, and condition• “Current items” are finite clearly.• “History” is finite. Because we need not to memorize more

number.• “Condition” is also finite. Because the form of the

inequality is given below.

t =1 / 1.301 = 0.77

XS SS XL

0 10.590.23 0.41

0.540.77

MMML LL

1-t 1-t2 t2 t2t-10.46

MS

2-2t

○ + ○ ≦ 1 ○ + ○ < t ○ ○≦

○ + ○ > 1 ○ + ○ ≧ t

24

Generated the State Diagram

• generated by the Java Program• our state diagram has 276 states.

25

Outline of the Proof

lower 1.301

upper 1.301

prove by using a computer

ROKP

Design online algorithm A.

Theorem2 The online algorithm A achieves the CR 1.301.

CR

1. Enumerate all states2. Prove CR < 1.301 for each state

The process of the proof

already proved

now proving

26

the proof of CR<1.301 (1)

CR =

the best possible sum ofthe items in the bin

the best possible sum ofthe items in the history

for checking CR < α set up to inequalities

the benefit of Offline

the benefit of Online

(α = 1.301)

27

∀ the combination G in the history,∃ the combination A in the bin, and

is satisfied.

the proof of CR<1.301 (2)

∀ the combination G in the history,∀ the combination A in the bin, and(sum of items in G) ≧ α× (sum of items in A)is satisfied.

converse of the

The summation of items in G

The summation of items in A< α

is neversatisfied

28

the proof of CR<1.301 (3)Ex) state : current SS1, SS2, LL1, history SSH

1,condition SS1 + LL1 > 1, SSH

1 + LL1 > 1,…

We suppose G = {SS2,SSH1} as the comb. in history.

possible comb. of Online is

{SS1},{SS2},{SS1,SS2},{LL1} .SS2 + SSH

1 ≧ α × (SS1)SS2 + SSH

1 ≧ α × (SS2)SS2 + SSH

1 ≧ α × (SS1 + SS2) SS2 + SSH

1 ≧ α × (LL1)

further, the range of class

1-t < SS1 ≦ 1-t2

1-t < SS2 ≦ 1-t2

1-t < SSH1 ≦ 1-t2

t2 < LL1 ≦ t

inequalities of the condition

SS1 + LL1 > 1

SSH1 + LL1 > 1

Our purpose is to prove these inequalities are never satisfied.

We prove this for all comb. in history.

29

t = -5/12 + 1/12(649 - 6Sqrt[10293])^(1/3) + 1/12(649 + 6Sqrt[10293])^(1/3) α = 1 / t Developer`InequalityInstance[{a (SS1) <= SS2 + Ll1 ,a (SS2) <= SS2 + Ll1 ,a (SS1 + SS2) <= SS2 + Ll1 ,a (Ll1) <= SS2 + Ll1 ,

SS1 + SS2<t , SS1 + SS3<t , SS2 + SS3<t , SS1 + SS2 + SS3>1 , SS1 + Ll1>1 , SS1 + Ll2>1 , SS2 + Ll1>1 , SS2 + Ll2>1 , SS3 + Ll1>1 , SS3 + Ll2>1 , Ll1<t , Ll2<t , SS1 + SS2 < Ll1 , SS1 + SS2> Ll2 ,

…continue

-t + 1 < SS1 <= -t^2 + 1 , -t + 1 < SS2 <= -t^2 + 1 , -t + 1 < SS3 <= -t^2 + 1 ,t^2 < Ll1 <= t, t^2 < Ll2 <= t} , {SS1 , SS2 , SS3 , Ll1 , Ll2}]

We check the existence of thesolutions of the inequalities byMathematica.There are 1715 cases.

30

Results and Conclusion

• Generate state diagram: at less than 10 seconds by Athlon XP 2600.

• Our state diagram has 276 states.• checking CR < 1.301: 1715 sets of inequalities.   solved by Mathematica at 30 minutes.• We prove CR < 1.301 for all states.

• Are there any application which can use this method?

top related