Linear Programming with Excel Solver

advertisement
Types of Constraints
Some problems include = and > Constraints. The following table is a guide to the most common
wording used in these constraints.
Type of constraint
Symbol
Less than or equal to
<
Equals, is equal to
=
Greater than or equal to
>
Typical Wording
amount available
cannot exceed
cannot buy more than
cannot sell more than (demand constraint
equals
is exactly, must be exactly
must use all (that is available)
must make at least
must be at least
have a contract to sell
have booked orders
Linear Programming with Excel Solver
Here is the linear programming setup for the Beaver Creek Pottery Company
Key cells are identified below:
Profit per unit
Labor coefficients
Clay coefficients
Available resources
Usage of resources
Production:
Profit
C4:D4
C9:D9
C10:D10
E9:E10
F9:F10
C12:D12
G12
Key formulas:
Labor usage = C9*$C$12+D9*$D$12
or
Clay usage
= C10*$C$12+D10*$D$12 or
Total profit = C4*C12+D4*D12
or
=sumproduct(C9:D9,$C$12:$D$12)
=sumproduct(C10:D10,$C$12:$D$12)
=sumproduct(C4:D4,C12:D12)
1
The target cell (G12) computes the objective function (profit).
The changing cells or variables (C12:D12) will be changed by solver to maximize the objective
function.
Opening Solver in Office 2007
Note: If you know that Solver is loaded on the computer that you are using, start with step 7.
1. Click the Office button in the upper left corner of your screen.
2. Click Excel Options. This is located near the bottom right-hand corner of the Office button
menu.
3. On the menu on the left-hand side, click Add-ins.
4. Two lists of add-ins will appear. If Solver is in the Active Application Add-ins list, then it is
loaded and ready for use. Go to step 7.
5. If Solver is in the Inactive Application Add-ins list, go to the Manage dropdown menu at the
bottom of the screen. Highlight Excel Add-ins and click Go.
6. Click the Solver Add-in check box. Then click OK. Solver will be loaded.
7. On the Office ribbon, click the Data Tab.
8. Solver is located in the Analysis group, which is at the far right of the data tab. Click on
Solver.
Opening Solver in Office 2003 or Office 2000
1.
2.
3.
4.
5.
From your linear programming spreadsheet, click Tools and then Add-ins.
Be sure that the full Tools menu is displayed.
If Solver is on the Tools menu, go to the next section.
If Solver is not on the Tools menu, click Add-ins.
A list of available Add-ins will appear. Solver will be on the list. Click the box in front of
Solver to check it, and then click OK.
6. Click Tools. If Solver is displayed, go to the next section.
7. If Solver is not displayed, save your file and close Excel. Then open Excel and your
linear programming spreadsheet. Go back to step 1.
Solving the Problem
1. Set up the problem as described above.
2. From the menu bar, select Tools and then Solver. Fill in Solver Parameters as shown below.
There are 4 constraints to enter, and there are two ways to enter them:
Method 1: Enter each constraint separately.
C12>=0
D12>=0
F9<=E9
F10<=E10
Method 2: Enter the constraints as vector inequalities, as shown in the Solver Parameters box.
2
Note that you must also enter the target cells and the changing cells. In addition, select
maximize or minimize.
3. Select Options. If Assume Linear Model is not checked, click the box next to this option. Do
not change any other options. Then click OK.
4. The Solver Parameters dialogue box will reappear. Click Solve.
5. In the Reports box, highlight Answer and Sensitivity. Click OK.
3
Note: If you get a message that Solver could not solve the problem, check your spreadsheet setup
and all the Solver parameters. Also, check the Options to see that Assume Linear Model is
checked.
Beaver Creek Pottery Company
Products
Profit per unit
Bowl (x1)
40
Mug (x2)
50
Constraints
Labor
Clay
1
4
Coefficients
2
3
Production
24
8
Available
40
120
Usage
40
120
Total Profit
1360
Solution: Make 24 bowls and 8 mugs. Total profit = $1,360. All available labor and clay is used.
The Answer Report is shown below:
Target Cell (Max)
Cell
Name
$G$12 Total Profit Unused (slack)
Original Value
0
Final Value
1360
Adjustable Cells
Cell
Name
$C$12 Production Variables
$D$12 Production Mug
Original Value
0
0
Final Value
Constraints
Cell
Name
$F$9 Labor Usage
$F$10 Clay Usage
$C$12 Production Bowl
$D$12 Production Mug
Cell Value
24
8
Formula
40 $F$9<=$E$9
120 $F$10<=$E$10
24 $C$12>=0
8 $D$12>=0
Status
Slack
Binding
0
Binding
0
Not Binding
24
Not Binding
8
1. The original values are 0 because we set them that way. The final values show the solution.
2. The labor and clay constraints are binding because we have used all the labor and clay.
3. The slack for labor and clay is 0 because we have used all the labor and clay.
4
4. The production constraints are not binding because we will make more than 0 units of each
product.
The Sensitivity Report is shown below:
Final Reduced
Cell
Name
$C$12 Production Bowl
Value
24
$D$12 Production Mug
8
Cell
Name
$F$9 Labor Usage
$F$10 Clay Usage
Cost
0
Shadow
Value
40
Price
Allowable
Allowable
Coefficient
Increase
Decrease
40 26.66666667
15
0
Final
120
Objective
50
Constraint
R.H. Side
16
40
6
120
30
Allowable
Increase
20
Allowable
Decrease
40
10
40
60
The first part of the report shows how sensitive the solution is to changes in the profit function.
1. The optimal solution of the problem will not change as long as the profit per bowl varies
between ($40 - $15) = $25 and ($40 + $26.67) = $66.67, provided the profit per mug does
not change. The optimal solution will still be 24 bowls and 8 mugs. Obviously, if the profit
per bowl changes, the amount of profit which Beaver Creek receives for 24 bowls will
change.
2. The solution of the problem will not change as long as the profit per mug varies between
($50 - $20) = $30 and ($50 + $30) = $80, provided the profit per bowl does not change. The
optimal solution will still be 24 bowls and 8 mugs. Obviously, if the profit per mug changes,
the amount of profit which Beaver Creek receives for 8 mugs will change.
3. If an optimal solution has been found, the reduced cost for each variable will be < 0.
The second part of the report shows when it will be profitable to purchase additional units of a
resource.
1. The shadow price is the price at which marginal cost = marginal profit for a constrained
resource. The shadow price for labor is $16 per hour. If you can buy labor for less than $16
per hour, your net profit will increase. The maximum amount you would buy is the allowable
increase, or 40 hours. If you buy more than 40 hours of labor, you would also need to buy
clay (in this problem).
2. The shadow price of clay is $6 per pound, and the maximum amount to buy is 40 pounds.
5
Explanation of the Shadow Price for Labor
If we increase the amount of labor from 40 to 41 hours, net profit increases by $16, to $1,376.
Products
Profit per unit
Bowl
40
Mug
50
Constraints
Labor
Clay
Variables
Bowl
Mug
1
2
4
3
Production
23.4
Available
Usage
41
120
41
120
8.8
Total Profit
1,376
We can continue to increase profit until labor hours reach 80, as shown below.
Products
Profit per unit
Bowl
40
Mug
50
Constraints
Labor
Clay
Variables
Bowl
Mug
1
2
4
3
Production
0.00
Available
Usage
80
120
80
120
40
Total Profit
2,000
Note that no bowls are being made. Total profit = $1360 + 40($16) = $2,000. The original
sensitivity analysis predicted this outcome.
Increasing labor to 81 hours has no effect on profit, since there is no clay for the additional labor
to use.
Products
Profit per unit
Bowl
40
Mug
50
Constraints
Labor
Clay
Variables
Bowl
Mug
1
2
4
3
Production
0.00
Available
Usage
81
120
80
120
40
Total Profit
2000
To increase profit further, we would also have to buy more clay. Essentially, we have a new
optimization problem.
6
Download