1 Finite-State Online Algorithms and Their Automated Competitive Analysis Takashi Horiyama Kazuo Iwama Jun 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 ratio upper bound this method tight from the theoretical point of view, we need comprehensive performance analysis reduce # of cases by professional sense and techniques ordinary approach our approach (explained later)
3 Online Knapsack Problem (OKP) The player has a bin (size: 1.0) Input items: u 1, u 2,… (0 < u i <= 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 Online Ex.) 0.6, 0.7, 0.4 are given in this order. If he knows his future inputs …
4 Evaluation Measure The online algorithm is evaluated by the Competitive Ratio (CR). CR = the benefit of Offline the benefit of Online Ex) 0.6, 0.7, 0.4 are given in this order. CR = Online 0.7 If Offline choose … this benefit is 0.7 this benefit is 1 worst case of
Relaxation of the Condition The optimal CR of the 1-bin Online Knapsack Problem (OKP) is [Iwama, Taketomi, 2002] We introduce a buffer bin which allows exchanging items between the two bins. Revocable Online Knapsack Problem (ROKP) relaxation of the condition main binbuffer bin benefit = main bin
6 Our Main Results upper case analysis by hand [ Iwama, Masanishi 2003 ] lower lower upper automated analysis old new result CR OKP upper bound lower bound CR ROKP
7 Brief History of Our Project upper lower old (by hand) CR [ Iwama, Masanishi 2003 ] automated analysis By improving the base algorithm 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 simulation … 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) The player X discards… (Case 1) item. (Case 2) item. (Case 3) item. (t: a real root of 4x 3 + 5x 2 – x – 4 = 0) Theorem 1 Let X be any online algorithm for ROKP. Then CR(X) > 1/t – ε = Proof: The adversary inputs 0.608, 0.409,
11 Proof of the lower bound (1.301) 0.680, 0.409, CR= input discard input (Case 1) discards The Adversary inputs (and stops). CR = = adversary (Offline) player X (Online)
12 Proof of the lower bound (1.301) 0.680, 0.409, CR= input discard input CR= input (Case 1) discards (Case 2) discards (Case 3) discards The Adversary inputs CR = = The Adversary inputs CR = = The next input is input
13 Adversary’s Strategy for the lower bound (1.301) CR= , CR= CR= CR= CR= CR= CR= discard input CR= input input input input input , 0.409, input
14 Outline of the Proof lower upper prove by using a computer ROKP Design an online algorithm A. Theorem2 The online algorithm A achieves the CR CR 1. Enumerate all states 2. Prove CR < 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 / = 0.77 XSSSXL MM ML LL 1-t1-t 1-t21-t2 t2t2 t 2t 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 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 State 0 SS is given SS State 1 MS is given MS State 2 … LL is given … LL State 3 2. Prove CR < for each state. 1. Enumerate all states (making state diagram). SS State 4 SS CR < …
18 1. Enumerate all states. empty SSMSMMMLLLSS, SSSS, MSSS, MM MS SS MM END STATE ML LL SS, LL ? t ≦ SS + ML ≦ 1 SS MS MM ML LL
19 Can SS and LL be held in the same bin? case by case SS LL SS LL SS + LL <= 1SS + LL > 1 can hold the twocannot other case division SS + MS < t SS + MS >= t SS : 0.23 ~ 0.41 L L : 0.59 ~ 0.77
20 Can SS and LL be held in the same bin? SS 1 State i SS 1 State j LL 1 LL 1 is given, and SS 1 + LL 1 ≦ 1 LL 1 is given, and SS 1 + LL 1 > 1 SS 1 State k LL 1 SS 1 + LL 1 ≦ 1 SS 1 + LL 1 > 1 necessary to memorize as ‘condition’ END_STATE
21 If items are discarded,… empty LLSS, LL … SS … SS, LL LL LL H ALG selects discarding item(s) among SS, 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 / = 0.77 XSSSXL MM ML LL 1-t1-t 1-t21-t2 t2t2 t 2t 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 / = 0.77 XSSSXL MM ML LL 1-t1-t 1-t21-t2 t2t2 t 2t 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 upper prove by using a computer ROKP Design online algorithm A. Theorem2 The online algorithm A achieves the CR CR 1. Enumerate all states 2. Prove CR < 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 of the items in the bin the best possible sum of the 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 never satisfied
28 the proof of CR<1.301 (3) Ex) state : current SS 1, SS 2, LL 1, history SS H 1, condition SS 1 + LL 1 > 1, SS H 1 + LL 1 > 1,… We suppose G = {SS 2,SS H 1 } as the comb. in history. possible comb. of Online is {SS 1 },{SS 2 },{SS 1,SS 2 },{LL 1 }. SS 2 + SS H 1 ≧ α × (SS 1 ) SS 2 + SS H 1 ≧ α × (SS 2 ) SS 2 + SS H 1 ≧ α × (SS 1 + SS 2 ) SS 2 + SS H 1 ≧ α × (LL 1 ) further, the range of class 1-t < SS 1 ≦ 1-t 2 1-t < SS 2 ≦ 1-t 2 1-t < SS H 1 ≦ 1-t 2 t 2 < LL 1 ≦ t inequalities of the condition SS 1 + LL 1 > 1 SS H 1 + LL 1 > 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( Sqrt[10293])^(1/3) + 1/12( Sqrt[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 1, SS1 + Ll1>1, SS1 + Ll2>1, SS2 + Ll1>1, SS2 + Ll2>1, SS3 + Ll1>1, SS3 + Ll2>1, Ll1 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 the solutions of the inequalities by Mathematica. There are 1715 cases.
30 Results and Conclusion Generate state diagram: at less than 10 seconds by Athlon XP Our state diagram has 276 states. checking CR < 1.301: 1715 sets of inequalities. solved by Mathematica at 30 minutes. We prove CR < for all states. Are there any application which can use this method?