Goal Seek and Solver - BYU Marriott School

advertisement
Goal Seek and Solver
08/10/07 BA
Sensitivity analysis is concerned with determining how changes in inputs affect the
outputs. The Excel data table capability makes it easy to perform sensitivity analysis on
one or two inputs at a time. If we want to find a value of a single input which yields a
desired level of an output then Goal Seek is useful. If we want to determine a
combination of inputs which optimizes (maximizes or minimizes) an output then the
Excel Solver can solve your problem.
Goal Seek
Goal Seek is one tool in a suite of commands used in what-if analysis, which is the
process of changing the values in cells to see how those changes affect the outcome of
formulas on the worksheet. For example, if I can only afford a $900 monthly payment, I
first use goal seek to vary the interest rate in an amortization table until I reach the $900
monthly payment result. Then I can shop around until I can secure the interest rate
provided by goal seek.
You can use the Goal Seek feature available by clicking on the Data tab in the top menu
bar, then looking across to the What-If Analysis icon.
If you are not seeing Goal Seek as an option, you’ll need to install the Data Analysis
ToolPak (see previous article in this packet). Otherwise, you can click on Goal Seek and
the pop-up will appear. When goal seeking, Microsoft Excel varies the value in one
specific cell until a formula that's dependent on that cell returns the result you want.
For example, use Goal Seek to change the interest rate in cell B3 incrementally until the
payment value in B4 equals $900.00. After clicking OK we see 7.02% in B3 will give us
a monthly payment of $900. Try this by using Goal Seek in the “Goal Seek-Pmt”
worksheet in the Excel file Goal_Seek_and_Solver_Data.xls on the course website.
Goal Seek and Solver
Copyright Bonnie Anderson and BYU
Excel Solver
What is optimization?
•
•
•
•
•
How can a potato chip company determine the monthly product mix at a specific
plant that maximizes corporate profitability?
How should I allocate my retirement portfolio among high-tech stocks, value
stocks, bonds, cash, and gold?
If PDQ Company produces MP3 players at three locations, how can they
minimize the cost of meeting demand for MP3 players?
XYZ Inc. would like to undertake 20 strategic initiatives that will tie up money
and skilled workers for the next five years. They do not have enough resources to
undertake all 20 projects. Which projects should they undertake?
What price for game consoles and games will maximize profit from console
sales?
In all these situations, we want to find the best way to do something. More formally, we
want to find the values of certain cells in a spreadsheet that optimize (maximize or
minimize) a certain objective. The Excel Solver tool helps you answer optimization
problems.
You use Solver when you want to find the best way to do something. Or, when you want
to find the values of certain cells in a spreadsheet that optimize (maximize or minimize) a
certain objective. An optimization model has three parts: the target cell, the changing
cells, and the constraints.
•
•
•
The target cell represents the objective or goal. For example, maximize monthly
profit.
Changing cells are the spreadsheet cells that we can change or adjust to optimize
the target cell. For example, the amount of each product produced during the
month.
Constraints are restrictions you place on the changing cells. For example, use no
more resources than are available and do not produce more of a product than can
be sold.
Target cell
The target cell represents the objective or goal. We want to either minimize or maximize
the target cell. In the example of a potato chip company's product mix, the plant manager
would presumably want to maximize the profitability of the plant during each month. The
cell that measures profitability would be the target cell. The target cells for each situation
described at the beginning of the article are listed in the following table.
Model
Maximize or
minimize
Target cell
Potato chip company
Maximize
Monthly profit
Goal Seek and Solver
Copyright Bonnie Anderson and BYU
product mix
Retirement portfolio
Minimize
Riskiness of portfolio
MP3 player shipping
Minimize
Distribution costs
Corporate project
initiatives
Maximize
Net present value (NPV) contributed by
selected projects
Game console pricing
Maximize
Profit from game consoles and games
Keep in mind that in some situations, you might have multiple target cells. For example,
PDQ company might have a secondary goal to maximize MP3 player market share.
Changing cells
Changing cells are the spreadsheet cells that we can change or adjust to optimize the
target cell. In the potato chip company example, the plant manager can adjust the amount
produced for each product during a month. The cells in which these amounts are recorded
are the changing cells in this model. The following table lists the appropriate changing
cell definitions for the models described at the beginning of the article.
Model
Changing cells
Potato chip company
product mix
Amount of each product produced during the month
Retirement portfolio
Fraction of money invested in each asset class
MP3 player shipping
Amount produced at each plant each month that is shipped
to each customer
Corporate project
initiatives
Which projects are selected
Game console pricing
Console and game prices
Constraints
Constraints are restrictions you place on the changing cells. In our product mix example,
the product mix can't use more of any available resource (for example, raw material and
labor) than the amount of the available resource. Also, we should not produce more of a
product than people are willing to buy. In most Solver models, there is an implicit
constraint that all changing cells must be non-negative. Oftentimes items in the model
must be a whole number—for example, you can’t sell 3.4 MP3 players. Remember that a
Solver model does not need to have any constraints. The following table lists the
constraints for the problems presented earlier.
Model
Goal Seek and Solver
Copyright Bonnie Anderson and BYU
Constraints
Potato chip company
product mix
Product mix uses no more resources than are available
Retirement portfolio
Invest all our money somewhere (cash is a possibility)
Do not produce more of a product than can be sold
Obtain an expected return of at least 10 percent on our
investments
MP3 player shipping
Do not ship more units each month from a plant than plant
capacity
Make sure that each customer receives the number of MP3
players they need
Make sure a whole player is shipped (using the “integer”
constraint)
Corporate project
initiatives
Projects selected can't use more money or skilled workers
than are available
Game console pricing
Prices can't be too far out of line with competitors’ prices
Installing and Running Solver
To install Solver see the previous article in this packet. Once the add-in is installed, you
can run Solver by clicking Solver by clicking on the Data tab in the main menu, then on
Solver in the Analysis section.
The following figure shows the Solver Parameters dialog box, in which you input the
target cell, changing cells, and constraints that apply to your optimization model.
Goal Seek and Solver
Copyright Bonnie Anderson and BYU
After you have input the target cell, changing cells, and constraints, what does Solver do?
To answer this question, you need some background in Solver terminology. Any
specification of the changing cells that satisfies the model's constraints is known as a
feasible solution. For instance, in our product mix example, any product mix that
satisfies the following three conditions would be a feasible solution:
•
•
•
Mix does not use more raw material and labor than is available.
Mix produces no more of each product than is demanded.
Amount produced of each product is nonnegative.
Essentially, Solver searches over all feasible solutions and finds the feasible solution that
has the "best" target cell value (the largest value for maximum optimization, the smallest
for minimum optimization). Such a solution is called an optimal solution. Some Solver
models have no feasible solution and some have a unique solution. Other Solver models
have multiple (actually an infinite number of) optimal solutions.
How can I determine which product mix maximizes profitability?
Companies often need to determine the monthly (or weekly) production schedule that
gives the quantity of each product that must be produced. In its simplest incarnation, the
product mix problem involves how to determine the amount of each product that should
be produced during a month to maximize profits. Product mix must often satisfy the
following constraints:
• Product mix can't use more resources than are available.
• There is a limited demand for each product. We can't produce more of a product
during a month than is demanded because the excess production is wasted (potato
chips are perishable).
Let's now solve the following example of the product mix problem. You can find the
solution to this problem in the file Goal_Seek_and_Solver_Data.xls using the “SolverPotato Chips” worksheet (which is posted on the course website for downloading), as
shown in Figure 1.
Goal Seek and Solver
Copyright Bonnie Anderson and BYU
Figure 1: The product mix example.
Let's say we work for a potato chip company that can produce five types of chips at their
plant. Production of each product requires labor and raw material.
•
•
•
Row 6 in Figure 1 gives the hours of labor needed to produce a bag of each
product, and row 7 gives the pounds of raw material needed to produce a bag of
each product. For example, producing a bag of regular chips requires 3 hours of
labor and 3.2 pounds of raw material.
For each potato chip type, the price per bag is given in row 8, the unit cost per bag
(i.e. variable cost) is given in row 9, and the profit contribution per bag is given
in row 11. For example, BBQ chips sell for $2.50 per bag, incurs a unit cost of
$1.30 per bag, and contributes $1.20 profit per bag.
This month's demand for each chip type is given in row 10. For example, demand
for baked chips is 60 bags.
This month, 1000 hours of labor and 1250 pounds of raw material are available. How can
this company maximize its monthly profit?
If we knew nothing about Solver, we would attack this problem by constructing a
spreadsheet in which we track for each product mix the profit and resource usage
associated with the product mix. Then we would use trial and error to vary the product
mix to optimize profit without using more labor or raw material than is available and
without producing more of any product than there is demand. We use Solver in this
process only at the trial-and-error stage. Essentially, Solver is an optimization engine that
flawlessly performs the trial-and-error search.
Using the SUMPRODUCT function
A key to solving the product mix problem is efficiently computing the resource usage and
profit associated with any given product mix. An important tool that we can use to make
this computation is the SUMPRODUCT function. The SUMPRODUCT function
multiplies corresponding values in cell ranges and returns the sum of those values. Each
cell range used in a SUMPRODUCT evaluation must have the same dimensions, which
implies that you can use SUMPRODUCT with two rows or two columns but not with a
column and a row.
Goal Seek and Solver
Copyright Bonnie Anderson and BYU
As an example of how we can use the SUMPRODUCT function in our product mix
example, let's try to compute our resource usage. Our labor usage is given by summing
the quotient of the labor hours required for each bag by the quantity of each type of chip.
In our spreadsheet, we could compute labor usage (in a tedious fashion) as
B4*B6+C4*C6+D4*D6+E4*E6+ F4*F6. Similarly, raw material usage could be
computed as B4*B7+C4*C7+D4*D7+E4*E7+ F4*F7. Entering these formulas in a
spreadsheet is time-consuming with five products. Imagine how long it would take if you
were working with a company that produced, say, 50 products at their plant.
A much easier way to compute labor and raw material usage is to copy from B16 to B17
the formula:
=SUMPRODUCT($B$4:$F$4,B6:F6)
This formula computes B4*B6+C4*C6+D4*D6+E4*E6+ F4*F6 (which is our labor
usage) and is much easier to enter.
Notice that I use the $ sign with the range B4:F4 so that when I copy the formula I still
pull the product mix from row 4. The formula in cell B17 computes raw material usage.
In a similar fashion, our profit is given by summing the quotient of the profit for each bag
by the quantity of each type of chip. The shortcut is to use the following formula in B13:
=SUMPRODUCT(B11:F11,$B$4:$F$4)
We now can identity the three parts of our product mix Solver model:
Target cell
Changing cells
Our goal is to
maximize profit
(computed in cell
B13).
The number of bags
produced of each
product (listed in the
cell range B4:F4).
Constraints
Do not use more labor and raw
material than are available. That is, the
values in cells B16:B17 (resources used)
must be less than or equal to the values in
cells D16:D17 (the available resources).
Do not produce more of a chip than is
in demand. That is, the values in the cells
B4:F4 (bags produced of each type) must
be less than or equal to the demand for each
type (listed in cells B10:F10).
We can't produce a negative amount
of any chip.
How can I input this model into Solver?
I'll now show you how to input the target cell, changing cells, and constraints into Solver.
Then, all you need to do is click the Solve button and Solver will find a profitmaximizing product mix!
1.
To begin, select Solver on the Tools menu. The Solver Parameters dialog box
will appear.
Goal Seek and Solver
Copyright Bonnie Anderson and BYU
2.
To input the target cell, click in the Set Target Cell box and then select our profit
cell (cell B13). To input our changing cells, click in the By Changing Cells box and
then point to the range B4:F4, which contains the number of bags produced for each
type of potato chip. The dialog box should now look like the following figure.
3.
We're now ready to add constraints to the model. Click the Add button. You'll see
the Add Constraint dialog box.
4.
To add the resource usage constraints, click in the box labeled Cell Reference
and then select the range B16:B17. Choose <= from the list in the middle of the
dialog box. Click in the box labeled Constraint, and then select the cell range
D16:D17.
Goal Seek and Solver
Copyright Bonnie Anderson and BYU
We have now ensured that when Solver tries different values for the changing cells,
Solver will consider only combinations that satisfy both B16 <= D16 (labor used is
less than or equal to labor available) and B17 <= D17 (raw material used is less than
or equal to raw material available).
5.
Now click Add in the Add Constraint dialog box to enter the demand
constraints. Simply fill in the Add Constraint dialog box as shown in the following
figure.
Adding these constraints ensures that when Solver tries different combinations for the
changing cell values, Solver will consider only combinations that satisfy the
following:
•
•
•
B4 <= B10 (the amount of regular chips made is less than or equal to the
demand for regular chips)
C4 <= C10 (the amount of BBQ chips made is less than or equal to the
demand for BBQ chips)
And so on for each of the types of chips
6.
Click OK in the Add Constraint dialog box. The Solve Parameters dialog box
should look like the following figure.
7.
We enter the constraint that all changing cells be non-negative in the Solver
Options dialog box, which we open by clicking the Options button in the Solver
Parameters dialog box.
Goal Seek and Solver
Copyright Bonnie Anderson and BYU
Select the options Assume Linear Model and Assume Non-Negative, and then click
OK.
Selecting the Assume Non-Negative option ensures that Solver considers only
combinations of changing cells in which each changing cell assumes a non-negative
value.
We selected Assume Linear Model because the product mix problem is a special
type of Solver problem called a linear model. For the purposes of this class, you can
assume all the problems will be linear.
8.
After clicking OK in the Solver Options dialog box, we're returned to the main
Solver dialog box. When we click Solve, Solver calculates an optimal solution (if one
exists) for our product mix model.
An optimal solution to the product mix model would be a set of changing cell values
(bags produced of each type of chip) that maximizes profit over the set of all feasible
solutions.
A feasible solution is a set of changing cell values satisfying all constraints. The
changing cell values shown in Figure 2 are a feasible solution because all production
levels are non-negative, no production levels exceed demand, and resource usage does
not exceed available resources. However, it is not the optimal solution because profit has
not been maximized (see Figure 4).
Occasionally there may be multiple feasible solutions, so the answer may change if you
run solver a second or third time.
Goal Seek and Solver
Copyright Bonnie Anderson and BYU
Figure 2: A feasible solution to the product mix problem fits within constraints.
The changing cell values shown in Figure 3 represent an infeasible solution for the
following reasons:
•
•
•
We produce more baked chips than is demanded.
We use more labor than labor available.
We use more raw material than raw material available.
Figure 3: An infeasible solution to the product mix problem doesn't fit within the constraints we
defined.
Goal Seek and Solver
Copyright Bonnie Anderson and BYU
After clicking Solve, Solver quickly finds the optimal solution shown in Figure 4. You
need to select Keep Solver Solution to preserve the optimal solution values in the
spreadsheet.
Figure 4: The optimal solution to the product mix problem.
Our potato chip company can maximize its monthly profit at a level of $394.80 by
producing 200 bags of regular chips, 34 bags of BBQ chips, and 80 bags of wavy chips—
and not producing any baked or cheese chips. We can't determine if we can achieve the
maximum profit of $394.80 in other ways. All we can be sure of is that with our limited
resources and demand, there is no way to make more than $394.80 this month.
Does a Solver model always have a solution?
Suppose that demand for each product must be met. We then have to change our demand
constraints from B4:F4 <= B10:F10 to B4:F4 => B10:F10. To change this constraint:
1.
2.
Open Solver.
Click the B4:F4 <= B10:F10 constraint, and then click Change.
The Change Constraint dialog box appears.
3.
In the center box, choose >=, and then click OK.
Goal Seek and Solver
Copyright Bonnie Anderson and BYU
We've now ensured that Solver will consider only changing cell values that meet all
demands.
When you click Solve, you'll see the message: Solver could not find a feasible solution.
This message means that with our limited resources, we can't meet demand for all
products. We have not made a mistake in our model! Solver is simply telling us that if we
want to meet demand for each product, we need to add more labor, more raw materials,
or more of both.
What does it mean if set values do not converge?
Let's see what happens if we allow unlimited demand for each product and we allow
negative quantities to be produced of each type of potato chip. To find the optimal
solution for this situation:
•
•
•
Open Solver.
Click the Options button, and then clear the Assume Non-Negative check box.
In the Solver Parameters dialog box, click the demand constraint B4:F4 <=
B10:F10, and then click Delete to remove the constraint.
When you click Solve, Solver returns the message, The Set Cell values do not
converge. This message means that if the target cell is to be maximized (as in our
example), there are feasible solutions with arbitrarily large target cell values. (If the target
cell is to be minimized, this message means there are feasible solutions with arbitrarily
small target cell values.)
In our situation, by allowing negative production of a type of potato chip, we in effect
"create" resources that can be used to produce arbitrarily large amounts of other types.
Given our unlimited demand, this allows us to make unlimited profits. In a real situation,
we can't make an infinite amount of money. In short, if you see Set values do not
converge, your model has an error.
Parts of this reading were adapted from Microsoft Excel Data Analysis and Business Modeling by Wayne L. Winston as posted on
Microsoft Learning.
Goal Seek and Solver
Copyright Bonnie Anderson and BYU
Download