Project Scheduling 1. Project Planning (revisited) 2. Resource Constrained Project Scheduling 3. Parallel Machine Scheduling Operational Research & Management Operations Scheduling Topic 1 Project Planning (revisited) Operational Research & Management Operations Scheduling Project Planning: Jobs on Arcs node: j prec duration pj 3 B: - 2 C: A 4 D: A, B 3 E: A 2 F: E 5 G: E 6 H: C, F 2 J: D, G 4 Finish: A to J (end of 1 or more tasks) every task := arc (dummies for precedence) C H A dummy A: - fase in project F E G B J D Operational Research & Management Operations Scheduling 3 Critical Path Method (CPM) j prec 3 3 10 13 C4 2 A: - 5 A3 B: - D: A, B E: A F: E dummy C: A E2 0 0 1 B2 J: D, G 15 15 F5 4 7 G6 3 8 J4 3 6 D3 G: E H: C, F 5 5 H2 ES1 = ESj = LFn = LFi = 11 11 0 maxi { pi + ESi | i P(j)} ESn minj { LFj - pj | j Si } Operational Research & Management Operations Scheduling 4 Alternative Network: Jobs on Nodes j prec 0 A: - 3 A3 B: - ? C4 H2 5 C:0A E2 D: A, B 3 j=0 G: E 15 G6 j =n+1 5 E: A F: E F5 B2 0 D3 3 = max{0+2,0+3} J4 11 H: C, F J: D, G Advantages - no dummy-jobs needed to enforce precedence - length of node may represent duration or arc-length Operational Research & Management Operations Scheduling 5 Jobs on a time axis j prec A3 jobs A: - B2 B: - C4 C: A D3 D: A, B E2 E: A F5 F: E G6 G: E H: C, F H2 J: D, G J4 0 3 5 Operational Research & Management 11 15 t Operations Scheduling 6 Project Planning with crashing Heuristic cut set 1 4 5 8 0 6 minimal cut set n+1 Graph of all Critical Path(s) Operational Research & Management Operations Scheduling 7 Topic 2 Resource Constrained Project Scheduling Problem (RCPSP) Operational Research & Management Operations Scheduling Project Planning as Scheduling Activities within project are jobs Criterium: makespan onder volgorde- (en resource-restricties?) P | prec (, rjk, Rk ) | Cmax CPM-solution assumes: always enough resources RCSP notation/assumptions: Job j uses rj k units of resource k, during pj periods Renewable resources: At any time one has Rk of resource k available Determine all finish times Fj (=genoeg om hele schedule weer te geven) Operational Research & Management Operations Scheduling 9 With resource requirements rj on jobs j r j j pj Example: job A requires 9 workers for 3 days, etc. j prec 9A3 A: - 8B2 B: - 7C4 C: A 7D3 D: A, B 3E2 E: A 2F5 F: E G: E 3G6 With R=16 workers available Is Cmax=15 days still possible? 0 3 5 Operational Research & Management H: C, F 8H2 J: D, G 3J4 11 15 t Operations Scheduling 10 With resource requirements rj on jobs j r j j pj j P(j) 9A3 A: { } 8B2 B: { } 7C4 C: {A} 7D3 D: {A, B} 3E2 E: {A} 2F5 F: {E} G: {E} 3G6 8H2 0 3 5 Operational Research & Management J: {D, G} 3J4 Feasible, even with 12 workers 11 H: {C, F} 15 t Operations Scheduling 11 CPM on (resource-relaxed) RSCP Generates “earliest” start- ESj and “latest” LFj finish times The CPM-time is lower bound on RSCP-time: LFn+1 Cmax Critical path jobs must start at ESj to accomplish Cmax = LFn+1 Other jobs have “slack” – Their start time is NOT fixed by CPM – Shift non-critical j in [ESj , LFj] smoothing the use of resources: after resource loading, balancing resource requirements – If capacity Rk is still exceeded, then lengthen makespan (let Fj exceed LFj for some j ). Later, we discuss heuristic methods for RCPSP Operational Research & Management Operations Scheduling 12 Resource loading and leveling 19 loading: jobs start at ESj D leveling: shift jobs in time 13 10 C DD A E E 7 B Operational Research & Management C F Operations Scheduling 13 Conceptual Model Notation – Decision variable: Fj (finish time) for j J – P(j) = set of predecessors of job j – A(t) set of active jobs j in period t Model Min Fn+1 s.t. Fh Fj - pj j J, hP(j) Fj 0 jJ A(t) = { j | Fj – pj < t Fj } jA(t) rjk Rk Operational Research & Management t resources k , t Operations Scheduling 14 Making an ILP Model for RCPSP To achieve an ILP formulation: How can we linearize A(t)={ j | j active at t } and Fj? Change to discrete time-horizon [0,H], periods t = 1,2, ..H For j J: Fj {1, …, H} t X jt 1 ( Choosing H large enough) E.g. Fj t t X jt Fj = 4 en pj = 2 Xj4= 1 Use extra binary variables – Aj3= 1 Xjt = 1 if task j ends in period t; Ajt s t t p j 1 X jt 0 – Aj4= 1 1 2 3 4 Ajt = 1 if task j is active in period t; Operational Research & Management Operations Scheduling 15 Resulting ILP model for RCPSP Min s.t. Fn 1 (1) j J, hP(j) Fh Fj p j Precedence restrictions (2) (3) Fj t t X jt X t jt jJ 1 jJ Determine one last period (4) Ajt s t t p j 1 X jt j J, t = 1, …, H Determining active periods of tasks (5) Ajt rjk Rk j t = 1, …, H, k K Consumption of scarce resources Operational Research & Management Operations Scheduling 16 Remarks Aiding variables Fj en Ajt can be eliminated: see book Exact ILP methods useful only for benchmarking other methods on small problem sizes RCPSP is generalization of job shop problem Operational Research & Management Operations Scheduling 17 Heuristic methods for RCPSP Two Schedule Generation Schemes can construct a schedule – Serial Method (task oriëntated): fixes in each of n iterations one task at earliest feasible starting time – Parallel Method (time oriëntated): at next finish time of active task start one or more tasks Example 0/13 3/15 5/16 2A3 4B2 3C1 ESj / LSj rj j pj 8/16 00 00 0/10 4/12 6/16 3D4 4E2 2F4 Operational Research & Management Operations Scheduling 18 Parallel SGS (informal) At most n stages Each stage g <= n represents: 1. Schedule time tg (=next finish time of scheduled job) 2. A partial schedule, consisting of four disjoint sets of jobs: – Completed, scheduled jobs at time tg – Active jobs: scheduled jobs, not yet completed at time tg – Decidable jobs: unscheduled, schedulable jobs (that can be chosen to start at time tn) – remaining set: unscheduled jobs that cannot start at time tn Operational Research & Management Operations Scheduling 19 Parallel SGS (on example) tg finished R(tg) schedulable Dg 0 4 j select R(tg) Fj {A, D} 3D4 1 4 (3D) {} - (* not A,E ; both require > 1 *) 4 3D 4 {2A3, 4E2} 4E2 0 6 (4E) 6 4E 4 {2A3, 2F4} 2A3 2 9 (2A) {F} 2F4 0 10 (2F) 9 2A 2 { }({B}) - (* 2 short for B *) 10 2F 4 {B} 4B2 0 12 (4B) 12 4B 4 {C} 3C1 1 13 Operational Research & Management Operations Scheduling 20 Parallel SGS (formal) Notation (sets in bold) – – – – Cg = activities: scheduled and finished; Ag = activities: scheduled and still active; C0 = {0}; A0 = {}; Dg = activities: schedulable according to prec.- AND cap. restrictions Rk(t) = remaining capacity of resource k at time t Rk(0) = Rk Algorithm While some jobs Cg Ag do (* i.e., unscheduled jobs *) – g = g+1; – tg = minjA(g) {Fj} , jg=arg (* next finish time active task *) – Update Cg, Ag, Rk(tg), Dg (* for jg scheduled and finished *) – While Dg do (* also Rk(tg) sufficient *) Take jDg, set Fj = tg + pj en update Ag, Rk(tg), Dg Operational Research & Management Operations Scheduling 21 Serial SGS (informal) Each stage selects a job n stages set of jobs already selected and planned: scheduled jobs (S ) decision set (D ): jobs with all predecessors in S remaining set of jobs: these will first enter D and then S Procedure 1. Start with scheduled set S=empty; j=0 2. Add j to S; Update schedulable set D ( := {j | P(j) S} ); 3. Select job j from decision set D (with highest priority), and (using {t/R(t) : finish times t } ) set j’s start/finish time as early as possible; 4. If |S|<n then go to step 2 (otherwise be happy with an 'active schedule') Operational Research & Management Operations Scheduling 22 Serial SGS (on example) Sj =min {t Fg | t ESj and k, t’ [t, t+pj) Fg : Rk(t’) rj } step { t / R(t) | t in Fg } Dg 0. {0/4} {A, D} r j j pj Sj Fj updates t / R(t) 3D4 0 4 R(0)=1, R(4)=4 (e.g. as priority rule: D has lower slack 8=10-(0+2)) 1. {0/1,4/4} {A, E} 4E2 4 6 R(4)=2, R(6)=4 (idem, E has lower slack) 2. {0/1,4/2,6/4} {A, F} 2A3 6 9 R(6)=2, R(9)=4 6 10 R(6)=0, R(9)=2, R(10)=4 (idem) 4. {0/1,4/2,6/2,9/4} {B, F} 4F2 (idem) 5. {0/1,4/2,6/0,9/2,10/4} {B} 4B2 10 12 R(10)=0, R(12)=4 6. {.. 10/0, 12/4} 3C 1 12 13 R(12)=1 {C} Operational Research & Management Operations Scheduling 23 Serial SGS (formal) Notations (sets in bold) – Sg = activities already scheduled (in steps <=g-1) S0 = { 0 (dummy)}; – Dg = activities (precedence-)schedulable (i.e, predecessors in Sg) – Fg = { finishtimes of jobs j Sg } F0 = {0}; – Rk(t) = remaining capacity of resource k at time t F0 = 0; Repeat n times (i.e., “for g := 0 to n do”) – Determine : Fg, Rk(t) voor tFg (*Initially F0 = {0}, Rk(0)=full resource k *) – Determine Dg and take j Dg (* Dg set of decidable jobs *) // schedule job j : – Determine ESj = max { Fh | hP(j) } – Determine Fj = pj + min { t [ESj, LSj] Fg | Rk(t) is feasible for j } – Update Rk(t) Operational Research & Management (* respecting precedence *) Operations Scheduling 24 Comments on Serial SGS Constructs a feasible schedule When resources are ample: schedule is optimal Leads to schedule in class of ‘active schedules’, – I.e., no operation can be earlier without others finishing later – Class of ‘active schedules’ contains an optimal schedule One can specify selection in “Take j in Dg” by giving: – priority rule(s) – an a priori list // and this explais the name ‘list scheduling’ Operational Research & Management Operations Scheduling 25 Comments on Parallel Method Algorithm (informal) 1. Start with finish time of active job 0 (scheduled with finish time 0) 2. In step g: tg = earliest time (that unscheduled jobs may start.) and Dg = collection of jobs that may start at time tg Normally, when Dg empty: tg = first finish time of active job j 3. Select the job from D with the highest priority, let it start at time tg 4. If jobs are still unscheduled then goto step 2 else stop Operational Research & Management Operations Scheduling 26 Comments on Parallel SGS If ample resources then schedule is optimal Schedule will be a non-delay schedule: – Exercise: why is that so? – Class of ‘Non-Delay schedules’ contains not always an optimal schedule For serial en parallel: – Single pass: 1 SGS combined with one Priority Rule – Multi pass 1 SGS with all PR’s Forward-backward scheduling Sampling method: “random”, “biased” or “regret based biased” Metaheuristics Operational Research & Management Operations Scheduling 27 Topic 3 Parallel Machine Scheduling Problems Operational Research & Management Operations Scheduling Parallel Machine Models Lets say we have – Multiple machines (m), where – the makespan should be minimized (Cmax) Pm || Cmax We denote this problem as Problem already NP-hard for m = 2 (partitioning problem) LPT-rule good heuristic Operational Research & Management Operations Scheduling 29 Worst case behaviour LPT Maximal deviation from optimal value Cmax ( LPT ) 4 1 Cmax (OPT ) 3 3m Example: four parallel machines, nine jobs jobs p(j) 1 7 Cmax(opt)=12 2 7 3 6 but Operational Research & Management 4 6 5 5 6 5 7 4 8 4 9 4 Cmax(LPT)=15 Operations Scheduling 30 More makespan problems 1| prec | Cmax easy Pm | prec | Cmax NP-hard P | prec | Cmax easy Pm | p j 1, M j | Cmax Least Flexible Job first is optimal if Mj is nested Operational Research & Management Operations Scheduling 31 Allowing preemptions Lets say we have – Multiple machines (m) – preemption is allowed at any point in time – and makespan is to be minimized (Cmax) Pm | prmp | Cmax We denote this problem as LP model gives Cmax but not a schedule – only total time spent on machine Operational Research & Management Operations Scheduling 32 Heuristic solution Longest Remaining Processing Time First (LRPT-rule) – Academic solution – Not practical Pm | prmp | Cmax LRPT-rule optimal for Example: two parallel machines, three jobs with p = (8, 7, 6) Operational Research & Management in discrete time Operations Scheduling 33 One final model Lets say we have – Multiple machines (m), where – the total completion time should be minimized (Cj) Pm || C j We denote this problem as SPT-rule gives optimal schedule For the weighted case: WSPT does not give optimal schedule Operational Research & Management Operations Scheduling 34