An Introduction to Linear Programming (LP) How to optimally allocate scarce resources! 1 Please hold your applause until the end.
What is a Linear Programming A linear program (LP) is an optimization problem consisting of a function to be maximized or minimized subject to one or more limitations (called constraints) on the variables of the function. Both the optimization function (called the objective function) and the constraints have only linear relationships. 2
George Dantzig Inventor of linear programming and the simplex algorithm Born: 8 Nov 1914 Died: 13 May 2005 In 1947 Dantzig made the contribution to mathematics for which he is most famous, the simplex method of optimisation. It grew out of his work with the U.S. Air Force known as "programming", a military term that, at that time, referred to plans or schedules for training, logistical supply or deployment of men. Dantzig mechanised the planning process by introducing "programming in a linear structure" 3
The Road Ahead Example LP The Graphical Solution LP Defined Application and Examples Solving a LP The Computer Way The Algebraic Way The Simplex Way 4
Our Very First Example The Opti Mize Company manufactures two products that compete for the same (limited) resources. Relevant information is: Product A B Available resources Labor-hrs/unit 1 2 20 hrs/day Machine hrs/unit 2 2 30 hrs/day Cost/unit $6 $20 $180/day Profit/unit $5 $15 5
The Model Let X = number of units of product A to manufacture Y = number of units of product B to manufacture Max Profit = z = 5 X + 15 Y subject to: X + 2 Y <= 20 (labor-hours) 2 X + 2 Y <= 30 (machine hours) 6 X + 20Y <= 180 ($ - budget) X >= 0, Y >= 0 6
The Graphical Solution Y 20 15 10 5 X + 2 Y = 20 7 5 10 15 20 25 30 X
The Graphical Solution Y 20 15 10 9 5 6X + 20Y = 180 X + 2 Y = 20 8 5 10 15 20 25 30 X
The Graphical Solution Y 20 2X + 2Y = 30 15 10 9 5 6X + 20Y = 180 X + 2 Y = 20 9 5 10 15 20 25 30 X
The Graphical Solution Y 20 15 2X + 2Y = 30 The feasible region 10 9 5 6X + 20Y = 180 X + 2 Y = 20 10 5 10 15 20 25 30 X
The Graphical Solution (continued) Y 20 15 10 9 Z = 5X + 15Y = 30 11 2 6 5 10 15 20 25 30 X
The Graphical Solution (continued) Y 20 15 Z = 5X + 15Y = 60 10 9 Z = 5X + 15Y = 30 4 12 2 6 12 5 10 15 20 25 30 X
The Graphical Solution (continued) Y 20 Z = 5 (5) + 15 (7.5) = 137.5 15 (5, 7.5) Z = 5X + 15Y = 60 10 9 Z = 5X + 15Y = 30 4 13 2 6 12 5 10 15 20 25 30 X
The Graphical Solution Alternate Approach Y 20 Z = 5X + 15Y 15 (x = 5, y = 7.5; z = 137.5) 10 9 5 (x = 10, y = 5; z = 125) (x = 0, y = 0; z = 0) 14 5 10 15 20 25 30 (x = 0, y = 9; z = 135) (x = 15, y = 0; z = 75) X
This is powerful stuff! Can we see another example followed by a description of the general model? Sure can.. 15
The Classical Diet Problem A Minimization Problem 16
The Problem Mr. U. R. Fatte has been placed on a diet by his Doctor (Dr. Ima Quack) consisting of the foods shown below. The doctor warned him to insure proper consumption of nutrients to sustain life. Relevant information is: 17 Nutrients Beer Pizza Monthly Requirement Vitamin A 2 mg/oz 3 mg/oz 3500 mg (min rqmt) Protein 6 mg/oz 2 mg/oz 7000 mg (min rqmt) Fat 4g/oz 2g/oz 8000 grams (max rqmt) cost/oz $0.50 $0.20
The Mathematical Model Let X = ounces of beer consumed per week Y = ounces of pizza consumed per week Min cost = z = 0.5X + 0.2Y subject to: 2X + 3Y >= 3500 6X + 2Y >= 7000 4X + 2Y <= 8000 X, Y >= 0 18
The Boundary Equations Y 4000 3000 2000 6x + 2y = 7,000 4x + 2y = 8,000 2X + 3Y >= 3500 6X + 2Y >= 7000 4X + 2Y <= 8000 1000 2x + 3y = 3,500 1000 2000 3000 X 19
Feasible Region Y 4000 3000 2000 1000 1000 2000 3000 X 20
Feasible Region with Objective Function Y 4000 3000 z =.5X +.2Y z =.5X +.2Y = $800 (0,4000) and (1600,0) 2000 1000 1000 2000 3000 X 21
Optimal Solution Y 4000 3000 2000 1000 6x 2y 7, 000 2x 3y 3,500 6x 2y 7, 000 6x 9y 10,500 7y 3,500 or y* 500 7, 000 2y x* 1, 000 6 z*.5 x.2 y $600 1000 2000 3000 X 22
Optimal Solution alternate approach Y (x = 0, y = 4000, z = $800) 4000 (x = 0, y = 3500, z = $700) 3000 z =.5X +.2Y 2000 (x = 1000, y = 500, z = $600) 1000 (x = 1,750, y = 0, z = $875) (x =2000, y = 0, z = $1,000) 1000 2000 3000 X 23
Surgeon General s Warning The minimum cost diet found in solving this problem is illustrative only. One should not attempt to follow this diet for any prolonged period of time. 24
The General Diet Problem Minimize the "cost of the menu" subject to the nutrition requirements: eat enough but not too much of Vitamin A.. eat enough but not too much Vitamin C Eat at least a certain minimum number of servings of beef but not more than the maximum number of servings of beef you want... Eat at least a certain minimum number of servings of carrots but not more than the maximum number of servings of carrots you want 25 Special student exercise: solve the diet problem found on The supplement homework list of the course website!
The General LP Model Max or Min z = c 1 x 1 + c 2 x 2 +... + c n x n subject to: A 11 x 1 + A 12 x 2 +... + A 1n x n <= b 1 A 21 x 1 + A 22 x 2 +... + A 2n x n <= b 2.. A m1 x 1 + A m2 x 2 +... + A mn x n <= b m Objective Function Constraints x 1, x 2,... x n >= 0 26 x j = decision variables or activity levels c j = profit or cost coefficient A ij = technology coefficient b i = resource capacities (right hand side values)
27 Assumptions Deterministic all input data (parameters) are known and constant no statistical uncertainty Linear cost or profit is additive and proportional to the activity levels output or resources consumed are additive and proportional to the activity levels Non-integer variables (activity levels) are continuous
Solution Procedures Graphical two or three variables only Algebraic solve systems of equations for corner points Simplex algorithm numerical, iterative approach Ellipsoid theoretical importance more than applied 28
Can we see more examples of this LP thing? Please!!!!! Let s do it. 29
A Blending Problem The B. A. Nutt Company sells mixed nuts of two quality levels. The expensive mix should not contain more than 25% peanuts nor less than 40% cashews. The cheap mix should not have more than 60% peanuts and no less than 20% cashews. Cashews cost 50 cents a pound and peanuts cost 20 cents a pound. The expensive mix sells for 80 cents a pound and the cheap mix for 40 cents a pound. What should the blend of each mix be in order to maximize profit. The company has $100 a day with which to purchase nuts. 30
The Model Let x 1 = pounds of cashews in expensive mix x 2 = pounds of peanuts in expensive mix y 1 = pounds of cashews in cheap mix y 2 = pounds of peanuts in cheap mix Max z =.80 (x 1 + x 2 ) +.40 (y 1 + y 2 ) -.5(x 1 +y 1 ) -.2(x 2 + y 2 ) subject to:.5 (x 1 + y 1 ) +.2(x 2 + y 2 ) <= 100 x 2 / (x 1 +x 2 ) <=.25 y 2 /(y 1 + y 2 ) <=.6 31 x 1 / (x 1 +x 2 ) >=.40 y 1 /(y 1 + y 2 ) >=.20
Re-formulate the Model Max z = =.3x 1 +.6x 2 -.1y 1 +.2y 2 subject to:.5x 1 +.2x 2 +.5y 1 +.2 y 2 <= 100 -.25x 1 +.75x 2 <= 0 -.60y 1 +.40y 2 <= 0.60x 1 -.40x 2 >= 0.80y 1 -.20y 2 >= 0 32
A Marketing Example The I. B. Adman Advertising Company is planning a large media blitz covering television, radio, and magazines to sell management science to the public. The company s objective is to reach as many people as possible. Results of a market survey show: Television Day time Prime Time Radio Magazines cost per unit $40,000 75,000 30,000 15,000 # people 400,000 900,000 500,000 200,000 # business 300,000 400,000 200,000 100,000 33 The company has a budget of $800,000 to spend on the campaign. It requires at least two million exposures among the business community. Television must be limited to $500,000, and at least 3 units of day time and 2 units of prime time must be purchased. Advertising units on both radio and magazines should be between 5 and 10.
The Model Let x 1, x 2, x 3, and x 4 be the number of advertising units bought in daytime TV, primetime TV, radio and magazines. Max z = 400x 1 + 900x 2 + 500x 3 + 200x 4 (in thousands) subject to: 40,000x 1 + 75,000x 2 + 30,000x 3 + 15,000x 4 <= 800,000 300,000x 1 + 400,000x 2 + 200,000x 3 + 100,000x 4 >= 2,000,000 40,000x 1 + 75,000x 2 <= 500,000 34 x 1 >= 3; x 2 >= 2; 5 <= x 3 <= 10; 5 <= x 4 <= 10
The Transportation Problem A company manufactures a single product at each of m factories. Factory i has a capacity of S i per month. There are n warehouses receiving this product. The demand at warehouse j is D j. It cost factory i, c ij dollars to ship one unit to warehouse j. How many units should each factory send to each warehouse in order to minimize the total transportation costs? This is a really neat problem. 35
The LP Formulation Let x ij = the number of units sent from factory i to warehouse j 36 Min z m i 1 subject to: n j 1 m i 1 n j 1 c x x S i 1, 2,..., m x D j 1, 2,..., n x ij ij ij ij ij i 0 j
Job-Training The Never-Say-Die Life Insurance Company hires and trains a large number of salespersons each month to replace those who have departed. Trained salespersons must be used to train new salespersons. Training takes one month and there is a 20 percent attrition rate by the end of the month. While a salesperson is training a new employee, that person cannot be used in the field selling insurance. The monthly demand for experienced salespeople is: Month Demand (in the field) January 100 February 150 March 200 April 225 May 175 37 Trainees receive $400 per month while it costs the company $850 per month for an experienced salesperson. Ten percent of all experienced salespeople will leave the company by the end of each month.
The Model Let x i = the number of trainees during month i y i = the number of experienced salespeople in month i Min z = 1250 (x 1 + x 2 + x 3 + x 4 + x 5 ) subj to: y 1 - x 1 >= 100 y 2 - x 2 >= 150 y 3 - x 3 >= 200 y 4 - x 4 >= 225 y 5 - x 5 >= 175 y i =.9y i-1 +.8x i-1 for i = 1, 2, 3, 4, 5 38 example: y feb =.9 y jan +.8x jan
A Large Department Store Somewhere in the Midwest Problem Set 2.3F 6 Store operates 7 days a week Min number of salespersons required is 12 for Mon., 18 for Tues., 20 for Wed., 28 for Thurs., 32 for Fri., 40 for Sat. and Sun. Each salesperson works 5 days a week with 2 consecutive days off What is the minimum number of salespersons and how should their days off be allocated?
The Formulation Let x i = the number of salesperson that start their week on day i (i = M, T, W, Th, F, Sa, Su) Min z x x x x x x x M T W TH F Sa Su s. t. x x x x x 12 M TH F Sa Su x x x x x 18 M T F Sa Su x x x x x M T W Sa Su x x x x x M T W Th Su x x x x x M T W Th F x x x x x T W Th F Sa x x x x x W Th F Sa Su 20 28 32 40 40 Monday Tuesday Wednesday Thursday Friday Saturday Sunday
Urban Renewal ORsville has severe budget shortage City council votes to improve the tax base condemning inner-city housing replacing with new development Up to 300 substandard houses may be demolished each house occupies.25 acre lot and cost $2,000 to demolish Lot sizes for single, double, triple, and quadruple family unit are.18,.28,.4, and.5 acre respectively 15% of available acreage need for utilities, streets, green space, etc. Triple and quadruple units must be at least 25% of total, single at least 20%, and double at least 10% Tax levied per single, double, triple, and quadruple is $1,000, $1,900, $2,700, and $3,400 respectively Construction costs per single, double, triple, and quadruple is $50,000, $70,000, $130,000, and $160,000 respectively Max of $15 million available for construction 41
The Decision Variables x 1 = number of units of single-family homes x 2 = number of units of double-family homes x 3 = number of units of triple-family homes x 4 = number of units of quadruple-family homes x 5 = number of old homes to be demolished 42 A city council member tosses a coin to see if a particular house is to be demolished.
The Model 43 Max z 1000x 1900x 2700x 3400x subject to : 5 1 2 3 4.18 x.28 x.4 x.5 x.25.85 x x 1 2 3 4 5 300 x.2 x x x x 1 1 2 3 4 x.1 x x x x 2 1 2 3 4 x x.25 x x x x 3 4 1 2 3 4 50x 70x 130x 160x 2x 15, 000 1 2 3 4 5 x, x, x, x, x 0 1 2 3 4 5 tax collection available acreage max nbr to demolish minimum nbr of each home type budget in $1,000
The Model s Solution x 1 = 35.83 x 2 = 98.53 x 3 = 44.79 x 4 = 0 x 5 = 244.49 z = $343,965 I will not live in a house that is only.83 complete! 44
Is it okay if we work more of these on our own? Gee, this LP stuff can solve just about any problem.
Computer Solutions LINDO LINGO Excel Solver What s Best (Excel add-on) AMPL TORA Can you show us how the computer solves these LP problems? 46
Don t touch that drop card! Next More LP The Simplex Algorithm The fun never stops! 47