Chapter 1. On-line Choice of On-line Algorithms. Yossi Azar Andrei Z. Broder Mark S. Manasse

Similar documents
Review: Our Approach 2. CSC310 Information Theory

Test 2. ECON3161, Game Theory. Tuesday, November 6 th

Rational Secret Sharing without Broadcast

Digital Transmission

Fall 2018 #11 Games and Nimbers. A. Game. 0.5 seconds, 64 megabytes

Calculation of the received voltage due to the radiation from multiple co-frequency sources

Analysis of Time Delays in Synchronous and. Asynchronous Control Loops. Bj rn Wittenmark, Ben Bastian, and Johan Nilsson

Secure Transmission of Sensitive data using multiple channels

Understanding the Spike Algorithm

Algorithms Airline Scheduling. Airline Scheduling. Design and Analysis of Algorithms Andrei Bulatov

Walsh Function Based Synthesis Method of PWM Pattern for Full-Bridge Inverter

IEE Electronics Letters, vol 34, no 17, August 1998, pp ESTIMATING STARTING POINT OF CONDUCTION OF CMOS GATES

Generalized Incomplete Trojan-Type Designs with Unequal Cell Sizes

UNIT 11 TWO-PERSON ZERO-SUM GAMES WITH SADDLE POINT

Adaptive Modulation for Multiple Antenna Channels

A Comparison of Two Equivalent Real Formulations for Complex-Valued Linear Systems Part 2: Results

PRACTICAL, COMPUTATION EFFICIENT HIGH-ORDER NEURAL NETWORK FOR ROTATION AND SHIFT INVARIANT PATTERN RECOGNITION. Evgeny Artyomov and Orly Yadid-Pecht

MTBF PREDICTION REPORT

Dynamic Optimization. Assignment 1. Sasanka Nagavalli January 29, 2013 Robotics Institute Carnegie Mellon University

Parameter Free Iterative Decoding Metrics for Non-Coherent Orthogonal Modulation

NATIONAL RADIO ASTRONOMY OBSERVATORY Green Bank, West Virginia SPECTRAL PROCESSOR MEMO NO. 25. MEMORANDUM February 13, 1985

Chinese Remainder. Discrete Mathematics Andrei Bulatov

Sorting signed permutations by reversals, revisited

N( E) ( ) That is, if the outcomes in sample space S are equally likely, then ( )

To: Professor Avitabile Date: February 4, 2003 From: Mechanical Student Subject: Experiment #1 Numerical Methods Using Excel

Passive Filters. References: Barbow (pp ), Hayes & Horowitz (pp 32-60), Rizzoni (Chap. 6)

Tile Values of Information in Some Nonzero Sum Games

TECHNICAL NOTE TERMINATION FOR POINT- TO-POINT SYSTEMS TN TERMINATON FOR POINT-TO-POINT SYSTEMS. Zo = L C. ω - angular frequency = 2πf

High Speed ADC Sampling Transients

Ultimate X Bonus Streak Analysis

Uncertainty in measurements of power and energy on power networks

Control Chart. Control Chart - history. Process in control. Developed in 1920 s. By Dr. Walter A. Shewhart

A Novel Optimization of the Distance Source Routing (DSR) Protocol for the Mobile Ad Hoc Networks (MANET)

熊本大学学術リポジトリ. Kumamoto University Repositor

NOVEL ITERATIVE TECHNIQUES FOR RADAR TARGET DISCRIMINATION

Network Reconfiguration in Distribution Systems Using a Modified TS Algorithm

Comparative Analysis of Reuse 1 and 3 in Cellular Network Based On SIR Distribution and Rate

International Journal of Network Security & Its Application (IJNSA), Vol.2, No.1, January SYSTEL, SUPCOM, Tunisia.

Weighted Penalty Model for Content Balancing in CATS

Performance Analysis of Multi User MIMO System with Block-Diagonalization Precoding Scheme

A Game-Theoretic Analysis of Strictly Competitive Multiagent Scenarios

THEORY OF YARN STRUCTURE by Prof. Bohuslav Neckář, Textile Department, IIT Delhi, New Delhi. Compression of fibrous assemblies

A NSGA-II algorithm to solve a bi-objective optimization of the redundancy allocation problem for series-parallel systems

29. Network Functions for Circuits Containing Op Amps

Multi-Robot Map-Merging-Free Connectivity-Based Positioning and Tethering in Unknown Environments

A TWO-PLAYER MODEL FOR THE SIMULTANEOUS LOCATION OF FRANCHISING SERVICES WITH PREFERENTIAL RIGHTS

The Performance Improvement of BASK System for Giga-Bit MODEM Using the Fuzzy System

Space Time Equalization-space time codes System Model for STCM

EE 508 Lecture 6. Degrees of Freedom The Approximation Problem

Figure 1. DC-DC Boost Converter

Revision of Lecture Twenty-One

Implementation Complexity of Bit Permutation Instructions

antenna antenna (4.139)

NETWORK 2001 Transportation Planning Under Multiple Objectives

A study of turbo codes for multilevel modulations in Gaussian and mobile channels

Low Switching Frequency Active Harmonic Elimination in Multilevel Converters with Unequal DC Voltages

Beam quality measurements with Shack-Hartmann wavefront sensor and M2-sensor: comparison of two methods

Full-duplex Relaying for D2D Communication in mmwave based 5G Networks

Section 5. Signal Conditioning and Data Analysis

Distributed Topology Control of Dynamic Networks

Joint Power Control and Scheduling for Two-Cell Energy Efficient Broadcasting with Network Coding

Jointly optimal transmission and probing strategies for multichannel wireless systems

1 GSW Multipath Channel Models

Ensemble Evolution of Checkers Players with Knowledge of Opening, Middle and Endgame

Efficient Large Integers Arithmetic by Adopting Squaring and Complement Recoding Techniques

Graph Method for Solving Switched Capacitors Circuits

problems palette of David Rock and Mary K. Porter 6. A local musician comes to your school to give a performance

ELECTRONIC WAVELENGTH TRANSLATION IN OPTICAL NETWORKS. Milan Kovacevic and Anthony Acampora. Center for Telecommunications Research

Define Y = # of mobiles from M total mobiles that have an adequate link. Measure of average portion of mobiles allocated a link of adequate quality.

Introduction to Coalescent Models. Biostatistics 666 Lecture 4

Throughput Maximization by Adaptive Threshold Adjustment for AMC Systems

Exploiting Dynamic Workload Variation in Low Energy Preemptive Task Scheduling

Introduction to Coalescent Models. Biostatistics 666

Research of Dispatching Method in Elevator Group Control System Based on Fuzzy Neural Network. Yufeng Dai a, Yun Du b

Optimal Placement of PMU and RTU by Hybrid Genetic Algorithm and Simulated Annealing for Multiarea Power System State Estimation

Hard Real-Time Scheduling for Low-Energy Using Stochastic Data and DVS Processors

A MODIFIED DIRECTIONAL FREQUENCY REUSE PLAN BASED ON CHANNEL ALTERNATION AND ROTATION

RC Filters TEP Related Topics Principle Equipment

The Byzantine Generals Problem

The Spectrum Sharing in Cognitive Radio Networks Based on Competitive Price Game

Estimating Mean Time to Failure in Digital Systems Using Manufacturing Defective Part Level

On High Spatial Reuse Broadcast Scheduling in STDMA Wireless Ad Hoc Networks

Discussion on How to Express a Regional GPS Solution in the ITRF

Performance Study of OFDMA vs. OFDM/SDMA

A Novel Soft-Switching Two-Switch Flyback Converter with a Wide Operating Range and Regenerative Clamping

Exact Probabilistic Analysis of the Limited Scheduling Algorithm for Symmetrical Bluetooth Piconets

Resource Scheduling in Dependable Integrated Modular Avionics

ANNUAL OF NAVIGATION 11/2006

Multiband Jamming Strategies with Minimum Rate Constraints

4.3- Modeling the Diode Forward Characteristic

High Speed, Low Power And Area Efficient Carry-Select Adder

ALICE AND BOB GO TO DINNER: A VARIATION ON MÉNAGE

A General Framework for Codes Involving Redundancy Minimization

MASTER TIMING AND TOF MODULE-

Traffic balancing over licensed and unlicensed bands in heterogeneous networks

Priority based Dynamic Multiple Robot Path Planning

A Fuzzy-based Routing Strategy for Multihop Cognitive Radio Networks

Maximizing Lifetime of Sensor-Target Surveillance in Wireless Sensor Networks

Dynamic Lightpath Protection in WDM Mesh Networks under Wavelength Continuity Constraint

Equivalent Circuit Model of Electromagnetic Behaviour of Wire Objects by the Matrix Pencil Method

Transcription:

Chapter On-lne Choce of On-lne Algorthms Yoss Azar Andre Z. Broder Mark S. Manasse Abstract Let fa ; A 2; ; Amg be a set of on-lne algorthms for a problem P wth nput set I. We assume that P can be represented as a metrcal task system. Each A has a compettve rato a wth respect to the optmum olne algorthm, but only for a subset of the possble nputs such that the unon of these subsets covers I. Gven ths setup, we construct a generc determnstc on-lne algorthm and a generc randomzed on-lne algorthm for P that are compettve over all possble nputs. We show that ther compettve ratos are optmal up to constant factors. Our analyss proceeds va an amusng card game. Introducton A common trck of the trade n algorthm desgn s to combne several algorthms usng round robn executon. The basc dea s that, gven a set of m algorthms for a problem P, one can smulate them one at a tme n round robn fashon untl the fastest of them solves P on the gven nput. It s easly seen that round robn executon s optmal among determnstc combnng algorthms that have no specc knowledge of the problem doman and nput. (As an asde, we show n Appendx A that randomzaton helps very lttle n ths context; for any randomzed combnng scheme, and any > 0, there s an nput set of algorthms, such that the expected cost s greater than (m? ) tmes the mnmum cost, versus m tmes the mnmum cost for round robn executon.) For on-lne algorthms the stuaton s more complcated We are gven a set S = fa ; A 2 ; ; A m g of on-lne algorthms (determnstc or randomzed { see below) for a problem P wth nput set I. Each algorthm A has a known compettve rato a wth respect to the optmum o-lne algorthm, but only for a subset of the possble nputs, such that the unon of these subsets covers I. We assume that P can be represented as a metrcal task system (see [2] for dentons). Our DEC Systems Research Center, 30 Lytton Ave. Palo- Alto, CA 9430. E-mal azar@src.dec.com, broder@src.dec.com, msm@src.dec.com. goal s to construct an on-lne algorthm for P that s compettve over all possble nputs. Agan, we are nterested n algorthms that have no specc knowledge of the problem doman and nput. More precsely, let t be the sequence of requests up to tme t. Let C ( t ) and c ( t ) be the conguraton (respectvely the cost) assocated to A servng t. At tme t, the conguraton assocated to the combnng algorthm must be one of the C ( t )'s. The decson to swtch from C ( t? ) to C j ( t ) can be based only on the values c ( t 0) for m and 0 t 0 t and on no other doman or nput specc nformaton. If the algorthms A and the combnng constructon are determnstc, then we call the new algorthm onlne combne and denote t mn S. If the constructon uses random bts, we call the algorthm randomzed onlne combne, denoted rmn S. In ths later case the A 's mght be randomzed as well. Fat et al. [3] addressed the queston of on-lne combne n a context restrcted to pagng algorthms. Fat, Raban, and Ravd [5] consdered the general case and showed that constructng a mn S algorthm for an arbtrary set of on-lne algorthms s equvalent to the layered graph traversal problem analyzed by Papadmtrou and Yanakaks [6] and Baeza-Yates, Culberson, and Rawlns []. Usng the results of these analyses, they obtaned a mn S algorthm wth compettve rato O(m max fa g), whch s optmal up to a constant factor when all the a 's are equal, but not n general. In ths paper we completely solve the general case, when the a 's are arbtrary. Ths mmedately yelds a better compettve rato for the k-server algorthm of [5]. In ths paper, we show that the problem of combnng on-lne algorthms s equvalent, up to a small constant factor, to ndng the value of a very smple twoplayer card game. In ths game, two dentcal decks of cards are gven to two players. Smplfyng slghtly, the rst player (correspondng to the on-lne combnng algorthm) places a card face-down on the table. The second player (the adversary) chooses a card from hs hand, and turns t face up on the table. The rst player Feld experments show that 5-year olds can easly play t...

2 Y. Azar, A. Z. Broder, and M. S. Manasse then exposes the matchng card, ether from her hand, n whch case no score s recorded, or by showng the card on the table, n whch case the second player wns the value of the card. The par s removed from play, and the players play another round wth the reduced decks, untl both players run out of cards. A few varatons exst, all of whch turn out to be equvalent n terms of optmal strategy the rst player can be requred to pck the same card to place face down for each round untl t s matched by the second player, or not; the second player s requred to arrange the order n whch he wll play cards n every round before play commences; one can even requre the rst player to select a schedule n advance for whch card she wll place face down next, except for those cards that are matched before ther turn comes. It turns out that optmal play for all these varants results n the same total or expected score for the second player. In the determnstc case, the total s clearly the value of all the cards, snce the second player can nspect the rst player's strategy, and play cards n exactly the same order. The randomzed case has the followng optmal strategy for buldng a schedule let each card have a probablty proportonal to the nverse of ts value, and choose a card usng that dstrbuton. That card s the last card n the schedule. Repeat ths procedure on the remanng cards to nd the schedule n reverse order. By analyzng the card game, we obtan the followng results Theorem.. Let S = fa ; A 2 ; ; A m g be a set of determnstc on-lne algorthms for a metrcal task system P wth nput set I. Assume that each A has a compettve rato a wth respect to the optmum o-lne algorthm for a subset of the possble nputs such that the unon of these subsets covers I. Then there exsts a determnstc P mn S algorthm wth compettve rato O( m a ), and no determnstc on-lne algorthm can do better n general, except for a constant factor. The mprovement wth respect to the prevous bounds s relevant when the average of the a 's s substantally smaller than ther maxmum. In partcular, our mn S algorthm reduces the compettve rato of the k-server algorthm of [5] by a factor of k!=2 O(k). (See secton 6.) For the randomzed case we need rst to dscuss a functon that wll play an mportant role n what follows. Let a ; a 2 ; be a sequence of postve numbers. For any set T of natural numbers we dene f(t ) by the recurrence (.) f(;) = 0 +P f(t ) = 2T f(t n fg)=a P2T =a ; T 6= ; Let [m] stand for the set f; 2; ; mg. Note that f([m]) s a symmetrc ratonal functon of a ; ; a m. In partcular f(fg) = a ; f(f; 2g) = a2 + a 2 2 + a a 2 a + a 2 ; but the numbers of terms grows very fast f(f; 2; 3g) has 9 terms, and f(f; 2; 3; 4g) has 390. Nevertheless, we can crudely bound f(t ) by (.2) H m mn 2T a f(t ) H m max 2T a ; where m = jt j, and H m s the m'th harmonc number. Better but more complex bounds wll be presented n Secton 3.. Now we can state our result for randomzed on-lne combne. Theorem.2. Let S = fa ; A 2 ; ; A m g be a set of determnstc or randomzed on-lne algorthms for a metrcal task system P wth nput set I. Assume that each A has a compettve rato a wth respect to the optmum o-lne algorthm for a subset of the possble nputs such that the unon of these subsets covers I. Then there exsts a randomzed rmn S algorthm wth compettve rato O(f([m])), and no randomzed on-lne algorthm can do better n general, except for a constant factor. Pluggng equaton (.2) nto the theorem yelds the weak upper bound O(log nmax a ) whch was obtaned n [4]. 2 The layered graph traversal problem Ths problem was ntroduced and analyzed n [] and [6]. A layered graph s an undrected graph wth the property that ts vertces can be dvded nto layers L 0 ; L ; L 2 ;, such that all edges run between consecutve layers. Each edge e, has a certan non-negatve length l(e). A dsjont-paths layered graph conssts exactly of m paths wth a common rst vertex s, called the source, but otherwse vertex dsjont. Thus, the graph can be dvded nto layers L 0 = fsg; L ; L 2 ;, such that layer for > 0 conssts of the m vertces that are edges away from the source on each path.

On-lne Choce of On-lne Algorthms 3 An on-lne layered graph traversal (lgt) algorthm starts at the source and moves along the edges of the graph. Each tme t moves along an edge (n any drecton), t pays a cost whch s the length of the edge. Its goal s to reach a target whch s a vertex n the last layer. The lengths of the edges between layer L? to L are revealed to the algorthm only when a vertex n L? s reached for the rst tme. (The lengths do not change over tme.) The target vertex becomes known only when the algorthm reaches a vertex n the nextto-last layer. The compettve rato of the on-lne traversal algorthm s the worst case rato between the dstance traveled by the on-lne algorthm and the length of the shortest path from the source to the target. (For dsjont paths graphs, ths path s unque. Also n ths case any lgt algorthm must advance one layer at a tme ether by contnung on ts current path, or by backtrackng to the source and choosng a derent path.) For general layered graphs, the compettve rato s exponental for determnstc algorthms, but polynomal for randomzed ones [4, 7]. For dsjont-paths layered graphs the optmal determnstc algorthm has compettve rato + 2m( + m? )m? 2em (see [6] and []). For randomzed algorthms Fat et al. [4] showed that the compettve rato s (log m). For the remander of ths paper we wll consder only dsjont-paths layered graphs. We need a slght generalzaton of the model above we assume that each path P has a known assocated waste factor a. For each edge e on P, the o-lne algorthm pays l(e)=a, whle the on-lne algorthm pays l(e) as before. Thus the compettve rato becomes a functon of a ; ; a m, and the precedng model corresponds to a = a 2 = = a m =. Followng [5] we show now that constructng a mn S algorthm s equvalent to an algorthm for the moded lgt wth the same compettve rato. Frst assume that a (moded) lgt algorthm s gven. To construct a mn S algorthm, we construct a dsjont-paths layered graph whch assocates a path P wth each algorthm A. We set the waste factors to be the compettve ratos a ; ; a m and smulate A ; ; A m on the sequence of requests as follows. When a request s made, the mn S algorthm computes the costs of the edges to the next layer; the cost of the edge on P s the cost of servng the request by A, as f A had been contnually smulated from the begnnng. Then, the mn S algorthm apples the lgt algorthm n order to decde how to serve the request. If the lgt algorthm contnues wth the current path P, then mn S contnues to smulate the current algorthm, A. On the other hand, f the lgt algorthm backtracks and moves to a vertex v (n the next layer) va another path, P j, then the mn S algorthm swtches to the con- guraton correspondng to v, and A j becomes the current algorthm. Snce we assumed that the underlyng problem s a metrcal task system, the trangle nequalty holds for the cost of swtchng between conguratons; thus the cost of mn S s bounded by the cost of lgt. Clearly then, a compettve lgt algorthm yelds a mn S algorthm wth the same compettve rato, or better. Conversely, one can easly use a mn S algorthm to construct an lgt algorthm wth the same compettve rato Let the metrcal task system P be the dsjontpaths layered graph traversal, where the states correspond to vertces n the graph, wth the transton cost between states equal to the total dstance n the graph. (It s readly seen that P s well dened.) Let A ; A 2 ; ; A m be the m algorthms that correspond to stckng to path P and let a ; ; a m be the waste factors. Clearly, the lgt algorthm that follows mn S n the obvous manner has the same compettve rato. 3 The Guess Game In ths secton we dene and analyze a certan two player zero-sum game, called the Guess Game. Later we wll use ths analyss to derve upper and lower bounds for the dsjont-paths layered graph traversal problem. One partcpant s called the player and the other s called the adversary. Both start wth the same set of cards T = [m] = f; ; mg. The value of card s a > 0. The game starts wth the adversary puttng all hs cards face-down on the table n a certan order, that he wll be unable to change durng the game. Then the player chooses one of her cards and puts t facedown on the table. We call ths the hdden card. The adversary then turns up the rst of hs cards and the player has to match t. If the card matches the hdden card (a ht) then the adversary wns the value of the card, the matched par s dscarded, and the player must pck a new card face down. If not (a mss), then the player matches the adversary's card wth a card from her hand and the matched par s dscarded wthout further ado.hence, there are m rounds. The value of the game s the sum of the values of the cards that the adversary wns. Observe that the player pays a f and only f she

4 Y. Azar, A. Z. Broder, and M. S. Manasse hdes card before she hdes any card that comes after n the adversary's order. In partcular the player always pays for the last card n the adversary's order. Let's assume that that the player selects her algorthm rst, and that the adversary s aware of the selecton made. If the player's algorthm s determnstc, then the adversary's best strategy s obvous he chooses the order of hs guesses to be the same order as the hdden cards of the player and thus he wns at every round. Hence, the value of the game s exactly P m a. In the randomzed case the stuaton s more complcated. The player can choose her hdden cards accordng to dstrbutons that mght depend on the hstory of the game. On the other hand, basc game theory mples that, gven the probablty dstrbuton on the player strateges, there s a determnstc strategy for the adversary, that s, a xed order of guesses, that maxmzes hs prot. In order to analyze the value of the game we dene two other models for players. A strong player s a player whch, after each mss, s allowed to replace the hdden card by a card whch s stll n her hand. Ths, of course, can only help the player and does not ncrease her expected cost wth respect to a standard player. A weak player s one that chooses the order of her hdden cards n advance (usng random bts) and s not allowed to change ths order later n the game. More precsely, the weak player chooses an order for her cards at the begnnng of the game and then, whenever there s a ht, she replaces the hdden card by the lowest ordered card whch has not been dscarded yet. Clearly the expected cost for a weak player s no lower than the expected cost for a standard player. Let f(t ) be dened by equaton (.). Our man result n ths secton s Theorem 3.. The value of the game wth a set of cards T s at least f(t ), even aganst a strong player, and s at most f(t ) even aganst a weak player. Thus the game value s exactly f(t ) for all three types of players. Proof. We start wth the lower bound and assume a strong player. Let g(t ) be the value of the game. We have to show that g(t ) f(t ) for any set T. We use nducton on the sze of T. If T = fg, then g(t ) = a = f(t ) and we are done. For the general case, let p j be the probablty that the player chooses card j as her rst hdden card. Now, f the adversary chooses card to be hs rst guess, and then chooses the best order for the remanng cards as f the game started wth T n fg, he can clearly guarantee, even aganst a strong player, an expected cost of at least p a + g(t n fg). The adversary can choose the whch maxmzes ths expresson. That mples that for all g(t ) p a + g(t n fg); or P g(t )? g(t n fg) p a But p =, and therefore or Thus g(t ) f(t ). g(t )? g(t n fg) a g(t ) +P 2T g(t n fg)=a P2T =a We now turn to the upper bound and assume a weak player. Agan the proof s by nducton on the sze of T. The case T = fg s trval. For the general case, recall that a weak player hdes her cards n a xed order. Assume that the player constructs her order as follows Among all cards she pcks a card wth probablty nversely proportonal to ts value. Let the card so chosen be the last card n her order. From the remanng cards she pcks agan a card wth probablty nversely proportonal to ts value. Let t be the nextto-last card n her order. And so on. (That s, f after k choces the set of remanng cards s T and 2 T, the probablty P that becomes the m? k card n the order s (=a )= j2t =.) 2 Let h(t ) be the value of the game when the adversary knows that the player has chosen ths partcular strategy. Let j be the card chosen by the adversary to be last n hs order. Let be the last card of the player. Note that j s xed, but s a random varable. If = j, an event whose probablty s proportonal to =, then the player has to pay n the last round. Furthermore, the dstrbuton used by the weak player wth respect to the set of remanng cards (that s, T n fjg) s exactly the same as f she started the game wth the set T n fjg. Hence n ths case, the player's expected cost s at most +h(t nfjg) even f the adversary plays optmally on the remanng cards. If 6= j, the player wll never have to pay a and agan her dstrbuton on the remanng cards s exactly as f she had started the game wth T n fg, so her cost s at most h(t n fjg). 2 Note that ths strategy s not the same as choosng the sequence from rst to last wth probabltes proportonal to a.

On-lne Choce of On-lne Algorthms 5 Ths mples that h(t ) P = or ( + h(t n f g)) 2T =a P2T nfjg h(t n fg)=a + That s, h(t ) f(t ). P2T =a h(t ) +P 2T h(t n fg)=a P2T =a We conclude that h(t ) = f(t ) = g(t ) and thus the value of the game s exactly f(t ) for all three types of players. 2 3. Propertes of f(t ). In ths subsecton we dscuss some of the nterestng propertes of f(t ). Let's return to the weak player's strategy as descrbed n Theorem 3.. Let P (; R) for 2 R T be the probablty that the player chooses card the last among the cards n R (whch means that, n the player's hdng order, card wll be the rst among the cards n R.) We clam that P (; R) does not depend on the values of the cards n T n R. Indeed, call the cards n R, red. We can thnk that when the player bulds her order, she rst decdes, wth sutable probablty, whether to pck a red card from the remanng cards, and f so, she then decdes, wth sutable probablty, whch red card to pck. Clearly the order among the red cards depends only on the values of the red cards. Let ; 2 ; ; m be the adversary's order. As we have already observed, for any strategy, the player pays a f and only f she hdes card before she hdes any card that comes after n the adversary's order. That mples that the probablty that the weak player pays a s exactly, P ( ; f ; + ; ; m g). But the proof of Theorem 3. mples that the weak player's strategy as descrbed s optmal, and therefore game theoretcal consderatons mply that the order chosen by the adversary s rrelevant { the expected value of the game s the same. It follows that (3.3) f([m]) = m a P ( ; f ; + ; ; m g) for any permutaton! In partcular, (3.4) f([m]) = m a P (; f; + ; ; mg) In ths form, t s rather hard to see that f([m]) s symmetrc n the a 's, snce the 'th term n the sum depends only on a ; a + ; ; a m. We also don't know of any drect proof that shows that (3.4) s a soluton of (.). Unfortunately, the alternate expresson s not computatonally easer, snce P (; R) does not seem to have a smple closed form. It can be computed wth the formula (3.5) P (; R) = Pj2Rnfg P (; R n fjg)= Pj2R = Smlar consderatons lead to Theorem 3.2. Let T = [m]. Wthout loss of generalty assume that a a 2 a m. Then and f(t ) m a m m a 2 a + + a m a 2 a + + a f(t ) m a m +? Proof. As above we consder the weak player's strategy. It suces to show that f a a 2 a m then a (3.6) P (; [m]) ; a + + a m and (3.7) P (m; [m]) a m a + + a m The proof s by nducton on m. Let S = a + + a m. The base case s trval. For the general case, by the denton of the weak player's strategy and the nducton hypothess, we have a P (; [m]) S? (3.8) Observe that = S? = S Hence (3.8) becomes P (; [m]) a S j> P a j = j> j> j S? + S? + S? j ;

6 Y. Azar, A. Z. Broder, and M. S. Manasse for whch t suces to show that j> S? a Smlarly, provng equaton (3.7) reduces to provng that j<m S? a m The last two nequaltes follow from and S? a j> j j> j<m S? j<m (m? )a = a ; (m? )a m = a m Now usng equaton (3.6) (resp. (3.7)) n equaton (3.3) and the permutaton = m? + (resp. = ) completes the proof. 2 4 The lower bound Let r be an arbtrary postve real number. Gven a ; ; a m, we show that an adversary can construct a dsjont-paths layered graph such that the cost of the o-lne (moded) lgt algorthm s r whle the cost of any on-lne lgt s at least rv([m]), where v([m]) s the value of the Guess game on m cards wth values a ; ; a m. (If the on-lne lgt algorthm s determnstc (resp. randomzed) then so s the player; and the value of v([m]) changes accordngly v([m]) = Pm a n the determnstc case and v([m]) = f([m]) n the randomzed case.) The graph conssts of m paths and m + layers. Each path starts wth an edge wth nte postve length, followed by a number of zero length edges, followed by a (practcally) nnte length edge, except for the path to the target, whch does not contan the nnte edge. Path P starts wth an edge wth length ra and has waste factor a. Each path has ts nnte edge startng on a derent layer, and for j = ; ; m?, every layer L j has an nnte edge out. Thus, the on-lne algorthm has no reason to vst the same path twce, and whenever t pad the rst edge on the path, t can be presumed that t wll not backtrack before reachng the nnte edge, or the target, snce t costs nothng to advance and return on the zero length edges. Path P corresponds to card n the game. The onlne algorthm startng path corresponds to the player hdng card. An nnte edge on P between layer j and j + corresponds to the adversary guessng card at round j n the game. Wth these correspondences, t can be easly vered (see the example below) that a (randomzed) strategy for the lgt algorthm mmedately translates nto a strategy for the (randomzed) standard player n the Guess game. Gven the player's strategy, the adversary starts by choosng an order on the paths correspondng to hs optmal order of guesses n the Guess game. Let ths order be ; 2 ; ; m. The adversary completes the constructon as follows The target s on path m at layer m. For = ; ; m? the path gets ts nnte edge between layers and +. For nstance f the algorthm starts on path 3 then t pays ra 3 but wll not pay the rst edges on and 2. Ths corresponds exactly to the player n the Guess game that hdes 3 at the rst turn, and hence pays a 3 but does not pay a or a 2. Clearly the cost of the lgt algorthm s at least r tmes greater than the cost of the player. (\At least" because the lgt algorthm also pays on the way back to source.) Hence we conclude that the cost of the on-lne lgt algorthm s at least rv([m]) whle the cost of the o-lne algorthm s only r. (The path to the target has length ra m and waste factor a m.) Ths concludes the proof of the lower bound. 5 The upper bound The proof below makes the assumpton that the algorthms A ; ; A m are determnstc. The proof for randomzed algorthms s smlar, but requres many techncaltes whch obscure the essental deas. We leave t for the full paper. We are gven a dsjont-paths layered graph traversal problem the graph conssts of m paths P ; ; P m wth waste factors a ; ; a m. We show how to construct an lgt algorthm usng a strategy for the Guess game. Let l ;j be the dstance from the source to layer j on path P. Let s j = mn l ;j =a, that s, s j s the mnmum cost that the o-lne algorthm must pay to get to layer j. Let j 0 be the mnmum j such that s j > 0. Let s = s j 0. We now partton the layers nto strata. All layers j such that s2 k? s j < s2 k ;

On-lne Choce of On-lne Algorthms 7 belong to stratum k. All layers j wth j < j 0 belong to stratum 0. Consder a layer j n stratum k. If l ;j =a > s2 k call path blocked at j. Notce that on each layer there must be some path whch s not blocked. (If all the paths have l ;j =a > s2 k then we just started a new stratum, and the \blocked" noton s redened.) For stratum 0 we call a path blocked f l ;j = > 0. Now we are ready to descrbe the on-lne lgt algorthm. For stratum 0, the algorthm follows a 0- length path untl t blocks, then swtches arbtrarly to another 0-length path, and so on, untl all paths have strctly postve lengths and stratum starts. Notce that n general, once the algorthm has reached layer j?, t can compute s j at no cost. Once t gets to the rst layer of stratum k, the onlne algorthm gets to the rst layer of the next nonempty stratum k 0 ths way t follows a path untl t blocks (wth respect to stratum k), then t returns to the source and follows another path not yet blocked, and so on, untl t arrves on the rst layer of stratum k 0. The crux of the algorthm s how to choose the next path to try. The dea s that on the rst layer of stratum k > 0, the algorthm starts playng a Guess game. As n the lower bound proof, path P corresponds to card n the game, the on-lne algorthm tryng path corresponds to the player hdng card, and a blocked path P corresponds to the adversary guessng card at a certan round n the game. The derence s that now the adversary mght guess (and mss) some cards even before any card s hdden { ths corresponds to paths that are already blocked wth respect to stratum k on the rst layer of the stratum, and the adversary mght guess several cards at once, aganst a sngle hdden card { ths corresponds to paths that block on the same layer. Of course, both these maneuvers work to the advantage of the player. Notce that card on stratum k costs at most s2 k a. Takng nto account backtrackng, the total cost of the on-lne algorthm on stratum k s bounded by 2s2 k v([m]) where v([m]) s the value of the Guess game on m cards wth values a ; ; a m. Assume that the target belongs to stratum t. Then the total cost of the o-lne algorthm s at least s2 t? whle the total cost of the on-lne algorthm s at most 2s( + 2 + + 2 t )v([m]) < s2 t+2 v([m]) Hence the compettve rato s at most 8v([m]) that s, 8 P m a for the determnstc case, and 8f([m]) for the randomzed case. 6 Applcaton to the k server problem The k-server algorthm of [5] s based on recursve calls to the mn S operaton wth 2 algorthms whose compettve rato can be dvded nto groups, each of sze. The compettve ratos of the algorthms n the same group are about the same but the ratos der greatly among groups. More precsely, the sum of the compettve ratos of all the algorthms s domnated by the sum n one group. Thus the average compettve rato s () tmes smaller than the maxmum one. The mn S orgnally used n [5] has compettve rato O(m max P fa g), whle our algorthm has compettve rato O( m a ). Hence, our algorthm saves a () factor n each recursve call and ths results n a k!=2 O(k) overall savngs factor. Unfortunately the compettve rato of the moded algorthm s stll exponental n k, namely O((k!) 2 2 O(k) ). A Combnng o-lne algorthms. Let S be a set of k o-lne algorthms such that for each nput at least one of algorthms runs quckly. What s the fastest way to combne the executon of the algorthms n S to solve a partcular nput? Can we nd an algorthm whch combnes the elements of S whch, for every nput, acheves performance wthn some constant factor of the fastest algorthm for that nput? Agan we are nterested n a combnng procedure that has no specc knowledge of the problem doman and nput. We consder two models n the rst one there s no a pror bound on the runnng tme of the algorthms; n other words the only way to determne the runnng tme of a partcular algorthm on a gven nput s to run t untl t termnates. In the second model, the runnng tme of each algorthm A s known to be ether exactly a or nnte; ths corresponds to havng a known compettve rato, or performance guarantee. A. No performance guarantee. The standard soluton to ths problem s the Round Robn (rr) algorthm whch acheves a performance rato of precsely k n the worst case. It works by executng ndvdual nstructons from each of the algorthm n turn untl one of them termnates. Thus, f the fastest algorthm A 2 S costs n steps, rr wll cost between k(n? ) +

8 Y. Azar, A. Z. Broder, and M. S. Manasse and kn, dependng on where A falls n the orderng of S. If the orderng s determnstc, the adversary can chose an nput such that the last algorthm n the order s the best, leadng to a compettve rato of exactly k. It s easy to see that rr s optmal among determnstc combnng algorthms. Can randomzaton help reduce the expected rato? Consder, for example, the algorthm that rst randomly sorts the algorthms n S, and then apples round robn. The expected cost on an nput wth least cost n s then k(n? ) + (k + )=2 = kn? (k? )=2, yeldng a compettve rato approachng k as n becomes large. Ths algorthm fals to mprove the compettve rato n the worst case. We now show that we cannot hope to do better by showng that no algorthm can acheve a rato better than k. To prove ths, we apply a varaton of Yao's theorem to the compettve ratos under consderaton (not to the costs themselves!), whch allows us to replace randomness n the algorthm wth randomness n the nput. We wll choose a dstrbuton on the dentty of the fastest algorthm among the k algorthms n S and ts termnaton tme. Let n be a parameter to be chosen later and suppose that the other algorthms have nnte cost on the nputs for whch they are not fastest; t suces for these costs to be at least kn. Now, let the probablty that the A j s the fastest algorthm, and that ts termnaton tme s (where n), be k + + n = 2 kn(n + ) Ths denes a probablty dstrbuton. Take any combnng algorthm C for ths dstrbuton. We wll show that t acheves a rato no better than (kn + )=(n + ). For large enough values of n, ths approaches k. Why can C do no better than the rato above? Snce C s determnstc, and has no specc knowledge of the problem doman and nput, t has a xed order n whch t smulates the steps of the algorthms. (For nstance step -0 of algorthm A 7, followed by steps? 5 of algorthm A 5, and so on.) C stops as soon as one algorthm nshes. In the worst case C has to smulate kn steps. Consder step t of C. At that step, suppose C smulates step of algorthm j. Wth probablty 2=(kn(n+)), ths wll be the termnatng step, leadng to a cost rato of t=. Ths contrbutes 2t=(kn(n + )) to the expected rato, ndependently of and j. Thus for every order, and hence for every algorthm, the expected rato s 2t kn(n + ) = kn + n + tkn A.2 A pror performance guarantee. Let S be a set of n o-lne algorthms such that for each nput at least one of algorthms runs quckly. Suppose that the runnng tme of each algorthm s known to be ether exactly a or nnte. Agan we are nterested n a procedure whch combnes the algorthms such that for every nput, t acheves a performance wthn some constant factor of the fastest algorthm. Frst, observe that our desred algorthm need never nterleave the executons of derent algorthms. Snce no nformaton about the runnng tme of algorthm s ganed untl step a, we can convert any algorthm for ths problem nto one whch runs the algorthms n the order n whch ther decsve steps are executed. Therefore, our algorthm s determned by ts orderng of the algorthms from S. If the orderng s determnstc, the worst case cost s s = P n a, acheved when the nput s solved only by the last algorthm tred. In ths case, randomzaton does help. The exact complexty for the randomzed case s jn a Lower bound We use Yao's theorem. The adversary assgns probablty =s to the outcome that j s the correct algorthm. Consder a determnstc combnng algorthm P C that chooses an executon order p ; p 2 ; ; p n. If p j was the correct algorthm, then C ncurs cost j a p. Thus, the total expected cost s a pj a p = a a s jn Upper bound j jn a Arrange the algorthms n some order e.g. ; 2; ; n. Wth probablty =s start wth algorthm j, then j +, and so on n cyclc order. Let l be the ndex of the correct P algorthm. If P the algorthm starts wth j ts cost s jl a where jl denotes a cyclc sum. A cyclc sum s the same as a regular sum when j l, but f j > l, then the sum s on the ndces that satsfy j n and j. Then the expected cost s a a jn s jl a = jn

On-lne Choce of On-lne Algorthms 9 References [] R. Baeza-Yates, J. Culberson and G. Rawlns, \Searchng n the plane," to appear n Informaton and Computaton. [2] A. Borodn, N. Lnal, and M. Saks. \An Optmal Onlne Algorthm for Metrcal Task Systems" Proceedngs of the 9th Annual ACM Symposum on Theory of Computng, 987, pp. 373{382. [3] A. Fat, R. Karp, M. Luby, L. McGeoch, D. Sleator, and N. Young. \Compettve pagng algorthms," Journal of Algorthms, 2(99), pp. 685-699. [4] A. Fat, D. Foster, H. Karlo, Y. Raban, Y. Ravd and S. Vshwanathan, \Compettve algorthms for layered graph traversal," Proceedngs of the 32nd IEEE Symposum on Foundatons of Computer Scence, 99, pp. 288-297. [5] A. Fat, Y. Raban and Y. Ravd, \Compettve k- server algorthms," Proceedngs of the 3st IEEE Symposum on Foundatons of Computer Scence, 990, pp. 454-463. [6] C. Papadmtrou and M. Yanakaks, \Shortest paths wthout a map," Proceedngs of the 6th ICALP, 989, pp. 60-620. [7] H. Ramesh, \On traversng layered graphs on-lne," Ths proceedngs, 992. [8] D. Sleator and R. Tarjan, \Amortzed ecency of lst update and pagng rules," Communcatons of the ACM, 23(985), pp. 202{208.