You are on page 1of 6

Math 5531

Lecture 10 - LP (Revisited)

In this talk, we will learn how to solve an LP problem using Excel Spreadsheet through an example.

Gaspars Diet Problem:


Gaspars diet requires that all the food he eat come from one of the four "basic food groups": chocolate cake, ice cream, coca cola, and cheesecake). The daily nutrition requirement for Gaspar is: 1800 calories, 20 oz of chocolate, 30 oz of sugar, and 25 oz of fat. The nutritional content per unit of each food is shown in Table 1. Calories Chocolate (oz) Sugar (oz) Fat (oz) 1 piece of chocolate cake 1 scoop of ice cream 1 can of coca cola 1 piece of cheesecake 400 200 150 500 Table 1 The market prices of these food are: Price 1 piece of chocolate cake $2.50 1 scoop of ice cream 1 can of coca cola 1 piece of cheesecake $0.70 $0.85 $3.00 3 2 0 0 2 2 4 4 2 4 1 5

Formulate (and solve) a LP problem to give Gaspar a daily shopping list under his tight students budget.

LP Formulation
We can set up the following LP problem by letting x 1 number of pieces of chocolate cake x 2 number of scoops of ice cream x 3 number of cans of coca cola x 4 number of pieces of cheesecake

min z 2. 5x 1 0. 7x 2 0. 85x 3 3x 4 s. t. : 400x 1 200x 2 150x 3 500x 4 1800, (calories to keep him alive) : 3x 1 2x 2 20, (oz of chocolate to keep him happy) : 2x 1 2x 2 4x 3 4x 4 30, (oz of sugar to keep him smart) : 2x 1 4x 2 x 3 5x 4 25, (oz of fat to keep him strong) : x 1 , x 2 , x 3 , x 4 0.

Setup the LP spreadsheet


Step 1. Input all the parameters of the problem.
Gaspar's Diet Problem

Chocolate Cake Cost Calories Chocolate Sugar Fat 2 400 3 2 2

Ice Cream 0.7 200 2 2 4

Coca Cola 0.85 150 0 4 1

Cheesecake 3 500 0 4 5

Total

Required

1800 20 30 25

Step 2. Enter the formulas for the "total" columns after fill the decision variables with feasible values, say 4, 4, 2, 2. ($18.50 is the corresponding cost)
Gaspar's Diet Problem

Cost Calories Chocolate Sugar Fat

Chocolate Cake 4.00 2 400 3 2 2

Ice Cream 4.00 0.7 200 2 2 4

Coca Cola 2.00 0.85 150 0 4 1

Cheesecake 2.00 3 500 0 4 5

Total 18.50 3700.00 20.00 32.00 36.00

Required

1800 20 30 25

Step 3. Open the "Solver Parameter" box under "tools" menu. Set the target cell: total cost. Choose "min"; Define "changing cells", which are the decision variables; Define "constraints", dont forget the "nonnegative constraints for the decision variables. Now you are ready to hit "Solve"...
Gaspar's Diet Problem

Cost Calories Chocolate Sugar Fat

Chocolate Cake 0.00 2 400 3 2 2

Ice Cream 10.00 0.7 200 2 2 4

Coca Cola 2.50 0.85 150 0 4 1

Cheesecake 0.00 3 500 0 4 5

Total 9.13 2375.00 20.00 30.00 42.50

Required

1800 20 30 25

The best diet plan for Gaspar is to have 10 scoops of ice cream and 2.5 cans of coca cola per day, nothing else. This will cost him $9.13 a day. Too much calorie and fat!!!

Explore the alternatives:


First we note that Gaspar is in the risk of gaining weight. We need to restrict his daily intake of calories with 2000. We need to add another constraint. And hit the "solve", we have
Gaspar's Diet Problem

Cost Calories Calories Chocolate Sugar Fat

Chocolate Cake 0.00 2 400 400 3 2 2

Ice Cream 7.00 0.7 200 200 2 2 4

Coca Cola 4.00 0.85 150 150 0 4 1

Cheesecake 0.00 3 500 500 0 4 5

Total 8.30 2000.00 2000.00 14.00 30.00 32.00

Required

1800 2000 20 30 25

Wait a minute... this solution is not feasible! We need to start with a feasible solution.

Case Study: BestChip


BestChip (BC) use Corn Wheat Potato to produces 1. regular chips 2. green onion chips 3. party mix
11/26/2007 W. Huang 1

The ingredient amount of each product is given.

BC is considering expanding market to the following candidate sites: Yuma, AZ Fresno, CA Tucson, AZ Pomona, CA Santa Fe. NM Flagstaff, AZ Las Vegas, NV St. George, UT
11/26/2007 W. Huang

We have collected the following data:


Property cost: Purchasing, Building, and Maintenance Raw material shipping cost to each location.

BC has six major customers:


1. Jones, Salt Lake City 2. YZCO, Albuquerque 3. Square Q, Phoenix 4. AJ Stores, San Diego 5. Sun Quest, Los Angeles 6. Harms Path, Tucson

Also we know:
Demand of each customer for each product. All demand must be met. Shipping cost depends on the distance and tonnage, which is $0.15 per ton-mile.
3

11/26/2007

W. Huang

Additional constraint:
For consolidation reason, the company does not want to locate plants in more than two states.

For simplicity reason, we ignore many other detailed information, including:


property and income tax difference between states; the method of financing the site purchasing;
4
11/26/2007 W. Huang 5

BC manager wants to know:


which of the candidate sites should be open for production? which customers should each opened site serve?

Objective if to minimize the total cost.


11/26/2007 W. Huang 6

11/26/2007

W. Huang

Other constraints: each plant, when opened, can produce 20,000 tons of product (mixed) per year.

LP (or ILP) formulation:


Number the plants, customers, products, ingredients, and states: i 1 2 3 4 5 6 7 8 Plant in Yuma, AZ Fresno, CA Tueson, AZ Pomona, CA Santa Fe, NM Flagstaff, AZ Las Vegas, NY St. George, UT s 1 2 3 4 5 j 1 2 3 4 5 6 Customer & Location Jones, Salt Lake City YZCO, Albuquerque Square Q, Phenix AJ Stores, San Diego Sun Quest, Los Angeles Harms Path, Tucson l 1 2 3 ingredients Corn Wheat Potato k 1 2 3 Product Regular chips Green onion chips Party mix

States AZ CA NM NV UT We define the following decision variables:

x ijk tons of product k sent from plant i to customer j; y i 1, if plant i is open for production, 0 otherwise; s 1, if states s is used, 0 otherwise. We also define the following intermediate variables: f i fixed cost associated with opening plant i. i fi 1 125, 000 2 130, 000 3 140, 000 4 160, 000 5 150, 000 6 170, 000 7 155, 000 8 115, 000 c ij cost to ship 1 ton of final products from plant i to customer j.
Distances Yuma Fresno Tucson Pomona Santa Fe Flagstaff Las Vegas St. George SL City 1 712 818 779 661 626 519 420 302 Albuq. 2 646 917 497 760 63 326 574 604 Phoenix S. Diego 3 4 186 172 592 350 116 412 345 114 526 877 144 495 288 338 434 455 LA 5 282 222 488 29 848 466 271 388 Tucson 6 242 708 460 558 260 404 550

1 2 3 4 5 6 7 8

Unit shipping cost from Plants i to Customers j ($0.15 times the mile distance) Cij i=1 i=2 i=3 i=4 i=5 i=6 i=7 i=8 j=1 $106.83 $122.66 $116.84 $99.12 $93.95 $77.82 $62.96 $45.35 j=2 $96.89 $137.51 $74.51 $113.97 $9.45 $48.92 $86.03 $90.65 j=3 $27.89 $88.85 $17.39 $51.69 $78.92 $21.63 $43.14 $65.09 j=4 $25.74 $52.46 $61.86 $17.15 $131.49 $74.19 $50.69 $68.19 j=5 $42.33 $33.26 $73.20 $4.41 $127.20 $69.93 $40.62 $58.13 j=6 $36.24 $106.19 $0.00 $69.03 $83.63 $38.96 $60.62 $82.43

d kj demand in tons of product k from customer j.

d kj k2

j1 j2 j3 j4 j5 j6 900 1100 800 1200 1400 1000

k 1 1300 1400 1200 1900 1900 1500 k 3 1700 1700 1800 2200 2300 1400 m il cost in dollars of sending 1 ton of raw material l to plant i. m il l1 l2 l3 i1 i2 i3 i4 i5 i6 i7 i8 10 5 16 12 8 11 9 10 15 11 7 14 8 14 10 10 12 11 13 12 9 14 15 8

r lk percentage of product k that is raw material l. r lk k1 k2 k3 l1 l2 l3 70 30 20 20 15 50 10 55 30

We now have the following mixed ILP model min z Location purchasing cost Shipping for Products Shipping for Raw Materials
8 8 6 3 8 3 3 6

f i y i c ij x ijk m il r lk x ijk ,
i1 8 i1 j1 k1 i1 l1 k1 j1

s. t :

x ijk d kj ,
i1 6 3 j1 k1

j 1, 2, . . . , 6, k 1, 2, 3 i 1, 2, . . . , 8,

(Demands need to be met) (Plant capacity constraints) (State AZ is counted) (State CA is counted) (State NM is counted) (State NV is counted) (State UT is counted) (No more than 2 states are used)

x ijk 20000y i ,

: y 1 y 3 y 6 10 1 , : y 2 y 4 10 1 , : y 5 10 3 , : y 7 10 5 , : y 8 10 5 , :

s 2.
s1

This model has 8 5 13 0-1 integer variables and 8 6 3 144 nonnegative continuous variables. 6

You might also like