Operations Research Solving LPs Dr. Özgür Kabak
Solving LPs } The Graphical Solution } The Simplex Algorithm } Software } Lindo } Excel Solver } QM for Windows 2
LP Solutions: Four Cases } The LP has a unique optimal solution. } The LP has alternative (multiple) optimal solutions. } It has more than one (actually an infinite number of) optimal solutions. } The LP is infeasible. } It has no feasible solutions. The feasible region contains no points. } The LP is unbounded. } In the feasible region there are points with arbitrarily large (in a max problem) objective function values. 3
The Graphical Solution } Any LP with only two variables can be solved graphically. X2 4 3 2 1 X1-1 1 2 3 4-1 4
The Graphical Solution Giapetto Example } Giapetto Example } Since the Giapetto LP has two variables, it may be solved graphically. } The feasible region is the set of all points satisfying the constraints. max z = 3x 1 + 2x 2 s.t. 2x 1 + x 2 100 (Finishing constraint) x 1 + x 2 80 (Carpentry constraint) x 1 40 (Demand constraint) x 1, x 2 0 (Sign restrictions) 5
6 The set of points satisfying the LP is bounded by the five sided polygon DGFEH. Any point on or in the interior of this polygon (the shade area) is in the feasible region.
Isoprofit / Isocost } Having identified the feasible region for the LP, a search can begin for the optimal solution which will be the point in the feasible region with the largest z-value (maximization problem). } To find the optimal solution, graph a line on which the points have the same z-value. In a max problem, such a line is called an isoprofit line while in a min problem, this is called the isocost line } (The figure shows the isoprofit lines for z = 60, z = 100, and z = 180)
Binding } A constraint is binding (active, tight) if the left-hand and right-hand side of the constraint are equal when the optimal values of the decision variables are substituted into the constraint. } The finishing and carpentry constraints are binding. } A constraint is nonbinding (inactive) if the left-hand side and the righthand side of the constraint are unequal when the optimal values of the decision variables are substituted into the constraint. } The demand constraint for wooden soldiers is nonbinding since at the optimal solution x 1 < 40 (x 1 = 20).
Basic Variables } Nonbasic variable } a chosen set of variables where variables equal to 0 } Basic variable } the remaining variables that satisfy the system of equations at the standard form
Advertisement Example (Winston 3.2, p.61) } Since the Advertisement LP has two variables, it may be solved graphically. } The feasible region is the set of all points satisfying the constraints. min z =50x 1 + 100x 2 s.t. 7x 1 + 2x 2 28 (high income women) 2x 1 + 12x 2 24 x 1,x 2 0 (high income men) 10
11
Advertisement Example Solution } Since Dorian wants to minimize total advertising costs, the optimal solution to the problem is the point in the feasible region with the smallest z value. } An isocost line with the smallest z value passes through point E and is the optimal solution at x 1 = 3.6 and x 2 = 1.4 giving z = 320 } Both the high-income women and high-income men constraints are satisfied, both constraints are binding. } x 1 and x 2 are basic variables 12
Two Mines Example } min 180x + 160y } S.t. } 6x + y >= 12 } 3x + y >= 8 } 4x + 6y >= 24 } x <= 5 } y <= 5 } x,y >= 0 13
14
Modified Giapetto (1) } maks z = 4x 1 + 2x 2 } s.t. } 2x 1 + x 2 100 (Finishing constraint) } x 1 + x 2 80 (Carpentry constraint) } x 1 40 (Demand constraint) } x 1, x 2 0 (Sign restrictions) 15
Points on the line between points G (20, 60) and F (40, 20) are the alternative optimal solutions. (z=200) 16 Thus, for 0 c 1, c [20 60] + (1-c) [40 20] = [40-20c, 20+40c] will be optimal
Modified Giapetto (2) } max z = 3x1 + 2x2 } s.t. } 2x1 + x2 100 (Finishing constraint) } x1 + x2 80 (Carpentry constraint) } x1 40 (Soldier Demand constraint) } x2 90 (Train demand constraint) } x1, x2 0 (Sign restrictions) 17
No points satisfy all constraints Infeasible LP 18
Modified Giapetto (3) } max z = 3x1 + 2x2 } s.t. } 2x1 + x2 100 (Finishing constraint) } x1 + x2 80 (Carpentry constraint) } x1 40 (Soldier Demand constraint) } x2 90 (Train demand constraint) } x1, x2 0 (Sign restrictions) 19
90 x 2 Isoprofit line never lose contact with the feasible region: Unbounded LP! H 40 x 1 20
Wyndor Glass Example } The WYNDOR GLASS CO. produces high-quality glass products, including windows and glass doors. It has three plants. Aluminum frames and hardware are made in Plant 1, wood frames are made in Plant 2, and Plant 3 produces the glass and assembles the products. } Because of declining earnings, top management has decided to revamp the company s product line. Unprofitable products are being discontinued, releasing production capacity to launch two new products having large sales potential: } Product 1: An 8-foot glass door with aluminum framing } Product 2: A 4 6 foot double-hung wood-framed window } Product 1 requires some of the production capacity in Plants 1 and 3, but none in Plant 2. Product 2 needs only Plants 2 and 3. The marketing division has concluded that the company could sell as much of either product as could be produced by these plants. However, because both products would be competing for the same production capacity in Plant 3, it is not clear which mix of the two products would be most profitable. } Suppose that the new products had been required to return a net profit of at least $50,000 per week to justify discontinuing part of the current product line. TABLE 3.1 Data for the Wyndor Glass Co. problem Production Time per Batch, Hours Product Production Time Plant 1 2 Available per Week, Hours 1 1 0 4 2 0 2 12 3 3 2 18 Profit per batch $3,000 $5,000
Wyndor Glass Example - Solution x 2 10 8 3x 1 5x 2 50 Maximize Z 3x 1 5x 2, subject to x 1 4 2x 2 3x 1 2x 2 3x 1 5x 2 12 18 50 and x 1 0, x 2 0 6 2x 2 12 4 3x 1 2x 2 18 2 x 1 0 x 2 0 x 1 4 0 2 4 6 8 10 x 1
Operations Research Sensitivity Analysis Dr. Özgür Kabak
Reduced Cost } The reduced cost for any nonbasic variable: } the amount by which the nonbasic variable's objective function coefficient must be improved } before that variable will become a basic variable in some optimal solution to the LP. } If the objective function coefficient of a nonbasic variable x k is improved by its reduced cost, } then the LP will have alternative optimal solutions } at least one in which x k is a basic variable, } and at least one in which x k is not a basic variable.
Reduced Cost } If the objective function coefficient of a nonbasic variable x k is improved by more than its reduced cost, } then any optimal solution to the LP will have x k as a basic variable (x k >0). } Reduced cost of a basic variable is zero (see definition)!
Shadow Price } The shadow price for the ith constraint } the amount by which the optimal z value is "improved" (increased in a max problem and decreased in a min problem) } if the RHS of the ith constraint is increased by 1. } This definition applies only if the change in the RHS of the constraint leaves the current basis optimal! } A constraint will always have a nonpositive shadow price; } A constraint will always have a nonnegative shadow price.
Conceptualization max z = 6 x 1 + x 2 + 10 x 3 x 1 + x 3 100 x 2 1 All variables 0 This is a very easy LP model and can be solved manually without utilizing Simplex. } x 2 = 1 } x 1 = 0, x 3 = 100 } The optimal solution: z = 1001, [x 1, x 2, x 3 ] = [0, 1, 100]
Conceptualization max z = 6 x 1 + x 2 + 10 x 3 x 1 + x 3 100 x 2 1 All variables 0 Similarly, sensitivity analysis can be executed manually. } Reduced Cost } As x 2 and x 3 are in the basis, their reduced costs are 0. } Reduced cost of x 1 is equal to 4 (10-6). } Shadow Price } If the RHS of the first constraint is increased by 1, new optimal solution of x3 would be 101 instead of 100. } new z value would be 1011. } If we use the definition: 1011-1001 = 10 is the shadow price of the first constraint. } The shadow price of the second constraint is 1.
Utilizing Lindo Output MAX 6 X1 + X2 + 10 X3 SUBJECT TO 2) X1 + X3 <= 100 3) X2 <= 1 END LP OPTIMUM FOUND AT STEP 2 OBJECTIVE FUNCTION VALUE 1) 1001.000 NOTICE: The objective function which is regarded as Row 0 in Simplex is accepted as Row 1 in Lindo. Therefore the first constraint of the model is always second row in Lindo!!! VARIABLE VALUE REDUCED COST X1 0.000000 4.000000 X2 1.000000 0.000000 X3 100.000000 0.000000 ROW SLACK OR SURPLUS DUAL PRICES 2) 0.000000 10.000000 3) 0.000000 1.000000
Utilizing Lindo Output RANGES IN WHICH THE BASIS IS UNCHANGED: OBJ COEFFICIENT RANGES VARIABLE CURRENT ALLOWABLE ALLOWABLE COEF INCREASE DECREASE X1 6.000000 4.000000 INFINITY X2 1.000000 INFINITY 1.000000 X3 10.000000 INFINITY 4.000000 RIGHTHAND SIDE RANGES ROW CURRENT ALLOWABLE ALLOWABLE RHS INCREASE DECREASE 2 100.000000 INFINITY 100.000000 3 1.000000 INFINITY 1.000000
Utilizing Lindo Output } Lindo output reveals the reduced costs of x 1, x 2, and x 3 as 4, 0, and 0 respectively. } In the maximization problems, the reduced cost of a nonbasic variable can also be read from the allowable increase value of that variable at obj. coefficient ranges. Here, the corresponding value of x 1 is 4. } In the minimization problems, the reduced cost of a nonbasic variable can also be read from the allowable decrease value of that variable at obj. coefficient ranges.
Utilizing Lindo Output } The same Lindo output reveals the shadow prices of the constraints in the "dual price" section. } The shadow price of the first constraint (Row 2) equals 10. } The shadow price of the second constraint (Row 3) equals 1.
Some Important Equations } If the change in the RHS of the constraint leaves the current basis optimal (within the allowable RHS range), the following equations can be used to calculate new objective function value: } for maximization problems new obj. fn. value = old obj. fn. value + (new RHS old RHS) shadow price } for minimization problems new obj. fn. value = old obj. fn. value (new RHS old RHS) shadow price
Some Important Equations } For Lindo example, as the allowable increases in RHS ranges are infinity for each constraint, we can increase RHS of them as much as we want. But according to allowable decreases, RHS of the first constraint can be decreased by 100 and that of second constraint by 1. } Lets assume that new RHS value of the first constraint is 60. As the change is within allowable range, we can use the first equation (max. problem): z new = 1001 + ( 60-100 ) 10 = 601
Sensitivity Anlysis using Lindo Example!Dakota Furniture!x1, x2, x3 production amounts of desk, table, chair. Weekly profit: $z Max 60x1+ 30x2 + 20x3 st LUMBER) 8x1 + 6x2 + x3 <= 48 FINISH) 4x1 + 2x2 + 1.5x3 <= 20 CARPNT) 2x1 + 1.5x2 + 0.5x3 <= 8 DEMAND) x2 <= 5 END 37
LP OPTIMUM FOUND AT STEP 2 OBJECTIVE FUNCTION VALUE 1) 280.0000 VARIABLE VALUE REDUCED COST X1 2.000000 0.000000 X2 0.000000 5.000000 X3 8.000000 0.000000 ROW SLACK OR SURPLUS DUAL PRICES LUMBER) 24.000000 0.000000 FINISH) 0.000000 10.000000 CARPNT) 0.000000 10.000000 DEMAND) 5.000000 0.000000 NO. ITERATIONS= 2 RANGES IN WHICH THE BASIS IS UNCHANGED: 38 OBJ COEFFICIENT RANGES VARIABLE CURRENT ALLOWABLE ALLOWABLE COEF INCREASE DECREASE X1 60.000000 20.000000 4.000000 X2 30.000000 5.000000 INFINITY X3 20.000000 2.500000 5.000000 RIGHTHAND SIDE RANGES ROW CURRENT ALLOWABLE ALLOWABLE RHS INCREASE DECREASE LUMBER 48.000000 INFINITY 24.000000 FINISH 20.000000 4.000000 4.000000 CARPNT 8.000000 2.000000 1.333333 DEMAND 5.000000 INFINITY 5.000000
Examples } What will be maximum total profit (Z) if the unit profit of the desk (x1) increases to 70? } What will be maximum total profit (Z) if the unit profit of the table (x2) decreases to 25? } What will be maximum total profit (Z) if the unit profit of the chair (x3) decreases to 10? } What will be maximum total profit (Z) if available lumber is equal to 30? } What will be maximum total profit (Z) if available finishing hours is equal to 22? } What will be maximum total profit (Z) if available carpentary hours s equal to 6? 39
Tomorrow } Topics: } Software to solve LPs and other mathematical programs. } Lindo } Excel Solver } QM for windows } Download them from the link: } http://web.itu.edu.tr/~topcuil/ya/yonyaz.htm } Bring your laptops!