Contents college 3 en 4 • Book: Appendix A.1, A.3, A.4, §3.4, §3.5, §4.1, §4.2, §4.4, §4.6 (not: §3.6 - §3.8, §4.2 - §4.3) • Extra literature on resource constrained project scheduling (will be handed out) 1 Planning and scheduling optimization techniques • • • • • • • • Dispatching Rules Composite Dispatching Rules Adaptive search Dynamic Programming (Integer) Linear Programming Cutting plane methods Branch and Bound Beam Search 2 Linear programming (LP) model • LP: min c1 x1 c 2 x 2 ... c n x n objective function subject to : a11 x1 a12 x 2 ... a1n x n b1 constraints a21 x1 a22 x 2 ... a2n x n b 2 am1 x1 am2 x 2 ... amn x n bm x j 0 ( j 1, , n) • Matrix form: min c T x Ax b x0 where: x, c: n-vector A: m,n-matrix b: m-vector variable restrictions 3 Linear programming example max x1 x 2 subject to : 2x1 x 2 4 3x1 4 x 2 12 x j 0 ( j 1,2) T or: 1 x1 max 1 x 2 subject to : 2 1 x1 x 3 4 2 x1 0 x 2 0 4 12 4 Linear programming example: graphical solution (2D) 2x1 x 2 4 x2 6 max x1 x 2 subject to : 2x1 x 2 4 5 4 x1 x 2 6 3 (objective) 3x1 4 x 2 12 2 x j 0 ( j 1,2) 1 solution space 3x1 4x 2 12 0 1 2 3 4 5 6 x1 5 Linear programming (cont.) • Solution techniques: – (dual) simplex method – interior point methods (e.g. Karmarkar algorithm) • Commercial solvers, for example: – CPLEX (ILOG) – XPRESS-MP (Dash optimization) – OSL (IBM) • Modeling software, for example: – AIMMS – AMPL 6 Integer programming (IP) models • Integer variable restriction – IP: integer variables only – MIP: part integer, part non-integer variables – BIP: binary (0-1) variables • General IP-formulation: min c T x Ax b x integer ( x Z ) • Complex solution space 7 Integer programming example: graphical solution (2D) x2 6 max x1 x 2 5 subject to : 4 x1 x 2 6 3 (objective) 2x1 x 2 4 3x1 4 x 2 12 x j Z ( j 1,2) 2 optimal solutions! 2 1 0 1 2 3 4 5 6 x1 8 Total unimodularity property for integer programming models Suppose that all coefficients are integer in the model: min c T x i.e. aij , bi , i, j Ax b x0 Example: transportation problem if A has the total unimodularity property (i.e. every square submatrix has determinant 0,1,-1) there is an optimal integer solution x* & the simplex method will find such a solution 9 Integer programming tricks PROBLEM: x = 0 or x k 0 , for x 0 use binary indicator variable y= 1 , for x k restrictions: x M y (M is an upperbound on x) x ky y 0,1 10 Integer programming tricks (2) PROBLEM: fixed costs: if xi>0 then costs C(xi) minimize C( x ) where : Ax b x0 for xi 0, 0 C( x i ) k i c i x i for x i 0. 0 , for xi 0 use indicator variable yi= 1 , for xi 0 xi M yi restrictions (i): C( x i ) k i y i c i x i y i 0,1 11 (Integer) programming tricks (3) • Hard vs. soft restrictions – hard restriction: must hold, otherwise unfeasibility for example: x1 x 2 5 – soft restriction: may be violated, with a penalty for example: minimize c T x Y 100 x1 x 2 5 Y x 0, Y 0 12 (Integer) programming tricks (4) • Absolute values: min y t goal j a x j j bt y t j ,t variation x j,t 0, y t free solution: t yt y y t min y t y t t yt y y t t a x j j ,t t bt y y t j x j,t 0, y t 0, y t 0 13 Integer programming tricks (5) • Conjunctive/disjunctive programming - conjunctive set of constraints: must all be satisfied - disjunctive set of constraints: at least one must be satisfied • example (Appendix A.4): min w j x j min w j x j x k x j pk x k x j pk M1 y or x j xk p j x j x k p j M2 (1 y ) j j y {0,1} 14 IP example nonpreemptive single machine, total weighted completion time (App. A.3) model definition: x jt 1, if job j completes at time t, and 0 otherwise objective function: minimize weighted completion time: t x jt completion time of job j if x jt 1 C max-1 t x t 0 jt completion time of job j n C max-1 min imize j1 w t 0 j t x jt (objective function) 15 IP example (cont.) Restriction: all jobs must be completed once: C max-1 x t 0 jt 1 Restriction: only one job per time t: if job j is in process during t, it must be completed somewhere during [t,t+pj] t p j x s t js 1 (if job j is in process during t) n t p j x js 1 (restricti on : exactly one job per time t) j1 s t 16 IP example (cont.) Complete IP-model: n C max-1 minimize j1 w t 0 j t x jt subject to : C max-1 x t 0 jt 1 (for j 1, , n) n t p j x j 1 s t js 1 (for t 0, , Cmax - 1) x jt 0,1 (for j 1, , n, t 0, , Cmax - 1) nCmax integer variables 17 IP example (cont.) Additional restriction: precedence constraints Model definition: SUCC(j) = successors of job j job j must be completed before all jobs in SUCC(j): C max 1 tx t 0 jt completion time of job j kt pk start time of job k C max 1 tx t 0 C max 1 tx t 0 jt C max 1 tx t 0 kt (for k SUCC(j), j 1, , n) 18 Integer programming solution techniques • Heuristic vs. explicit approach: – trade-off between solution quality and computation time – trade-off between implementation effort/costs and yield (i.e. profits gained from solution quality improvement) • Heuristic methods; for example: – – – – – local search (e.g. simulated annealing, tabu search, k-opt) (composite) dispatching rules (e.g. EDD, SPT, MS) adaptive search rounding fractional solutions 19 beam search Integer programming solution techniques (cont.) • Explicit methods; 3 categories: 1. dynamic programming 2. cutting plane (polyhedral) methods 3. branch and bound or: hybrid methods (combination of the above) • Commercial IP solvers usually use a combination of heuristics and 2, 3 20 Dynamic programming • Problem divided into stages x t (t 0, , T) • Each stage can have various states it • A recursive objective function is used to iterate through all states and all stages (forwards or backwards) F0 (i0 ) c 0 (constant) Ft (it ) min{c t (it , x t ) Ft 1 (it 1 (it , x t ))} xt 21 Cutting plane methods STEP 0: STEP 1: STEP 2: Create a relaxation of the problem by omitting restrictions (e.g. the integrality restrictions) Solve the current problem If solution is infeasible then generate a restriction that cuts of the solution, and add it to the problem STEP 1 Otherwise: DONE 22 Branch and bound • Enumeration in a search tree root node Level 0 Level 1 child nodes ... child nodes ... Level 2 • each node is a partial solution, i.e. a part of 23 the solution space Branch and bound example 1 Disjunctive programming (appendix A.4): disjunctive set of constraints: at least one must be satisfied xj = completion time of job j restriction: either x k x j pk or x j x k p j (j, k I) solve LP without disjunctive restrictions (= LP relaxation) if disjunct. restr. violated for j & k Level 0 Level 1 x k x j pk x j xk p j ... 24 Branch and bound (cont.) • Upper bound: e.g. a feasible solution • Lower bound: e.g. a solution to an “easier” problem • Node elimination (fathom/discard nodes): when lower bound >= upper bound 25 Branch and bound (cont.) • Branching strategy: how to partition solution space • Node selection strategy: – sequence of exploring nodes: • depth first (tries to obtain a solution fast) • breadth/best bound first (tries to find the best solution) – which nodes to explore (filter and beam width) • filter width: #nodes selected for thorough evaluation • beam width: #nodes that are branched on ( filter width) Beam search 26 Branch and bound example 2 • Single machine, maximum lateness, release and due dates Jobs p(j) r(j) d(j) 1 4 0 8 2 2 1 12 3 6 3 11 4 5 5 10 (1,?,?,?) Level 0 (?,?,?,?) (2,?,?,?) (3,?,?,?) (4,?,?,?) Level 1 lower bound: EDD + preemption 27 Branch and bound example 2 • Lower bound for: (1,?,?,?) r(2) r(3) 1 r(4) 3 Jobs p(j) r(j) d(j) 4 1 4 0 8 2 2 1 12 3 6 3 11 4 5 5 10 3 2 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 t d(4)<d(3) d(3)<d(2) Lower bound: Lmax = max(0,17-12,15-11,0)=5 28 Branch and bound example 2 (cont.) Level 0 (?,?,?,?) LB=5 infeasible: (1,?,?,?) (1,3,4,3,2) LB=6* =UB (1,2,?,?) (1,2,4,3) (1,2,4,3) LB=7* =UB (2,?,?,?) (3,?,?,?) LB=5*=UB (1,3,?,?) (1,3,4,2) DONE (4,?,?,?) Level 1 Jobs p(j) r(j) d(j) 1 4 0 8 2 2 1 12 3 6 3 11 (1,3,4,2) 29 4 5 5 10 Branch and bound example 3 LP solution: x1 0.8, x 2 2.4 x1 0 x1 1 x1 0, x1 1, x2 3 x2 2 obj: 3 x2 6 obj: 3 5 4 x1 x 2 6 3 (objective) 2 x2 2 x2 3 x1 1, x1 0, x2 2 x2 3 obj: 3 obj: 3 1 0 1 2 3 4 5 6 x1 30 Beam search example 1 single-machine, total weighted tardiness Upper bound: ATC rule (apparent tardiness cost): • schedule 1 job at a time • every time a machine comes available, determine ranking of jobs: I j (t) wj pj e WSPT rule max( d j p j t ,0 ) K p MS rule look-ahead parameter: K = 4.5 + R (R 0.5) K = 6 - 2R (R 0.5) R dmax dmin / Cmax = due date range factor 31 Beam search example 1 (cont.) single-machine, total weighted tardiness (?,?,?,?) Jobs p(j) d(j) w(j) w(j)/p(j) 1 10 4 14 1.4 2 10 2 12 1.2 3 13 1 1 0.1 4 4 12 12 3 (1,?,?,?) (2,?,?,?) (3,?,?,?) (4,?,?,?) Upper bound by ATC rule: max(d j p j t ,0) 0 ( j 1,2,3) I j (t) wj pj e max( d j p j t ,0 ) K p wj pj (j 1,2,3) 32 Beam search example 1 (cont.) single-machine, total weighted tardiness Jobs p(j) d(j) w(j) w(j)/p(j) 1 10 4 14 1.4 2 10 2 12 1.2 3 13 1 1 0.1 4 4 12 12 3 (?,?,?,?) (1,?,?,?) Upper bound Jobs C(j) 1 10 by ATC rule: 2 24 3 37 4 14 (2,?,?,?) d(j) T(j) w(j)*T(j) 4 6 84 2 22 264 1 36 36 12 2 24 Total = 408 (3,?,?,?) (4,?,?,?) 33 Beam search example 1 (cont.) single-machine, total weighted tardiness (?,?,?,?) (1,?,?,?) (2,?,?,?) (3,?,?,?) (4,?,?,?) UB=408 UB=436 UB=814 UB=440 explored further (beam width = 2) 4 nodes analyzed (filter width=4) discarded 34 Beam search example 1 (cont.) (?,?,?,?) UB=408 436 (1,?,?,?) UB=480 (1,2,?,?) (2,?,?,?) 706 (1,3,?,?) 440 814 (3,?,?,?) 408 (1,4,?,?) UB=408 (1,4,2,3) best solution (4,?,?,?) 436 (2,1,?,?) (2,3,?,?) 554 436 (1,4,3,2) (2,4,?,?) (2,4,1,3) 608 (2,4,3,1) 35