We now give an algorithm for the more general case when the machines are unrelated and our measure is weighted flow time. Let(
& denote
%( & . Thus(
& denotes the minimum size of
among all the machines. Let
&
(
& , and suppose that the weights are integers in the range
. For unrelated machines, we define , ) & ( ) (
& . Note that if the machines are identical, this definition of
, corresponds
exactly to the maximum of minimum job size ratio. Also it is easily seen that
,
) (
5.3. EXTENSIONS 55 We will give an algorithm that produces a
approximate solution and has running time
" "
. Our algorithm will consist of two different algorithms. First is an algorithm which has running time
"
for the case when
, . The other algorithm has running time
"
for the case when
,
We first consider the case when
, . By assigning each job to the machine where it takes the least
time, it is clear that
is an upper bound on ( . Similarly,
is a lower bound on ( . Hence we will
assume that our algorithm simply never assigns a job & to machine if(
&
.
Next, as in lemma 5.1, it easily follows that rounding each( )& and release date up to the next multiple
of
affects the total flow time of each job by at most
. Since the maximum weight of any job is at most
, this affects the total weighted flow time by at most
( . Moreover, we can also
assume that the release date of any job is at most
(otherwise the problem can be decomposed into two disjoint instance). Thus after rounding the release dates and sizes to multiples of
, our algorithm needs to consider only
time steps. Next we round up the weights to powers of
. Clearly, this affects the solution by at-most a
factor. Finally, observe that in the optimal schedule for this rounded instance, if we consider a particular machine and restrict our attention to time intervals when jobs from a particular weight class are executed, then these jobs are executed in the SRPT order.
With these observations we can directly give an algorithm based on the ideas in Section 5.2. For each machine and each weight class, we maintain the states under SRPT. Since there are
weight classes, and there are
size classes the number of states at each time step is bounded by
"
. When a job arrives, there are choices corresponding to the machines it can be as- signed. If there are no arrivals, for each machine, we need to decide which weight class to work on, and with each weight class which size class to work on. Thus there
choices to choose from at each time step. Finally, since all the release dates and sizes are integers between 1 and
, our algorithm can be implemented directly as a dynamic program of size
times " . This gives the desired bound on the running time.
We now consider the case when ,
. Defining
as previously we see that again ( is at most . Since , ) (
) , it follows that each job has size at least
, on each machine. Finally,
since the maximum weight is
, it follows that ( is also lower bounded by
, .
Our algorithm now is as follows. We only consider jobs with weights between
, and . Jobs with weight below
, will be added to the schedule arbitrarily. Since each job has flow time at most
, this adds at most
,
( . Similarly, rounding the job sizes and release dates to multiples of
, affect the total weighted flow time by at most
, , ( .
Thus after rounding we have an instance where the job sizes and release dates are integers between 1 and
,
and the job weights are in the range
, and
. Thus there are
, weight classes and ,
sizes classes. Applying the algorithm described above for the case
, and observing
that all release dates are bounded by
, , we get that the running time of the algorithm is
"
Thus we have shown that
Theorem 5.5 There is an algorithm for minimizing weighted flow time on multiple machines that produces a
approximate solution and runs in time
" " .