#### Abstract

We consider the classical online scheduling problem over single and parallel machines with the objective of minimizing total weighted flow time. We employ an intuitive and systematic analysis method and show that the weighted shortest processing time (WSPT) is an optimal online algorithm with the competitive ratio of for
the case of single machine, and it is ()-competitive for the case of parallel machines , where *P* is the ratio of the longest to the shortest processing time.

#### 1. Introduction

In the context of scheduling problems, the flow time of a job is the total time it stays in the system. Sometimes it is also called response time. It is equal to the delay of waiting for service plus the actual service time. The total (weighted) flow time captures the overall quality of service of the system, which is a natural and important measure in many applications such as networks and parallel computing [1, 2]. From the prespective of optimal solutions, the objective of minimizing the total (weighted) flow time is equivalent to minimizing the total (weighted) completion time. However, online algorithms and approximation results are largely different between the two objectives.

In this work, we consider the online scheduling over parallel machines with the objective of minimizing the total weighted flow time. Formally, there is a set of jobs and identical machines. Each job is associated with processing time , release date , and a positive weight . All the information about one job is not revealed until it is released. Also, the total number of jobs is unknown a priori. An online algorithm determines which machine to be chosen and what time to start for processing each job without interruption. Denote the completion time and flow time of by and , respectively. Then, holds. The problem can be denoted by in terms of the standard three field notations for scheduling problems [3].

When the objective is to minimize the total (weighted) completion time, it is well known that optimal deterministic online algorithms with the competitive ratio of have been presented for [4, 5] and , respectively [6, 7]. As for the parallel machine scheduling , the current best online algorithm is given by Correa and Wagner [8]; they design a -competitive algorithm based on linear programming techniques and the concept of -point. However, no online algorithm with bounded competitive ratio exists for the case of total (weighted) flow time scheduling. Even for offline approximate algorithms, the lower bound on worst-case performance guarantee is still at least for the single machine case [9] and for the multiple machines case [2].

Since the lower bound is so strong, an intuitive idea is to impose some additional assumptions on the original problem. A widely used assumption is that the ratio of the longest to the shortest processing time is not greater than a constant, say . With this assumption, Bunde [10] proves that the shorting processing time (SPT) rule is optimal with the competitive ratio of for . Most of other previous works focus on the preemptive setting. Chekuri et al. [11] consider the problem , . They present a -competitive online algorithm when the weights are also bounded. Leonardi and Raz [2] prove that the shortest remaining processing time (SRPT) algorithm has a competitive ratio of for , . The same authors also provide a lower bound on the competitive ratio of any randomized algorithm for this problem. Bansal and Dhamdhere [12] make another kind of assumption. They assume that the job weights belong to at most different arbitrary weight classes. Under this assumption, they construct an online algorithm for and prove that it is -competitive. Combining this conclusion and the assumption that the ratio of the maximum to the minimum job weight is , the authors further obtain a -competitive algorithm, since weights can be rounded up to a power of .

To the best of our knowledge, no positive results exist when nontrivial weights are considered and preemption is not allowed. In this work, we show that the weighted shortest processing time (WSPT) rule is optimal with the competitive ratio of for , and it is -competitive for , (). The competitive analysis method is based on the idea of instance transformation, which is first introduced by us in [13] and is further developed in [14, 15]. The method tries to search for the worst-case instance in the instance space. It starts from an arbitrary instance and modifies the instance towards the possible structure of the worst-case instance with respect to the given online algorithm. The modification guarantees that the performance ratio of the modified instance does not decrease. Eventually, the modification ends up with an instance with a relatively simple and special structure, whose performance ratio can be much easily evaluated.

The paper is organized as follows. In Section 2 we show that the worst-case instance with respect to the WSPT rule is characterized by two kinds of special structures. Then, we analyze the performance ratio of these two kinds of instances for the single machine and parallel machines in Sections 3 and 4, respectively. Concluding remarks are given in Section 5.

#### 2. Block Structure of the Schedule and Instance Transformation

For any instance , denote the schedule obtained by WSPT by , the optimal offline schedule by , and the objective values of the two schedules by and , respectively. For any job in , denote its flow time in and by and .

It can be easily shown that the worst-case instance can be obtained among such instances for which the schedules by WSPT rule are composed of a single block. A block means a time interval in which jobs are processed contiguously without keeping all the machines idle at the same time. Denote any one of these instances by . Without loss of generality, assume that the first job is released at time ; that is, the single block begins at time . According to the nondecreasing order of starting times of jobs in , we further partition jobs into subblocks, such that the jobs within each subblock are ordered according to the WSPT rule and the last job of a subblock has a greater ratio of processing time to weight (hereafter, we use weighted processing time to refer to the ratio) than the first job of the succeeding subblock if it exists.

We will further show that a new instance with a more simple and special structure can be obtained by modifying the weights of jobs in . First we introduce an important lemma without proof since it can be derived from basic mathematics. The following lemma will be repeatedly used in the competitive analysis.

Lemma 1. *Let and be two positive functions defined in the interval ; moreover, is convex and is concave. Then, reaches its maximum at one endpoint of the interval; that is, for all . *

It can be easily shown that the above lemma still holds when the interval is open at some endpoint in the condition that the limitation of exists at the corresponding endpoint.

Lemma 2. *For an arbitrary instance , a new instance can be constructed by modifying the weights of jobs in , such that all the jobs in the new instance have the same weighted processing time or there are jobs which not only have the same weighted processing time but also have positive infinite weights in the last subblock of the schedule for the new instance; denote the former new instance by and the latter one by ; then
*

*Proof. *Assume that is composed of subblock. We first consider the case of . Next, we will show that an intermediate instance can be obtained by modifying , such that either is composed of subblocks or there are jobs with positive infinite weights in the last subblock of with subblocks.

Denote the last job of the next-to-last subblock in by . Denote the set of all the jobs of the last subblock by . Divide into two subsets in terms of the relations between their weighted processing times and ’s:

Modify the weight of each job in to , where is a parameter to be chosen later. Let

Denote the intermediate instance after this adjustment by . Since this adjustment does not change the mutual relationships of the weighted processing time among jobs in the last subblock, jobs are processed in in the same order as in for any .

is composed of the linear combination of all jobs’ weights, where the coefficient of each weight is the corresponding job’s flow time. Since the schedule does not change after adjustment and each job’s flow time does not change, is a monotonously increasing linear function with respect to . Consider how changes with respect to . If jobs keep the same processing order as in , the objective value of the obtained schedule is also a monotonously increasing linear function with respect to . Since the optimal schedule is the one with the minimal objective value among all the feasible schedules, is a piecewise linear function with respect to ; moreover, its slope does not increase with increasing. It means that is a concave function with respect to . According to Lemma 1, we can obtain an instance with a worse performance ratio by choosing as either or . There are two cases. (i)If is chosen as , there is at least one job belonging to whose weighted processing time is modified to according to (3). Then, update and according to (2). If there remain jobs in , modify their weights by repeating the above procedure; otherwise all the jobs in have been removed into . Since all the jobs in have greater weighted processing time than ’s, the last two subblocks in the original schedule can be combined into a single subblock in the new instance according to the description of “subblock” in Section 2; that is, is composed of subblocks.(ii)If tends to infinity, all the jobs in have weights . This intermediate instance is just the instance which we want to obtain at the beginning of the proof.

By repeatedly applying the above transformation procedure, we can eventually obtain a new instance, such that the schedule by WSPT for the new instance is composed of a single subblock, or there are jobs with positive infinite weights in the last subblock of the schedule for the new instance. For the former one, for ease of exposition, we still use to denote it. Next we will show that can be modified such that all the jobs have the same weighted processing time.

Denote the first job in the single subblock of by . Divide all the jobs into other two sets in terms of the relations between their weighted processing time and ’s:

Similar to the previous adjustment, modify the weight of each job in to , where is a parameter to be chosen later. Let

We use to denote the intermediate instance after this adjustment. Completely similar to the previous analysis, when lies in , is a monotonously increasing linear function with respect to . is a concave function with respect to . According to Lemma 1, we can obtain an instance with a worse performance ratio by choosing as either or an infinitely small value . If is chosen as , there is at least one job belonging to whose weighted processing time is modified to according to (5). Then, update and according to (4). If there remain jobs in , modify their weights by repeating the above adjustment procedure. If is chosen as an infinitely small value, all the jobs in have weights tending to . These jobs are processed at last both in and . Thus, we can directly delete these jobs, since they contribute nothing to the objective value.

After finite steps, all the jobs lie in ; that is, all the jobs have the same weighted processing time as ’s. It is just the instance which we want to obtain in the theorem. For the intermediate instance, where there are jobs with positive infinite weights in the last subblock, we can apply the same above modification and modify these jobs such that they have the same weighted processing time. The resulted instance is which we want to obtain in the theorem.

#### 3. WSPT’s Optimality for

In this section, we show that WSPT is optimal with the competitive ratio of for . We obtain the result by proving that is both an upper bound on the competitive ratio of WSPT and a lower bound on the competitive ratio of any online algorithm.

We know that the worst-case instance can be achieved among such instances, for which the schedules by WSPT are composed of a single block. From Lemma 2, we show that any such instance can be modified to a new instance with a worse performance ratio. Next, we can directly analyze the performance ratio of the new instance obtained in Lemma 2 and get the competitive performance of WSPT algorithm.

Theorem 3. *The WSPT algorithm is optimal with the competitive ratio of for .*

*Proof. *For the new instance described in Lemma 2, where all the jobs have the same weighted processing time, it is obvious that the schedule obtained by WSPT is just the optimal one for .

As for another new instance , there are jobs which not only have the same weighted processing time but also have positive infinite weights in the last subblock. Denote the last job of the next-to-last subblock by . Denote the set of all these jobs with positive infinite weights in the last subblock by . We can directly analyze the performance ratio of the instance by only considering these jobs in since other jobs’ weighted flow times can be omitted in the sense of limitation. All these jobs in are released after starts being processed in ; otherwise they would be processed before . These jobs are continuously processed immediately after is finished in . They are processed in the optimal schedule in the same order as in ; moreover, they start being processed not earlier than the time when starts in . Figure 1 illustrates the schedules and . Thus, we have
So, we get an upper bound on the competitive ratio of WSPT algorithm, i.e.,

Next, we show that is also a lower bound on the competitive ratio of any deterministic online algorithm for .

Consider the following instance. The first job arrives at time with and . The online algorithm decides to schedule at time . The second job is released job at time with and , where is an infinitely small value. The optimal schedule performs no worse than the one which first schedules at time , then, followed by . So we have

When tends to and tends to infinity, the above ratio tends to . Since a competitive ratio of an online algorithm is the maximal performance ratio over all the instances, we can directly obtain that the competitive ratio of any deterministic online algorithm is no less than .

According to the above analysis, we can immediately obtain that the WSPT algorithm is optimal with the competitive ratio of .

#### 4. Competitive Analysis of WSPT Algorithm for

Next, we will extend the result for the single machine in Section 3 to the case of parallel machines. Similar to the proof for Theorem 3, we can analyze the performance ratio of the new instances and obtained in Lemma 2. First, an appropriate lower bound on the optimal schedule has to be established in order to further analyze the performance ratio of and . Chou et al. [16] show a lower bound on the corresponding weighted completion time problem of by introducing a virtual -times faster single machine problem and the concept of LP schedule [17]. We can readily extend this result to the weighted flow time problem due to the equivalence between optimal schedules for and .

Corollary 4. *For an instance of , construct a virtual -times faster single machine instance . For the corresponding LP schedule of , denote the mean-busy-time and flow time of job by and , respectively, and then,
*

*Moreover, if the*

*LP*schedule is nonpreemptive, then,Hereafter, we refer to the lower bound in Corollary 4 as LP lower bound and denote it by .

##### 4.1. Performance Analysis of and

For simplicity, we give the result via three Lemmas.

Lemma 5. *For any instance for , if all the jobs have the same weighted processing time and there is no idle time on each machine before it completes its processing in the corresponding schedule , then,
*

*Proof. *All the jobs in the instance have the same weighted processing time. Moreover, there is no idle time on each machine before it completes its processing in the corresponding schedule in . We can find out that for the corresponding virtual -times faster single machine problem, the schedule which processes jobs without preemption and delay in the same starting order as in is just a LP schedule. Without loss of generality, we can assume that in order to simplify the analysis. Thus, the LP lower bound in (10) can be rewritten as
Another trivial lower bound on is

Taking how the LP schedule is constructed, we can bound the flow time in the WSPT schedule as
So

Denote the two bounds in (12) and (13) by and respectively,. Next, we analyze the performance ratio by two cases. (i)If , that is, , then
(ii)If , that is, ,

Lemma 6. *In the case of parallel machines, for the instance obtained in Lemma 2, one has
*

*Proof. *When there is no idle time on each machine before it completes its processing in , this result can be directly obtained from Lemma 5. Suppose that there are totally () periods of idle time in . Next, we will show that an intermediate instance can be obtained such that there are periods of idle time in ; moreover,

For the sake of exposition, we take an instance with three machines; for example, see Figure 2. is the ending time of the last (with respect to the ending point of the idle time) period of idle time. It means that all the jobs are continuously processed without idle time on each machine after . Since WSPT is a no-waiting strategy, we know that all the arrived jobs have been finished or are being processed at . is the latest completion time of jobs which start before . Denote the maximal processing time among all the jobs by ; then, .

Construct an intermediate instance denoted by , which is composed of all the jobs released before . In addition, we construct an auxiliary instance . It includes all the jobs released at and after . We have

In order to bound the later term in the above expression, similar to the proof of Lemma 5, consider the virtual -times faster single machine problem for . Assume that jobs are continuously processed on the virtual -times faster single machine from time in the same starting order as in without considering the release time constrain. Denote the corresponding flow time of by . Then, we can bound the flow time in the WSPT schedule as
Without loss of generality, let ; we have

In addition, for the virtual -times faster single machine problem for , consider its LP schedule. Denote by the flow time in the LP schedule. We can get a lower bound on as

Another trivial lower bound on is

Combining (22),(23), and (24), we have

Similar to the analysis of the two cases in the proof of Lemma 5, we can obtain

In addition, it can be obtained from that

According to the above analysis, we can obtain
and prove relation (19).

By repeating the above transformation, we can get a sequence of intermediate instances with (19) satisfied and finish the proof.

Lemma 7. *In the case of parallel machines, for the instance obtained in Lemma 2, one has
*

*Proof. *For ease of presentation, we still take an instance with three machines; for example, see Figure 3. Assume that these jobs with positive infinite weights start being processed at the time . is the latest starting time of jobs among all the machines before . is the latest completion time of jobs which start before . Denote the maximal processing time among all the jobs by ; then, . We only need to consider these jobs with positive infinite weights in the last subblock. Then, the proof is similar to the one for Lemma 6 and the detailed procedure is omitted.

Following Lemmas 2, 6, and 7, we can immediately get the competitive performance of WSPT for the case of parallel machines.

Theorem 8. *The WSPT algorithm is -competitive for . *

#### 5. Concluding Remarks

In this work, we consider the single and parallel machines online scheduling problem of minimizing the total weighted flow time. We show that WSPT rule is optimal with the competitive ratio of for the single machine problem, where is the ratio of the longest to the shortest processing time. We further prove that the WSPT rule is -competitive for the case of parallel machines (), which is consistent with the case of single machine problem.

In the competitive analysis, we introduce an intuitive and systematic method. The method is aiming to derive an upper bound on the competitive ratio of the online algorithm. The analysis method exploits the possible structure of the worst-case instance with respect to the given online algorithm. The basic idea behind it is to begin with an arbitrary instance and transform it by modifying the instance, such that the modified instance shows a more special structure of which we can take advantage to analyze the performance ratio. The analysis method deserves to be extended to other online algorithms in our further work.

#### Acknowledgments

The authors would like to thank Junjie Zhou and Ye Tao for the useful discussion. This work is supported by the National Science Foundation of China (no. 11201391 and no. 61203176) and Fujian Natural Science Foundation of China (no.2013J01103).