Competitive Analysis: Steven Skiena
Competitive Analysis: Steven Skiena
NY 117944400 http://www.cs.sunysb.edu/skiena
Competitive Analysis
How can we theoretically evaluate how well an algorithm forecasts the future? Statistical forecasts provide a predict the future that makes some sense in practice. However, they offer no future guarantees, particularly if the data distribution changes. Competitive analysis offers a worst-case measure of the quality of the behavior of an algorithm which predicts the future. We seek to compare the performance of algorithm A with only knowledge of the past with an algorithm which has complete knowledge of past and future makes optimal use of it.
Competitive Ratio
We say an online algorithm ALG is c-competitive if there is a constant such that for all nite input sequences I , ALG(I ) c OP T (I ) + Note that the additive constant is a xed cost that becomes unimportant as the size of the problem increases. We do not particularly care about the run-time efciency of ALG (except maybe that it is polynomial), but we do care about its competitive ratio c.
p M = p = Mm m p The reservation price policy (RPP) accepts the rst price greater than or equal to p = M m. Let = M/m dene the global uctuation ratio. The competitive ratio c we get is M c = M m/m = = m This is the optimal deterministic strategy.
Randomized Algorithms
Randomized algorithms use random numbers to design algorithms unlikely to encounter the worst possible case. Randomization is particularly useful to make things difcult for an adversary to design a future that is bad for you. We assume he has access to your program but not to read or effect the random numbers. In an analysis of a randomized algorithms, we determine the expected value over all random number sequences for the worst possible input. Thus our analysis is completely independent of the input distribution randomized expectation has nothing to do with statistical expectation.
Analysis Idea
Suppose the adversary picks j . Our target i was too big with probability (k j )/k if so we were forced to settle for a price of m. Our target i was less than pmax otherwise, meaning were able to realize our price.
Analysis
Our expected price is: kj 1 j EXP O(j ) = m+ m2i k k i=i j m k j + = 2i i=i k m = k j + 2j +1 2 k The competitive ratio is OP T m2j +1 c = =m EXP O(j ) (k j + 2j +1 2) k 2j +1 k O (k ) j +1 kj+2 2 (1) (2) (3)
(4) (5)
The competitive ratio is maximized when k is largest, for a competitive ratio of O (log ). Note that the ner gradations in price level are at the low end of the range, not the high end where they mean more in absolute dollars.