Chapter 12 On-Line Algorithms
Abstract:
In all of the previous chapters, algorithms are designed under the assumption that the whole picture of the data are available for us before the algorithm is executed. That is, problems are solved together with complete information of the data. However, this is not necessarily true in reality. Consider the disk scheduling problem. The requests of disk servers are totally unknown to the algorithm. They arrive one by one. The paging problem which occurs in operating systems design is also an on-line problem. We simply can not know which pages will be accessed before executing our programs. If the data arrive on-line, the algorithm still has to take action to take care of each datum which has just arrived. Since no complete information is available, the action may seem to be correct at this time, but may turn out to be wrong later. Thus on-line algorithms are all approximation algorithms in the sense that they can never guarantee to produce optimal solutions. Let us consider the on-line minimal spanning tree problem. In this case, we first have to drop the word "minimal " because the spanning tree will not be minimal. Thus we call the problem an on-line small spanning tree problem. An on-line algorithm to handle the situation may work as follows: Each time as a data item arrives, connect it to its nearest neighbor. Suppose that we have six points as shown in Figure 12.1. Let the data arrive in the order as specified. Thus one on-line algorithm may produce a spanning tree as shown in Figure 12.2. It is obvious that this tree is not optimal. An optimal spanning tree, constructed with full knowledge of the data, is shown in Figure 12.3. Since any on-line algorithm must be an approximation algorithm, its performance is naturally measured by comparing its result with that obtained by executing an optimal off-line algorithm. Let C onl (C off) denote the cost of executing an on-line (optimal off-line) algorithm on the same data set. If C onl f(n)C off +c where c is a constant, then we say that the performance ratio of this on-line algorithm is f(n) and this algorithm is f(n)-competitive. If f(n) can not be smaller, we say this on-line algorithm is optimal.

