Professional Documents
Culture Documents
Lecture 10 - LP (Revisited)
In this talk, we will learn how to solve an LP problem using Excel Spreadsheet through an example.
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.
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
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
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!!!
Required
1800 2000 20 30 25
Wait a minute... this solution is not feasible! We need to start with a feasible solution.
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
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.
11/26/2007
W. Huang
Other constraints: each plant, when opened, can produce 20,000 tons of product (mixed) per year.
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 k2
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
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