Today Scheduling: lassification Ref: Scheduling lgorithm Peter rukerook Multiprocessor Scheduling : List PTS Ref job scheduling, by uwe schweigelshohn Tomorrow istributed Scheduling ilk Programming and Work Stealing Scheduling in NO and NO ind time slots in which activities (or jobs) should be processed under given constraints. onstraints Resource constraints Precedence constraints between activities. quite general scheduling problem is Resource onstrained Project Scheduling Problem (RPSP) We have ctivities j =,..., n with processing times p j. Resources k =,..., r. constant amount of R k units of resource k is available at any time. uring processing, activity j occupies r jk units of resource k for k =,..., r. Precedence constrains i jbetween some activities i, j with the meaning that activity j cannot start before iis finished.. Objective : etermine starting times S j for all activities j in such a way that at each time t the total demand for resource k is not greater than the availability R k for k =,..., r, the given precedence constraints are fulfilled, i. e. S i + p i S j if i j, Some objective function f(,..., n ) is minimized where j = S j + p j is the completion time of activity j. The fact that activities j start at time S j and finishattimes time j +p j impliesthattheactivitiesj the activities are not preempted. We may relax this condition by allowing preemption(activity splitting).
onsider a project with n = activities, r = resources with capacities R = 5 and R = 7, a precedence relation and the following data: i p i 58 r i r i 5 R=5 R=7 corresponding schedule with minimal makespan Production scheduling Robotic cell scheduling omputer processor scheduling tabling Personnel scheduling Railway sc ir traffic control, tc. Most machine scheduling problems are special cases of the RPSP. Single machine problems, Online Problem: S, S, SR, RR Parallel machine problems, and Shop scheduling problems. We have n jobs j =,..., n to be processed on a single machine. dditionally precedence constraints between the jobs may be given. Thisproblemcanbemodeled be modeled byanrpsp with r =, R =, and r j = for all jobs j. We have jobs j as before and m identical machinesm,..., M m. The processing time for j is the same on each machine. One has to assign the jobs to the machines and to schedule them on the assigned machines. This problem corresponds to an RPSP with r =, R = m, and r j = for all jobs j. 8 5 6 7
or unrelated machines the processing timep jk depends on the machine M k on which j is processed. Themachinesarecalleduniformif are called p jk = p j /r k. n a problem with multi purpose machines a set of machines μ j is isassociated with each job j indicating that j can be processed on one machine in μ j only. n a general shop scheduling problemwe have m machines M,..., M m and n jobs j =,..., n. ob j consists of n(j) operations O j,o j,..., O n(j)j where O ij must be processed for p ij time units on a dedicated machine μ ij {M,..., M m }. Two operations of the same job cannot be processed at the same time. Precedence constraints are given between the operations. job shop problem is a general shop scheduling problem with chain precedence constraints of the form O j O j... O n(j)j. j j n(j)j flow shop problemis a special job shop problem with n(j) = m operations for j =,..., n and μ ij = M i for i =,..., m and j =,..., n. n a permutation flow shop problemthe jobs have to be processed in the same order on all machines. n open shop problemis like a flow shop problem but without precedence constraints between the operations. lasses of scheduling problems can be specified in terms of the three field classification α β γ where α specifiesthemachineenvironment environment, β specifiesthe job characteristics, and γdescribes the objective function(s).
Symbol Meaning Single Machine P Parallel dentical Machine Q R MPM UniformMachine UnrelatedMachine Multipurpose Machine ob Shop low Shop f the number of machines is fixed to m we write Pm, Qm, Rm, MPMm, m, m, Om. Symbol meaning pmtn preemption r j d j release times deadlines p j =or p j =por restrictedprocessingtimes times p j {,} prec arbitrary precedence constraints intree(outtree) intree(or outtree) precedences chains chain precedences series parallel a series parallel precedence graph Two types of objective functions are most common: bottleneck objective functions max {f j ( j ) j=,..., n}, and sum objective functions Σ f j ( j ) = f ( ) + f ( ) +...... + f n ( n ). j is completion time of task j max and L max symbolizethe bottleneck objective max objective functions with f j ( j ) = j (makespan) L max objective functions f j( j) = j d j(maximum Lateness) ommon sum objective functions are: Σ j (mean flow time) Σ ω j j (weighted flow time) Σ U j (number of late jobs) and Σ ω j U j (weighted number of late jobs) where U j = if j > d j and U j = otherwise. Σ T j (sum of tardiness) and Σ ω j T j (weighted sum of tardiness/lateness) where the tardiness of job j is given by T j = max {, j d j. prec; p j = Σ ω j j P max P p j = ; r j Σ ω j U j R chains; pmtn max n = max p ij = ; outtree; r j Σ j Om p j = Σ T j
problem is called polynomially solvable if it can be solved by a polynomial algorithm. xample Σ ω j j can be solved by scheduling the jobs in an ordering of non increasing ω j /p j values. omplexity: O(n log n) efore certain jobs are allowed to start processing, one ormorejobsfirsthavetobecompleted. efinition Successor Predecessor mmediate successor mmediate predecessor Transitive Reduction 7 9 8 6 5 p ( ) = i One or more job have to be completed before another job is allowed to start processing. One or more job have to be completed before another job is allowed to start processing. Prec : rbitrary acyclic graph efinition Successor Predecessor mmediate successor mmediate predecessor Transitive Reduction 7 9 8 6 5 p ( ) = i efinition Successor Predecessor mmediate successor mmediate predecessor Transitive Reduction 7 9 8 6 5 p ( ) = i n tree (Out tree) n forest (Out forest) n tree Opposing forest Out tree Opposing forest nterval orders Series parallel orders n forest Out forest Level orders 5
Processor nvironment m identical processors are in the system. ob characteristics Precedence constraints are given by a precedence graph; Preemption is not allowed; The release time of all the jobs is. Objective function max : the time the last job finishes execution. f c j denotes the finishing time of j in a schedule S, max = max j n c j P P P antt chart indicates the time each job spends in execution, as well as the processor on which it executes of some Schedule Slot Slot 5 9 5 8 7 6 axis 7 9 8 5 6 5 p ( ) = i ue to the number of processors Number of processors is a variable (m) Pm prec, p j = max Number of processors is a constant (k) Pk prec, p j = max Theorem Pm prec, p j = max is NP complete..ullman(976) ST Pm prec, p j= max. Lenstraand RinooyKan (978) k clique Pm prec, p j = max orollary. The problem of determining the existence of a schedule with max for the problem Pm prec, pj= max is NP complete. Proof: out of Syllabus Mayr(985) Theorem Pm p j =, SP max is NP complete. SP: Series parallel Theorem Pm p j =, O max is NP complete. O: Opposing forest PTS : Polynomial pproximation Scheme pproximation List scheduling policies raham s list algorithm L algorithm MS algorithm Proof: out of Syllabus 6
Set up a priority list L of jobs. When a processor is idle, assign the first ready job to the processor and remove it from the list L. 9 8 6 raham first analyzed the performance of the simplest list scheduling algorithm. List scheduling algorithm with an arbitrary job list iscalledraham slistalgorithm. rahams list algorithm. 9 7 7 8 6 5 L= ( 9, 8, 7, 6, 5,,,,,,,, ) 5 pproximation ratio for Pk prec, p j = max δ= /k. (Tight bound!) pproximation ratio is δif for each input instance, the makespan produced by the algorithm is at most δtimes of the optimal makespan. T.. u(96), ritical Path lgorithm or u s algorithm lgorithm ssign a level h to each job. f job has no successors, h(j) equals. Otherwise, h(j) equals one plus the maximum level of its immediate successors. Set up a priority list L by nonincreasingorder of the jobs levels. xecute the list scheduling policy on this level based priority list L. 9 8 7 6 5 9 Level Level Level 8 7 L= (,,,, 9, 8, 7, 6, 5,,,, ) 6 5 complexity O( V + ) ( V is the number of jobs and is the number of edges in the precedence graph) Theorem (u, 96) The L algorithm is optimal for Pk p j =, in tree (out tree) max. orollary The L algorithm is optimal for Pk p j =, in forest (out forest) max. N.. hen &.L. Liu (975) The approximation ratio of L algorithm for the problem with general precedence constraints: f k =, δ L /. f k, δ L /(k-). Tight! 7
lgorithm: Set up a priority list L by nonincreasing order of the jobs successors numbers. (i.e. the job having more successors should have a higher priority in L than the job having fewer successors) xecute the list scheduling policy based on this priority list L. 6 9 7 8 7 6 5 8 5 9 7 6 L= (, 8,,,, 9, 7, 6, 5,,,, ) 7 6 complexity O( V + ) Theorem (Papadimitriou and Yannakakis, 979) The MS algorithm is optimal for Pk p j =, interval max. Theorem (Moukrim, 999) The MS algorithm is optimal for Pk p j =, quasiinterval max. Prove out of Syllabus iven processing times for n jobs, p, p,, p n, and an integer m ind an assignment of the jobs to m identical machines So that the completion time, also called the makespan, is minimized. for each job j whether job j is scheduled in machine i ach job is scheduled in one machine. lgorithm. Order the jobs arbitrarily.. Schedule jobs on machines in this order, schedulingthenextjobonthemachinethathas next on that has been assigned the least amount of work so far. for each machine i for each job j, machine i ach machine can finish its jobs by time T bove algorithm achieves an approximation guarantee of for the minimum makespan problem. 8
Machine Machine Machine Machine Machine Machine Machine Machine Machine Machine Machine Machine Machine Machine Machine Machine Machine Machine 9
Machine Machine Machine Machine Machine Machine Machine Machine Machine Machine Machine Machine Machine Machine Machine Optimal Schedule Machine Machine Machine Machine Machine Machine List schedule
lgorithm: List scheduling asic idea: n a list of jobs, schedule the next one as soon as a machine is free a b c d e ood or bad? machine machine machine machine lgorithm: List scheduling asic idea: n a list of jobs, schedule the next one as soon as a machine is free a b c d e f machine machine machine machine S job ffinishes last, at time compare to time OPT of best schedule: how? a b c d e f machine machine machine machine S job ffinishes last, at time compare to time OPT of best schedule: how? () job f must be scheduled in the best schedule at some time: S <= OPT. () up to time S, all machines were busy all the time, and OPT cannot beat that, and job f was not yet included: S < OPT. () both together: = S + S < OPT. approximation (raham, 966) Proof: Let T= t i, i=,,n, the sum of all processing times to be accommodated. We know that the total processing time available in an optimal schedule on the machines is m.opt(). So, OPT() T/m. Moreover, OPT() t k for every k. Let () be the makespanof the schedule produced by LS. y definition there must be a job k, with processing time t k, that ends at the makespantime. No machine can end its operation before () t k, because then job kwould have been scheduled on that machine, thus reducing the makespan. So all machines are busy from time through ()-t k onsequently, M M i T t k m(() t k ) T t k m() mt k T t k +mt k m() T+(m )t k m() So, () T/m+t k (m )/m () t k k PrevSlide : s m.opt() T. So, OPT() T/m. lso OPT() t k for every k. OPT()+( /m)opt()=( /m)opt() () ( /m)opt() M m () m x m m x makespan: m m x makespan: m+
List scheduling can do badly if long jobs at the end of the list spoil an even division of processing times. We now assume that the jobs are all given ahead oftime,i.e.thelptruleworksonlyintheoff i.e. the only in the off line situation. onsider the Largest Processing first or LPT rule that works as follows. LPT() sort the jobs in order of decreasing processing times: t t... t n execute list scheduling on the sorted list return the schedule so obtained. The LPT rule achieves a performance ratio / /(m). Proveout of Syllabus