Presentation on theme: "Minimizing Average Flow-Time Naveen Garg IIT Delhi Joint work with Amit Kumar, Jivi Chadha,V Muralidhara, S. Anand."— Presentation transcript:
Minimizing Average Flow-Time Naveen Garg IIT Delhi Joint work with Amit Kumar, Jivi Chadha,V Muralidhara, S. Anand
Problem Definition Given : A set of M machines A set of jobs A matrix of processing times of job i on machine j. Each job specifies a release date
Problem Definition Conditions : Pre-emption allowed Migration not allowed
Problem Definition Flow-time of j, Goal : Find a schedule which minimizes the average flow-time
Special Cases Parallel : all machines identical Related : machines have different speeds Subset Parallel : parallel except that a job can only go on a subset of machines Subset Related All of these are NP-hard.
Previous work The problem is well studied when the machines are identical. For a single machine the Shortest- remaining-processing-time (SRPT) rule is optimum. [Leonardi-Raz 97] argued that for parallel machines SRPT is (min (log n/m, log P)) competitive, where P is max/min processing time. They also show a lower bound of (log P) on competitive ratio
Fractional flow-time p j (t ) = remaining processing of job j at time t remaining fraction at time t = Fractional flow-time of j = t r j p j (t )/p j Recall, flow-time of j =
Fractional flow-time 1512 Fractional flow-time = 1*2 + 2/3*3 + 1/3*7 Fractional flow-time can be much smaller than (integral) flow-time 20
Integer Program Define 0-1 variables : x(i,j,t) : 1 iff job j processed on i during [t,t+1] Write constraints and objective in terms of these variables. Fractional flow-time of j = t r j ( t-r j ) x(i,j,t)/ p ij
LP Relaxation One Caveat …
Fractional flow-time A job can be done simultaneously on many machines : flow-time is almost 0
LP Relaxation Add a term for processing time
Class of a job : The processing time of j rounded up to nearest power of 2 If, we say k is the class of job j Number of different classes = O(log P)
Modified Linear Program
Modified LP LP value changes by a constant factor only. But : rearranging jobs of the same class does not change objective value.
From fractional to integral The solution to the LP is not feasible for our (integral) problem since it schedules the same job on multiple m/cs. We now show how to get a feasible, non- migratory schedule.
Rounding the LP solution Consider jobs of one class, say blue. Find the optimum solution to the LP.
Rounding the LP solution (contd.) Rearrange blue jobs in the space occupied by the blue jobs so that each job is scheduled on only one m/c. If additional space is needed it is created at the end of the schedule Additional space
Assignment as flow Fix a class k : arrange the jobs in ascending order of release dates. r1r1 0 0 i v(i,k,j) s Flow = ? r7r7 r6r6 r5r5 r4r4 r3r3 r2r2
Unsplittable Flow Problem s d1 d2 d3
Unsplittable Flow Problem s d1 d2 d3 Flow can be converted to an unsplittable flow such that excess flow on any edge is at most the max demand [Dinitz,Garg, Goemans]
Back to scheduling... Fix a class k : find unsplittable flow i v(i,j,k) s Gives assignment of jobs to machines
Back to scheduling... J(i,k) : jobs assigned to machine i i v(i,j,k) s Can we complete J(i,k) on class k slots in I ?
Building the Schedule Flow increases by at most max processing time = 2 k So all but at most 2 jobs in J(i,k) can be packed into these slots Extra slots are created at the end to accommodate this spillover
Increase in Flow-time How well does capture the flow-time of j ? Charge to the processing time of other classes
Finally... Since there are only log P classes… Can get OPT + O(log P).processing time flow-time for subset parallel case.
Integrality Gap for our LP(identical m/c) 0 m k-1 2m k-1 mkmk +m k-1 mkmk m k-1 m T 1 Phase0 1k-1k
Integrality Gap for our LP(identical m/c) For sufficiently large T, flow time mT(1+k/2) 0 m k-1 2m k-1 mkmk +m k-1 T Phase0 1k-1k Blue jobs can be scheduled only in this area of volume (m k +m k-1 )m/2 At least m/2 blue jobs left At least mk/2 jobs left
Integrality Gap for our LP(identical m/c) Optimum fractional solution is roughly mT 0 m k-1 2m k-1 mkmk +m k-1 mkmk m k-1 m T 1 Phase0 1k-1k
Integrality gap Optimum flow time is at least mT(1+k/2) Optimum LP solution has value roughly mT So integrality gap is (k). Largest job has size P = m k. For k = m c, c>1, we get an integrality gap of (log P/loglogP)
Hardness results We use the reduction from 3-dimensional matching to makespan minimization on unrelated machines [lenstra,shmoys,tardos] to create a hard instance for subset-parallel. Each phase of the integrality gap example would have an instance created by the above reduction. To create a hard instance for parallel machines we do a reduction from 3- partition.
A bad example 0 T B x A x A+B=T A> T/2 T+L A x Flow time is at least AxL > T L/2 OPT flow time is O(T 2 +L) Ω(T) lower bound on any online algorithm
Other Models What if we allow the algorithm extra resources ? In particular, suppose the algorithm can process (1+ε) units in 1 time-unit. [first proposed by Kalyanasundaram,Pruhs95] Resource Augmentation Model
Resource Augmentation For a single machine, many natural scheduling algorithms are O(1/ O(1) )- competitive with respect to any L p norm [Bansal Pruhs 03] Parallel machines : randomly assign each job to a machine – O(1/ O(1) ) competitive [Chekuri, Goel, Khanna, Kumar 04] Unrelated Machines : O(1/ 2 )-competitive, even for weighted case. [Chadha, Garg, Kumar, Muralidhara 09]
Our Algorithm When a job arrives, we dispatch it to one of the machines. Each machine just follows the optimal policy : Shortest Remaining Processing Time (SRPT) What is the dispatch policy ? GREEDY
p j 1 (t ) The dispatch policy When a job j arrives, compute for each machine i the increase in flow-time if we dispatch j to i. j1j1 j2j2 jrjr j r+1 jsjs j arrives at time t : p ij 1 (t) p ij 2 (t) … p ij r (t) < p ij < p ij r+1 (t) j Increase in flow-time = p j 1 (t ) + … + p j r (t ) + p ij + p ij (s-r)
Our Algorithm When a job j arrives, compute for each machine i the increase in flow-time if we dispatch j to i. Dispatch j to the machine for which increase in fractional flow-time is minimum.
Analyzing our algorithm Primal LPDual LP LP opt. value Algorithms value Construct a dual solution Show that the dual solution value and algorithms flow-time are close to each other.
Dual LP αjαj β it
p j 1 (t ) α j = p j 1 (t ) + … + p j r (t ) + p ij + p ij (s-r) Setting the Dual Values When a job j arrives, set α j to the increase in flow- time when j is dispatched greedily. j1j1 j2j2 jrjr j r+1 jsjs j arrives at time t : p ij 1 (t) p ij 2 (t) … p ij r (t) < p ij < p ij r+1 (t) Thus j α j is equal to the total flow- time.
β it = s Setting the Dual Values j1j1 j2j2 jrjr j r+1 jsjs p j 1 (t ) Set β it to be the number of jobs waiting at time t for machine i. Thus i,t β it is equal to the total flow- time.
Need to verify Dual Feasibility j1j1 j2j2 jljl j l+1 jsjs p j 1 (t ) Fix a machine i, a job j and time t. Suppose p ij l (t) < p ij < p ij l+1 (t)
Dual Feasibility j1j1 j2j2 jljl j l+1 jsjs p j 1 (t ) What happens when t = t ?
Dual Feasibility j1j1 j2j2 jljl j l+1 jsjs δ What happens when t = t + δ? Suppose at time t job j k is being processed Case 1: k l
Dual Feasibility j2j2 jrjr j r+1 jsjs Case 2: k > l ¢
Dual Feasibility So, α j, β it are dual feasible But i,t β it and j α j both equal the total flow time and hence the dual objective value is Hence, for any machine i, time t and job j
Incorporating machine speed-up So the values α j, β it /(1+ ε) are dual feasible for an instance with processing times larger by a factor (1+ ε) For any machine i, time t and job j Equivalently, schedule given instance on machines of speed (1+ ε) to determine α j, β it. The values α j, β it /(1+ ε) are dual feasible.
Dual Objective Value The dual value is less than the optimum fractional flow time. Since i,t β it = j α j the value of the dual is Hence, the flow time of our solution, j α j, is at most (1+1/ ε) times the optimum fractional flow time.
Extensions Can extend this analysis to the L p -norm of the flow time to get a similar result. Analysis also extends to the case of minimizing sum of flow time and energy on unrelated machines.
Open Problems Single Machine : Constant factor approximation algorithm for weighted flow-time. loglog n approx [Bansal Pruhs 10] 2+ε quasi polynomial time algorithm [Chekuri Khanna Zhu 01]
Open Problems Parallel machines : Constant factor approximation algorithm if we allow migration of a job from one machine to another. The (log 1-ε P) hardness is for non- migratory schedules
Open Problems Unrelated Machines : poly-log approximation algorithm (LP integrality gap ?) O(k) approximation [Sitters 08] is known, where k is the number of different processing times.