ECE 307 – Techniques for Engineering Decisions Introduction to Linear Programming George Gross Department of Electrical and Computer Engineering University of Illinois at Urbana-Champaign ECE 307 © 2005 - 2009 George Gross, University of Illinois at Urbana-Champaign, All Rights Reserved OUTLINE The nature of a programming or optimization problem The salient characteristics of a linear programming (LP) problem The LP problem formulation The LP problem solution Extensive illustrations with numerical examples ECE 307 © 2005 - 2009 George Gross, University of Illinois at Urbana-Champaign, All Rights Reserved EXAMPLE 1: HIGH/LOW HEEL SHOE CHOICE PROBLEM You are headed to a party and are trying to find a pair of shoes to wear; you choice is narrowed down to two candidates: a high heel pair; and a low heel pair The high heel shoes look more beautiful but are not as comfortable as the competing pair Which pair should you choose? ECE 307 © 2005 - 2009 George Gross, University of Illinois at Urbana-Champaign, All Rights Reserved MODEL FORMULATION You first quantify your assessment along the two dimensions of looks and comfort and construct assessment high heels low heels weight (%) 5.0 4.2 3.6 70 5.0 3.5 4.8 30 aspect maximum value esthetics comfort Next you represent your decision in terms of two decision variables: ECE 307 © 2005 - 2009 George Gross, University of Illinois at Urbana-Champaign, All Rights Reserved MODEL FORMULATION xH ⎧⎪1 choose high = ⎨ ⎪⎩0 otherwise ⎧⎪1 choose low xL = ⎨ ⎪⎩0 otherwise Formulate your objectives to maximize the weighted assessment as max {70% * esthetics + 30% * comfort} Use the defined variables to state the objective max Z = x H [ (4.2)(0.7) + (3.5)(0.3) ] + x L [ (3.6)(0.7) + (4.8)(0.3)] ECE 307 © 2005 - 2009 George Gross, University of Illinois at Urbana-Champaign, All Rights Reserved MODEL FORMULATION Next consider the problem constraints: only one pair of shoes can be selected the decision variables are nonnegative State the constraints in terms of x H and x L : xH + xL = xH ≥ , xL ≥ ECE 307 © 2005 - 2009 George Gross, University of Illinois at Urbana-Champaign, All Rights Reserved PROBLEM STATEMENT SUMMARY Decision variables: xH ⎧⎪1 choose high = ⎨ ⎪⎩0 otherwise xL ⎧⎪1 choose low = ⎨ ⎪⎩0 otherwise Objective function: max Z = 3.99 x H + 3.96 x L Constraints: xH + xL = xH ≥ 0, xL ≥ ECE 307 © 2005 - 2009 George Gross, University of Illinois at Urbana-Champaign, All Rights Reserved OPTIMAL SOLUTION We determine the values x H* and x *L which result on the value of Z * such that ( Z * = Z ( x H* , x L* ) ≥ Z x H , x L for all feasible (x H ,xL ) ) We call such a solution an optimal solution A feasible solution is one that satisfies all the constraints The optimal solution, denoted by * , is selected from all the feasible solutions to the problem ECE 307 © 2005 - 2009 George Gross, University of Illinois at Urbana-Champaign, All Rights Reserved SOLUTION APPROACH: EXHAUSTIVE SEARCH We enumerate all the possible solutions: in this problem there are only two choices: ⎧⎪ x H = ⎧ xH = A: ⎨ B: ⎨ ⎪⎩ x L = ⎩xL = We evaluate Z for A and B and compare Z A = 3.99 Z B = 3.96 so that Z A > Z B and so A is the optimal choice The optimal solution is x *H = , x *L = and Z * = 3.99 ECE 307 © 2005 - 2009 George Gross, University of Illinois at Urbana-Champaign, All Rights Reserved CHARACTERISTICS OF A PROGRAMMING/OPTIMIZATION PROBLEM Objective is to make a decision among various alternatives and therefore requires the definition of the decision variables The solution of the “best” decision is made according to some objective and requires the formulation of the objective function The decision must satisfy certain specified constraints and so requires the mathematical statement of the problem constraints ECE 307 © 2005 - 2009 George Gross, University of Illinois at Urbana-Champaign, All Rights Reserved 10 EXAMPLE : PROBLEM STATEMENT 16 decision variables: x Hi , x Li , w Ai , w Bi , s Ai , s Bi , r Ai , r Bi , i = 1, Objective function: max Z = 20( x 1H + x H2 ) + 14( x 1L + x L2 ) Constraints: 20 constraints for the periods and nonnegativity constraints on all variables ECE 307 © 2005 - 2009 George Gross, University of Illinois at Urbana-Champaign, All Rights Reserved 62 EXAMPLE : DISHWASHER AND WASHING MACHINE PROBLEM The Appliance Co manufactures dishwashers and washing machines The sales targets for next four quarters are: product variable dishwasher washing machine quarter t Dt 2,000 1,300 3,000 1,000 Wt 1,200 1,500 1,000 1,400 ECE 307 © 2005 - 2009 George Gross, University of Illinois at Urbana-Champaign, All Rights Reserved 63 EXAMPLE : QUARTERLY COST COMPONENTS cost component quarter t unit costs ($) parameter manufacturing ($/unit) storage ($/unit) dishwasher ct 125 130 125 126 washing machine vt 90 100 95 95 dishwasher jt 5.0 4.5 4.5 4.0 washing machine kt 4.3 3.8 3.8 3.3 pt 6.0 6.0 6.8 6.8 hourly labor ($ /hour) ECE 307 © 2005 - 2009 George Gross, University of Illinois at Urbana-Champaign, All Rights Reserved 64 EXAMPLE : CONSTRAINTS Each dishwasher uses 1.5 and each washing machine uses of labor The labor hours in each quarter cannot grow or decrease by more than 10%; there were 5,000 h of labor in the quarter preceding the first quarter At the start of the first quarter, there are 750 dishwashers and 50 washing machines in storage ECE 307 © 2005 - 2009 George Gross, University of Illinois at Urbana-Champaign, All Rights Reserved 65 EXAMPLE : PROBLEM AIM How to schedule the production in each of the four quarters so as to minimize the costs while meeting the sales targets? ECE 307 © 2005 - 2009 George Gross, University of Illinois at Urbana-Champaign, All Rights Reserved 66 EXAMPLE : QUARTER t DECISION VARIABLES symbol variable dt number of dishwashers produced wt number of washing machines produced rt final inventory of dishwashers st final inventory of washing machines ht available labor hours during Qt t = 1, 2, 3, ECE 307 © 2005 - 2009 George Gross, University of Illinois at Urbana-Champaign, All Rights Reserved 67 EXAMPLE : OBJECTIVE FUNCTION minimize the total costs for the four quarters manufacturing costs storage costs labor costs Z = c1d1 + v1 w1 + j1 r1 + k1 s1 + p1 h1 quarter + c2 d + v2 w2 + j2 r2 + k2 s2 + p2 h2 quarter + c3 d + v3 w3 + j3 r3 + k3 s3 + p3 h3 quarter + c4 d + v4 w4 + j4 r4 + k4 s4 + p4 h4 quarter ECE 307 © 2005 - 2009 George Gross, University of Illinois at Urbana-Champaign, All Rights Reserved 68 EXAMPLE : CONSTRAINTS Quarterly flow balance relations: d , w1 r0 , s t=1 d , w2 r1 , s D ,W t=2 d , w3 r2 , s D ,W t=3 r3 , s D ,W ⎧⎪ rt −1 + d t − rt = D t ⎨ ⎪⎩ s t −1 + w t − s t = W t d , w4 t=4 r4 , s D ,W t = 1, 2, 3, ECE 307 © 2005 - 2009 George Gross, University of Illinois at Urbana-Champaign, All Rights Reserved 69 EXAMPLE : CONSTRAINTS Quarterly labor constraints ⎧1.5 d t + w t − h t ≤ ⎪ ⎨ ⎪ 0.9 h ≤ h ≤ 1.1h ⎩ t −1 t t −1 t = 1, 2, 3, h = 5, 000 ECE 307 © 2005 - 2009 George Gross, University of Illinois at Urbana-Champaign, All Rights Reserved 70 EXAMPLE : PROBLEM STATEMENT d1 w1 r1 h1 d2 w2 r2 s2 h2 d3 w3 r3 s3 h3 d4 w4 r4 s4 h4 -1 1.5 s1 = 1250 -1 = 1150 ≤0 -1 ≥ 4500 ≤ 5500 1 1 -1 1.5 = 1300 -1 = 1500 ≤0 -1 -0.9 -1.1 1 ≥0 ≤0 1 -1 1.5 = 3000 -1 = 1000 ≤ -1 -0.9 -1.1 1 ≥0 ≤0 1 -1 1.5 = 1000 -1 -0.9 -1.1 125 90 5.0 4.3 6.0 130 100 4.5 3.8 6.0 125 95 4.5 3.8 6.8 126 95 4.0 3.3 = 1400 -1 ≤0 1 ≥0 6.8 ≤0 minimize ECE 307 © 2005 - 2009 George Gross, University of Illinois at Urbana-Champaign, All Rights Reserved 71 LINEAR PROGRAMMING PROBLEM max (min) Z = c x + + c n x n s.t a 11 x + a 12 x + + a 1n x n = b1 a 21 x + a 22 x + + a 2n x n = b2 # # a m1 x + a m2 x + + a mn x n = b m x ≥ 0, x ≥ 0, , x n ≥ b ≥ 0, b ≥ 0, , b m ≥ ECE 307 © 2005 - 2009 George Gross, University of Illinois at Urbana-Champaign, All Rights Reserved 72 STANDARD FORM OF LP (SFLP) max (min) Z = c T x Ax= b x ≥ coefficient matrix m× n A ∈ \ decision vector n x ∈ \ b ∈ \m c ∈ \ requirement vector n profits (costs) vector ECE 307 © 2005 - 2009 George Gross, University of Illinois at Urbana-Champaign, All Rights Reserved 73 CONVERSION OF LP INTO SFLP An inequality may be converted into an equality by defining an additional nonnegative slack variable xslack ≥ replace the given inequality ≤ b by inequality + x slack = b replace the given inequality ≥ b by inequality – x slack = b ECE 307 © 2005 - 2009 George Gross, University of Illinois at Urbana-Champaign, All Rights Reserved 74 CONVERSION OF LP INTO SFLP An unsigned variable x u is one whose sign is unspecified x u is converted into two signed variables x+ and xwith x+ ⎧⎪ x u = ⎨ ⎪⎩0 xu ≥ xu < x− ⎧ = ⎨ ⎩- x u xu ≥ xu < and with xu replaced by x u = x + − x− ECE 307 © 2005 - 2009 George Gross, University of Illinois at Urbana-Champaign, All Rights Reserved 75 SFLP CHARACTERISTICS x is feasible if and only if x ≥ and A x = b S = { x | A x = b , x ≥ 0} is the feasible region If S = ∅ ⇒ LP is infeasible x* is optimal ⇒ cT x * ≥ cTx , ∀ x ∈ S x* may be unique, or may have multiple values x * may be unbounded ECE 307 © 2005 - 2009 George Gross, University of Illinois at Urbana-Champaign, All Rights Reserved 76 ... constraints ECE 307 © 2 005 - 2009 George Gross, University of Illinois at Urbana-Champaign, All Rights Reserved 25 EXAMPLE 3: ONE-POTATO, TWOPOTATO PROBLEM Mr Spud manages the Potatoes-R-Us Co which processes... 307 © 2 005 - 2009 George Gross, University of Illinois at Urbana-Champaign, All Rights Reserved 16 PROBLEM STATEMENT max Z = x1 + 5x s t x1 ≤ x2 ≤ x1 + x2 ≤ x ≥ 0, x ≥ ECE 307 © 2 005 - 2009 George... x1 ECE 307 © 2 005 - 2009 George Gross, University of Illinois at Urbana-Champaign, All Rights Reserved 29 THE FEASIBLE REGION x2 12 10 feasible region x1 10 12 ECE 307 © 2 005 - 2009 George Gross,