Step by Step Optimization S
Step by Step Optimization S
Step-By-Step Optimization
With
Excel Solver
Table of Contents
Table of Contents ............................................................................................2
Reader Testimonials For The Excel Statistical Master..........................7
Excel Solver Overview .................................................................................20
Installing the Excel Solver ..........................................................................22
Optimization Basics With Excel Solver ...................................................29
Always Start By Diagramming the Model On Paper ........................30
Make the Model As Simple and Intuitive As Possible .....................30
Step 1 Determine the Objective..........................................................30
Step 2 Determine the Decision Variables ........................................31
Step 3 Build the Excel Equations That Combine the Objective
With All Decision Variables ....................................................................31
Step 4 List all Constraints....................................................................33
Step 5 Test the Excel Spreadsheet....................................................34
Step 6 Insert All Data into the Solver Dialogue Box .....................35
1) The Objective Cell...................................................................... 36
2) Minimize or Maximize the Target ............................................... 36
3) Decision Variables ..................................................................... 36
4) Constraints................................................................................. 36
Reader Testimonials
For
Practical and Clear
Graduate Statistics in Excel
The Excel Statistical Master
"I really like the Excel Statistical Master. It is incredibly useful. The
explanations and videos in the manual are excellent.
It has really made my work with statistics a LOT easier. I'm really
glad that I came across the manual.
If you're a student of business statistics, this e-manual is worth
WAY more it's priced. I will use your manual as a reference for my
MBA course that I am teaching this summer."
Dr. Yan Qin
Adjunct Assistant Professor New York University
Co-Director
Nankai-Grossman Center for Health Economics and Medical
Insurance, New York, New York
"I teach Business Statistics and conduct Field Work for Many
Organizations for more than 20 years,
I can tell You that this Masterpiece is Very Very Very useful and
would save you considerable time if you teach, but If you are a
Student...Please Pray for the Author... This is a GIFT from GOD.
Keep it Up please."
Abdul Basit Al-Mahmood
Senior Consultant
ExcelTech
Kingdom of Bahrain
"It is terrific that you offer this ebook; you are doing a tremendous
service for people and I thank you for that. This is such a useful
tool that you are providing.
Statistics can be an intimidating subject and this is the only
product out there that cuts through the complexities and gives a
clear, easy to understand overview.
If you offer other products in the future, please feel free to put me
on your marketing list. It is refreshing to meet good people that are
willing to share valuable information.
Best Regards,"
Chris Leal
Irvine, California
"My first encounter with the EXCEL Statistical Master came when
writing a report for a customer when the axiom "an un-used tool
becomes rusty" presented itself. I knew what analysis and
presentation tool I wanted, but using EXCEL became cumbersome
and frustrating.
A quick on-line check revealed the EXCEL Statistical Master which
proved to be unequivocal, easy to follow, and complete. Only after
completing the report did I notice the description on the front page
"Clear And Simple yet Thorough." Clearly, my experience
supported substantiated this claim. Seldom does one encounter
such truth in advertising.
Last weekend the manual was very useful in helping my grandson,
who just started a statistics class in high school, help understand,
envision, and define his semester project as to which data to gather
and how to analyze and present that data.
I have recommended the Excel Statistical Master to customers and
my contractors."
Pat Goodman
SSL Consulting
Morgan Hill, California
"I am an IT Consultant who gives a Data Analysis for Decision
Making workshop to various private and public sector
organizations. This workshop consists of many statistical methods.
I often use the Excel Statistical Master in my workshop to
demonstrate procedures, give usable examples and frequently,
learn new procedures myself.
I find it easy to use, clear and succinct. It should wipe out the fear
of statistics from those who have a block against it."
Akram Najjar
Director, InfoConsult - IT Consulting
Beirut, Lebanon
First, click the File drop-down menu. On this menu, select Options near
the bottom of the menu:
On the Excel Options menu, select Add-Ins near the bottom of this
menu. Doing so will bring up the list of available Add-Ins. The Add-ins
that appear in this list are all included in Excel 2010 but they are
available for use only after they have been activated.
The following menu shows 2 lists of Add-Ins: the upper list of Active
Application Add-Ins and the lower list of Inactive Application Add-Ins.
The highlighted Solver Add-In appears in the lower Inactive list and
therefore has not yet been activated. As soon as it is activated, the
Solver Add-In will then be moved to the upper Active Applications AddIns list.
To activate the Solver Add-In, scroll to the bottom of this menu and
select Excel Add-Ins from the Manage menu and hit Go as follows:
After selecting Excel Add-Ins and hitting Go, the following list of Excel
Add-Ins will appear. To activate any of these Add-Ins, simply check the
box next to the Add-In you want to activate and then hit OK.
After you have selected Solver Add-In and the Analysis ToolPak and
then hit OK, these 2 Add-Ins are now listed in the upper Active
Application Add-Ins list as shown next in the following Add-Ins list:
The Excel Solver calculates the values of all Decision Variables that will
maximize or minimize the Objective or cause the Objective to be set to a
specific value. The Solver only changes the values of Decision
Variables during its calculations. Any other variables not directly
affected by the Decision Variables will not change. These can be
replaced with constant values.
spreadsheet. You can now open up the Solver dialogue box and insert
that range as a Constraint, a block of Variable Cells, or an Objective (if
the named and highlighted block is just a single cell).
Bring up the Excel Solver and the following blank Solver dialogue box
comes up:
The Solver dialogue box has the following 5 parameters that need
to be set:
Here the settings used to apply the Excel Solvers built-in Constraints:
Integer Constraints
Some variables in the Clear Mathematical Path to the Objective may
have to be limited to assuming whole number (integer) values. The cells
in the spreadsheet containing these variables will be set to the
Constraint setting int which is short for the Solver Integer Constraint.
Binary Constraints
Some variables in the Clear Mathematical Path to the Objective may
have to be limited to assuming binary (1 or 0) values. These variables
usually designate use or dont use or on or off conditions of other
variables in the mathematical path. The cells in the spreadsheet holding
these variables will be set to the Constraint setting bin which is short
for the Solver Binary Constraint. The Investment Selection example in
this manual applies the Binary Constraint to the Decision Variables
which determine whether or not an investment will be made in a
particular year.
Alldifferent Constraints
Sometime all of the variables within a group of variables must have
different values. All of the cells as a group will be simultaneously set to
the Constraint setting dif, which is short for the Solver Alldifferent
Constraint. An example of this is shown in the Traveling Salesman
Problem in this manual.
Employing any of Solvers built-in Integer Constraints (Integer, Binary, or
All Different) can often greatly increase the time that the Excel Solver
takes to find a solution.
Evolutionary Method
The Evolutionary method must be used if any functions in the Clear
Mathematical Path to the Objective is discontinuous or non-smooth. The
Evolutionary method is so named because it uses Evolutionary
algorithms when solving.
Non-smooth and discontinuous functions are often the most difficult
optimization problems and can take much longer for the Excel Solver to
solve. The Evolutionary method used to solve the Traveling Salesman
example in this manual took 164 seconds to complete its job. You may
view the problems Answer Report see this run time.
Further, the Evolutionary method can often can only find a good
solution and not a globally or locally optimal solution.
Common non-smooth Excel functions are MIN, MAX, and ABS.
Common discontinuous Excel functions are INDEX, HLOOKUP,
VLOOKUP, LOOKUP, INT, ROUND, COUNT, CEILING, FLOOR, IF,
CHOOSE, NOT AND, OR, GREATER THAN, LESS THAN, and EQUAL
TO.
If any of the above functions or other non-smooth or discontinuous
functions are in the Clear Mathematical Path to the Objective, the
Evolutionary method must be used.
An example of the Evolutionary method in use is the Traveling Salesman
Problem in this manual. The Evolutionary method had to be used in this
example because the Clear Mathematical Path to the Objective contains
the discontinuous Excel INDEX lookup function.
The Evolutionary method can be used to solve any problem can be
solved with the GRG Nonlinear method or the Simplex LP method, but
will do so much less efficiently.
2) Increase the Population Size and/or Mutation Rate and run the
Evolutionary method again. This will increase the number of
sample points that the Evolutionary method will explore, possibly
resulting in a better solution.
3) Increase the allowable number of max Subproblems or max
Feasible solutions in the All Methods Options box.
4) Try solving the same problem and same solution using the GRG
Nonlinear method. If the GRG Nonlinear method finds a solution,
you will know that this solution is at least a locally optimal solution
and not just a good, feasible one.
Constraint Precision: This establishes how close you want the value in
any Constrained cell to be to the actual Constraint Value. The Constraint
Precision value is maximum allowable difference between the value in a
Constrained cell and the value of the actual Constraint. The Constraint is
satisfied only if that difference is equal to or less than the Constraint
Precision setting.
Show Iteration Results: This stops the Solver after each trial run and
displays the result for that iteration. In most cases you can leave this
option unchecked unless you have a specific reason to view the results
after each trial run.
Solving Limits
Max Time (Seconds): The maximum number of seconds that the Solver
will be allowed to run. No matter what, the Solver can always be stopped
by hitting the Esc key. At that point, you are given the option of Stopping
or Restarting the Solver operation.
Iterations: The maximum number of iterations (trial runs) that the Solver
will be allowed to perform.
The smaller the value, the more iterations must be run to reach that
smaller convergence value, but Solver final solution will be closer to the
optimal solution. To sum up, this setting tells how much the Objective
must have slowed its changing during successive iterations for the
Solver to finally announce that it has converged to a solution.
Population Size: This setting establishes how many times the multistart
method should run until the GRG Nonlinear method presents the best of
all of the Locally Optimal solutions that it has found. The Population Size
is the number of sets of Decision Variable initial values that the GRG
Nonlinear method will run through before providing its answer. This
number should be between 10 and 200. A setting of less than 10 or
blank will result in the minimum number of 10 multistart runs.
the more iterations must be run to reach that smaller convergence value,
but Solver final solution will be closer to the optimal solution.
and took 164 seconds to provide its final solution. This time could have
been greatly reduced if this setting had been set to a significantly shorter
time period.
Limits Report The Limits Report is made available when the Solver
finds a Globally or Locally Optimal solution and no Integer Constraints
(Integer, Binary, Alldifferent) were used.
Solver Engine The type of Solver method that was used (Simplex
LP, GRG Nonlinear, or Evolutionary method)
Solution time The total time it took the Solver to find the solution.
Some problems take quite a bit more time than others. Most Simplex
LP problems are solved quickly. Note that the Answer Report for the
Traveling Salesman problem shows that the Evolutionary Solver took
164 seconds to reach its solution because it had to run through
123,302 subproblems. This run time could have been limited by
applying options settings.
Name - The Name of the Variable Cell will be taken from the nearest
label over the top of the Decision Variable or by combining the nearest
label directly to the left of the Decision Variable along with the nearest
label on top of that Decision Variable. Part 2 of the Answer Report in the
Best Value The value that the Solver assigned to that Decision
Variable during the Solver run which calculated the current Objective
solution.
The 2nd section of the Limits Report shown as follows indicates that
none of the Decision Variables have any slack because the upper and
lower limits of each Decision Variable are the same.
The 3rd section of the Answer Report provides a similar analysis, but on
the Constraints. This section of the Answer Report indicates how much
slack each Constraint has.
The Dual Value for a Decision Variable equals zero unless that Decision
Variables final value is equal to its upper or lower bound. A Decision
Variables Dual Value (Reduced Cost or Reduced Gradient) is nonzero
only when its final solution value equals its upper or lower bound. A
nonzero Dual Value for a Decision Variable indicates that the Objectives
final, optimal solution can be improved by loosening the binding
Constraint on that Decision Variable.
The Dual Value for a Constraint indicates how sensitive the problem is to
changes in that Constraint. Specifically, a Constraints Dual value
(Shadow Price or Lagrange Multiplier) states how much the Objective
functions value (final best solution) will change for each unit of change
in that Constraints bound.
For each Constraint, Part 2 of the Sensitivity Report shows the
Constraints Right Hand Side, which is the Constraints limiting value.
Part 2 also shows how much that Right Hand Side could be changed
(increased or decreased) without affecting that Constraints Dual Value
(Shadow Price or Lagrange Multiplier).
For linear problems, Dual Values remain constant for a range of possible
changes in the Objective function coefficients and Constraint right hand
sides. This range information is provided in the Sensitivity report.
For nonlinear problems, the Dual Values provided are valid only at the
optimal point. These values change as soon as you move away from the
optimal solution because of the nonlinear problems curvature.
We then make a change to Objective cell, E9. Cell E9 contains the sum
of the 4 Total Calorie figures directly above it. Raising 1 of those Total
Calorie figures (cell C6 the Decision Variable indicating the number of
Juice Cans to be placed in the Knapsack) to the 3rd power while inside of
the sum formula in cell E9 changes that formula from linear to nonlinear.
This is illustrated in the updated Excel model shown as follows:
Trying to solve this model, which now has a nonlinear formula in cell E9,
with the Simplex LP generates the following Linearity Report. The
Linearity Report has 3 parts.
Part 1 of the Linearity Report correctly identifies the Objective cell, E9,
as containing a nonlinear formula.
One further solution that will enable the Simplex LP method to be used
to solve nonlinear problems is to convert any nonlinear formula to its
linear equivalent. You can then continue to use the Simplex LP method
to solve the problem. Linear problems are generally solved much faster
than nonlinear problems. This is especially true if the problem contains
any integer Constraints (Integer, Binary, or Alldifferent). Converting
nonlinear formulas to their linear equivalents is an advanced topic that
will not be covered in this manual.
The original Solver dialogue box for this example shown as follows. It
contains the correct Constraints that will produce a feasible solution.
The 2nd Solver dialogue box shown as follows is the same Solver
dialogue box as the original, except with one of the Constraints changed
to produce an infeasible condition.
Note that the 1st Constraint ($E$8 = 1) now prevents the 2nd Constraint
($F$8 = $B$12*100) from be satisfied. The 1st Constraint is therefore the
limiting Constraint which causes the infeasible condition. This is true
even though it was the 2nd Constraint that was altered and made
incorrect.
The Feasibility Bounds Report produces a similar output but does not
attempt to eliminate Decision Variable bounds that produce infeasible
conditions.
Knapsack Example
Optimizing the Loading of a Limited Compartment
This is a classic Solver problem with many possible variations. Knapsack
problems involve selecting the correct items to load into a compartment
which is limited (Constrained) in some way such as by its size or
maximum weight of its load. Objects selected for loading must maximize
or minimize a given criterion while at the same time staying within the
Constraints of the compartment.
These type of optimization problems are known as Knapsack Problems
because of the well known classic example of selecting the correct items
to optimally fill a campers knapsack. The knapsack has a limited weightcarrying capacity and items are selected that optimize at least one
criterion while not exceeding the knapsacks weight-carrying capacity.
The Problem
A knapsack is being loaded for a camping trip. This knapsack has a
maximum weight-carrying limit and a maximum load size limit. The
camper can choose from 4 different food items to put into the
knapsack. The selected items must maximize the overall number
calories and provide at least a minimum number of grams of
protein while not exceeding the maximum load size and weightcarry capacity of the knapsack.
The knapsacks load cannot exceed a weight of 10 kilograms or a
3
volume of 0.125 m . The load of food items must contain at least
200 grams of protein.
The load may contain any number of each of the 4 following food
items:
-
Candy Bar
Sandwich
Can of Juice
Apple
Specific information about each food items are as follows:
The yellow Objective Cell, E7, displays the total number of calories and
will be maximized. The green Decision Variable cells (C4 to C7) display
the number of each type of food item needed to achieve the objective.
All equations on the Excel spreadsheet are linear (1st order) so we can
use the Simplex LP (Linear Programming) Solver engine for this
optimization problem.
Step 3 shows the completed problem with Decision Variables that have
been optimized by the Solver to maximize the Objective while staying
within the problems Constraints.
Answer Report
Part 1
Note:
- The Solver Result
- How long Solver took to solve the problem
- The Solver Engine that was used and the Solver Options settings
- Where the Objective Cell was labeled in the Excel model for its
name to appear as it does in Part 1 of the Answer Report
Part 2
-
Part 3
-
The Problem
A garment factory produces rolls of garment in the following 2
sizes: rolls that are 75 inches wide and rolls that are 55 inches
wide. Customers order garment rolls in the following 3 sizes: rolls
that are 36 inches wide, rolls that are 25 inches wide, and rolls that
are 13 inches wide.
The factory must cut the 75 rolls and 55 rolls in the correct
number of 36, 25, and 13 rolls to meet individual customer
orders while minimizing waste. Waste represents garment that is
cut from the original 75 and 55 rolls which is not included in a
customer order and is left-over.
The following 2 images present an expanded view for better clarity of the
left and right halves of the preceding complete Excel model. The 1st
image is the left side of the model and list all possible cutting
combinations and the waste left-over from each. The 2nd image shown is
the right side of the model with the green Decision Variables and the
yellow Objective Cell:
The light blue Constraint cells in the model the preceding image link to
the light blue user-controlled inputs outside of the model in the following
image. The user-controlled inputs represent the customers order as
follows:
All equations on the Excel spreadsheet are linear (1st order) so we can
use the Simplex LP (Linear Programming) Solver engine for this
optimization problem.
Step 3 shows the completed problem with Decision Variables that have
been optimized by the Solver to maximize the Objective while staying
within the problems Constraints.
Answer Report
Part 1
Note:
-
Part 2
-
Part 3
-
The Problem
3 machines perform the same generic type of task; they all make
bolts. Each machine varies in the variety of bolts that it can
produce. Each machine also has a different operating cost and a
different operating speed. The objective is to fulfill an individual
customer order within a specified time limit while minimizing the
total cost of fulfilling this order.
500 minutes is the total time allowed to complete this entire order.
inch bolts). There are 3 machine available to fulfill this order. We must
determine how many bolts of each type to produce on each machine in
order to fulfill the order within the given time frame and at the lowest total
cost. The Decision Variables are numbers of each type of bolt that each
machine will produce.
The yellow Objective Cell, H16, displays the total cost of fulfilling the
order using all 3 machines. This will be minimized. The green Decision
Variable cells (C12, C13, C14, D12, D13, E12) display the numbers of
each type of bolt that each machine will produce.
The light blue Constraint cells in the model in the preceding image link to
the light blue user inputs in the following image.
The light blue user-input cells (B32, B34, B36) represent the customers
order. The number of bolts produced by each machine (the Decision
Variables) must be whole numbers (integers) and cannot be negative.
All equations on the Excel spreadsheet are linear (1st order) so we can
use the Simplex LP (Linear Programming) Solver engine for this
optimization problem.
Step 3 shows the completed problem with Decision Variables that have
been optimized by the Solver to maximize the Objective while staying
within the problems Constraints.
Answer Report
Part 1
Note:
-
Part 2
-
Part 3
-
The Problem
4 sales territories will be assigned to 4 salespeople. Each
salesperson will be assigned to a separate territory. Each
salesperson is surveyed to determine his or her liking for each of
the 4 sales territories. Each salesperson will rate the desirability of
each sales territory on a scale of 1 to 5. A score is 5 is the highest
and indicates that the salesperson favors this territory above the
other 3. The salespeople are required to assign a different rating to
each of the 4 territories.
Note that the green Decision Variables (cells C14 to F17) were forced to
be binary by Constraining their row totals (light blue cells G14 to G17)
and column totals (light blue cells C19 to F19) to 1. We did not in this
apply the built-in Binary Integer Constraint because of this.
Once again note that no Binary Constraint was used because the
Decision Variables were forced to be binary by setting row and column
totals to 1 using the Constraints in the preceding image.
These Constraints could be varied to allow more than 1 salesperson to
be assigned to any of the territories, or allow each salesperson to be
assigned more than 1 territory. Try varying the Constraints on the
downloadable Excel workbook containing this and all other examples in
this manual.
If we scroll down the Constraints, we can see the rest of the Constraints
as follows:
All equations on the Excel spreadsheet are linear (1st order) so we can
use the Simplex LP (Linear Programming) Solver engine for this
optimization problem.
Step 3 shows the completed problem with Decision Variables that have
been optimized by the Solver to maximize the Objective while staying
within the problems Constraints.
Answer Report
Part 1
Note:
-
Part 2
-
Part 3
-
The Problem
A company manufactures its own products at its 3 factories and
then delivers these products at its own 3 stores. Each of the 3
stores orders a different amount of the product from the factories
while each of the 3 factories has a different amount of the product
available to ship to the stores. Shipping costs per unit of product
are different between each factory and each store. Determine the
optimal amount of product to ship from each factory to each store
in order to minimize total shipping costs while fulfilling each
stores order.
The preceding image of the model shows the yellow Objective cell
(D20), the green Decision Variables (C13 to C15, E13 to E15, G13 to
G15), and the light blue Constraint cells (C17, E17, G17, J13 to J15).
Following on the next several pages is an expanded view of this Excel
model for greater clarity.
The next image shows a close-up of the part of the model containing all
the green Decision Variables and the light blue Constraint cells that
Constraint the amount shipped to each store.
Following are the yellow Objective total cost of shipping and the light
blue Constraint cells that ensure that each store will receive its required
number of units of product.
Following are the light blue Constraint cells that ensure that each factory
will not attempt to ship more units than that factory has available.
The light blue Constraint cells shown here are the cells on the
spreadsheet where the user inputs the number of units of product
needed from each store and the number available from each factory.
All equations on the Excel spreadsheet are linear (1st order) so we can
use the Simplex LP (Linear Programming) Solver engine for this
optimization problem.
Step 3 shows the completed problem with Decision Variables that have
been optimized by the Solver to maximize the Objective while staying
within the problems Constraints.
Answer Report
Part 1
Note:
-
Part 2
-
Part 3
-
The Problem
A company must divide a limited outbound broadcast media
advertising budget among 3 broadcast media vehicles in order to
generate at least 1,000,000 Effective Advertising Impressions at the
lowest total cost. The broadcast media vehicles are a local TV
station and 2 cable TV stations.
Each of the 3 media vehicles is judged to have differing degrees of
advertising effectiveness per each individual ad impression. This is
due to differences in viewership demographics and relevancy of
the programming to the companys advertising message. The
number of ad impressions for each media vehicle is weighted
according to vehicles effectiveness to produce a unit of measure
called an Effective Advertising Impression.
Given the overall advertising budget and the maximum advertising
spending per media vehicle, how should the overall advertising
budget be divided up among the 3 broadcast media vehicles to
produce at least 1,000,000 Effective Advertising Impression as
cheaply as possible?
Here is the right half of the model showing the interaction between the
green Decision Variables (F3 to F5), the yellow Objective Cell (G7), and
the light blue Constraints (G3 to G5, H7).
The yellow Objective cell displays the total cost of advertising and will be
minimized. The green Decision Variable cells display the number of
The light blue Constraint cells shown above are the cells that the user
will input the maximum budgets for TV, Cable 1, and Cable 2. The final
Constraint cell is the cell that the user will input the required minimum
number Effective Advertising Impressions for the entire advertising
campaign over all 3 media vehicles.
All equations on the Excel spreadsheet are linear (1st order) so we can
use the Simplex LP (Linear Programming) Solver engine for this
optimization problem.
Step 3 shows the completed problem with Decision Variables that have
been optimized by the Solver to maximize the Objective while staying
within the problems Constraints.
Answer Report
Part 1
Note:
-
Part 2
-
Part 3
-
The Problem
An overall Inbound Marketing budget must be divided among 3
pay-per-click vehicles in order to achieve the highest number of
qualified leads. In addition to an overall budget limit, each pay-perclick vehicle has an advertising spending limit as well.
The 3 pay-per-click vehicles are AdWords, Facebook, and LinkedIn.
Each one of these has a different cost-per-click and also has a
different effectiveness. The objective is to divide the overall
Inbound Marketing advertising budget among these 3 pay-per-click
vehicles to achieve the highest number of qualified leads.
Following are the specific details about the cost and effectiveness
of each of the 3 pay-per-click advertising vehicles:
The yellow Objective cell (i14) displays the total number of number of
expected qualified leads. The green Decision Variable cells (C9 to C11)
display the amounts of money (ad spend) spent on each of the pay-perclick vehicles to achieve the objective.
The preceding light blue Constraint cells link to the model to limit total ad
spend and ad spend for each pay-per-click vehicle.
All equations on the Excel spreadsheet are linear (1st order) so we can
use the Simplex LP (Linear Programming) Solver engine for this
optimization problem.
Step 3 shows the completed problem with Decision Variables that have
been optimized by the Solver to maximize the Objective while staying
within the problems Constraints.
Answer Report
Part 1
Note:
-
Part 2
-
Part 3
-
The Problem
Correctly divide a bond portfolio among 4 bonds of varying yields
and maturities in order to achieve an overall bond portfolio with an
average maturity of 5.5 years while maximizing overall yield.
The yellow Objective cell G8 displays the overall portfolio yield and will
be maximized. The green Decision Variable cells (E3 to E6) display the
percentages of the overall portfolio to achieve the objective while
creating a portfolio with an average maturity of 5.5 years. The light blue
Constraint cell in the model (F8) establishes the average bond maturity
and is controlled by the light blue user input in cell B12 in the following
diagram:
All equations on the Excel spreadsheet are linear (1st order) so we can
use the Simplex LP (Linear Programming) method for this optimization
problem.
Step 3 shows the completed problem with Decision Variables that have
been optimized by the Solver to maximize the Objective while staying
within the problems Constraints.
Answer Report
Part 1
Note:
-
Part 2
-
Part 3
- Note how each Constraint is labeled in the Excel model in order
for the Constraints name to appear here in Part 3 of the Answer
Report as it does
- Note which Constraints are binding (had their limits hit) and which
arent.
- Note how much slack is still available in any Constraint that has
not had its limit hit.
- Note any Integer Constraints (Integer, Binary, Alldifferent)
Limits Report
The Limits Report is made available when the Solver finds a Globally or
Locally Optimal solution and no Integer Constraints (Integer, Binary,
Alldifferent) were used. Part 2 of the Answer Report Shows that the
variables were Continuous and not Integers. The Simplex LP method
solves linear problems to globally optimal solutions.
The 2nd section of the Limits Report just shown indicates that none of
the Decision Variables have any slack because the upper and lower
limits of each Decision Variable are the same.
Sensitivity Report
The Sensitivity Report is also made available when the Solver finds a
Globally or Locally Optimal solution and no Integer Constraints (Integer,
Binary, Alldifferent) were used. Part 2 of the Answer Report Shows that
the variables were Continuous and not Integers. The Simplex LP method
solves linear problems to globally optimal solutions.
The Problem
A venture capitalist with limited funds can make annual
investments over the next 2 years. He has 6 investment
opportunites to choose from. 3 of the investment opportunities will
occur at the start of year 1. The other 3 investment opportunities
will occur at the start of year 2. He doesnt have to invest anything
if he chooses not to. If he does choose to invest in any opportunity,
he must invest upfront 100% of start-up capital required by that
investment. The venture capitalist has only enough capital to make
2 investments during any one year.
The projected annual cash flows for each investment are shown
below. These projected cash flows include the upfront investment
that the venture capitalist would have to make.
The goal is to select the investments that would maximize Net
Present Value at year 0 of all cash flows of all selected investments.
A discount rate of 25% will be used because the investments are
considered risky.
The projected annual cash flows for each investment, including all
upfront investments, are shown as follows:
On the following pages are expanded views of the left and right sides of
the preceding Excel model for better clarity.
Shown as follows is the left side of the Excel model. The green Decision
Variables (C17 to E17, F18 to H18) are binary variables occurring in
Years 1 and 2. The light blue Constraints cell (C24 and F24) limit the
maximum number of investments that can be made during Year 1 and
Year 2.
The right side of the model shown as follows contains 1) the combined
annual cash flows for all selected investments (Column I), 2) the Present
Value at Year 0 of each combined annual cash flow (Column J), 3) and
the yellow Objective cell (K17) containing the Net Present Value at Year
0 of all combined annual cash flows (the sum of the Year 0 Present
Values). Each years combined cash flows (I17 to I22) were copied from
cells I31 to I36. The Excel formula for calculating the Present Values at
Year 0 in column J is also shown.
-t
-t
-4
The yellow Objective cell displays the Net Present Value of all annual
cash flows of all selected investments. This Objective cell will be
maximized. The green Decision Variable cells are binary and indicate
whether or not a particular Year 1 or Year 2 investment opportunity has
been chosen.
We can now display only the annuals projected cash flows that are
connected with selected investments. This can be done very efficiently in
Excel with an If-Then-Else statement.
The end result of using If-Then-Else statements is shown as follows.
Each of the cells in the following spreadsheet portion contains an IfThen-Else statement. Each of these If-Then-Else statements copies the
cash flow from the same location in the list of all projected cash flows
above only if that respective opportunity has been selected.
In other words, the cash flow will be copied down only if the Decision
Variable cell for that investment opportunity contains a 1, meaning that
investment has been selected.
For example, in cell C31 of the Excel model in the preceding image is
the following If-Then-Else code:
=if($C$17=1,C5, )
This Excel statement copies the cash flow from C5 into C31 only
Decision Variable cell C17 is set to 1, which indicates that this
investment has been selected.
This formula is copied from Cell 31 into all cells down and over to Cell
C36. Note that Cell $C$17 is made to be an absolute reference because
of the dollar signs. All of the copied formulas from cell C31 to Cell C36
will depend on whether Cell C17 contains a 1 or a 0.
The formula is also copied over and down to Cell I36. In each column,
the absolute reference is move over. For example, all Cells from D31 to
D36 now have absolute references on the Cell $D$17. Take a look at the
contents of those cells in the downloadable spreadsheet containing this
example. This concept is probably easier to understand when scrolling
through the actual Excel spreadsheet.
If this investment was not selected, its Decision Variable cell C17 would
be set to 0 and nothing ( ) would be copied into cell C31. In this way,
only cash flows of selected investment appear once again in the
following image:
All annual cash flows for the selected investments are summed up in the
right column in Cells I31 to I36 as just shown.
These combined cash flows are copied back into the right side (Cell I31
to I36 are copied into I17 to I22) of the spreadsheet section containing
the Decision Variable cells shown as follows:
The user can change the Discount Rate here and watch the spreadsheet
calculations immediately change to reflect the new Discount Rate. The
greater the Discount Rate, the greater that the investment risk is
believed to be and the lower will be the NPV of the cash flows at Year 0
of the selected investments.
The PV and NPV calculations are performed on these cash flow figures
to attain the Objective, which is the NPV at Year 0 of all projected cash
flows of all selected investments.
All equations on the Excel spreadsheet are linear (1st order) so we can
use the Simplex LP (Linear Programming) Solver engine for this
optimization problem.
Step 3 shows the completed problem with Decision Variables that have
been optimized by the Solver to maximize the Objective while staying
within the problems Constraints.
Answer Report
Part 1
Note:
-
Part 2
-
Part 3
-
The Problem
4 factories within 1 company obtain the same raw material Product
A from 4 different outside suppliers. Each of the 4 suppliers
provides a different per unit purchase price for Product A. Per unit
shipping costs also vary greatly between each of the 4 suppliers
and each of the 4 factories. Each of the 4 factories requires a
different amount of Product A and each of the 4 suppliers has a
different amount of Product A available. Determine the optimal
amounts of Product A to purchase and ship between each supplier
and each factory in order to minimize total purchase and shipping
cost.
The total number of units shipped from each supplier and the number of
units shipped from each supplier to each factory are used to used to
calculate total purchase and shipping costs from all suppliers. These
calculations once again are shown as follows:
The total cost of purchasing from all suppliers and the total cost of
shipping from all suppliers is shown in the preceding image. These 2
costs are added together to create the Total Cost, which is shown in the
yellow Objective cell G38.
These light blue cells are user-controlled inputs and connect with the
light blue Constraint cells in the Excel model. These user-controlled
inputs determine how large each factorys order is and how many units
each supplier has available to ship.
All equations on the Excel spreadsheet are linear (1st order) so we can
use the Simplex LP (Linear Programming) method for this optimization
problem.
Step 3 shows the completed problem with Decision Variables that have
been optimized by the Solver to minimize the Objective while staying
within the problems Constraints.
Answer Report
Part 1
Note:
-
Part 2
-
Part 3
-
The Problem
A traveling salesman living in Chicago must make stops in these 4
other cities: LA, Denver, Boston, and Dallas. He must start and
finish in his home city of Chicago. He must select the order of
customers to visit that will minimize the total length of the trip.
Below is the specific information about the distances between each
of the 5 cities:
and the previous city of Chicago is 1205 miles. The distance between
Denver and the previous city of Dallas is 801 miles. The distance
between LA and the previous city of Denver is 1174.
Distances between each city and its previous city are found by using the
Index function. This function looks up in the Distances chart and locates
and displays the distance between a city and its previously visited city.
The distances shown in Column E are as follows:
The distance between Boston and the previous city of LA is 3036 miles.
The distance between Chicago and the previous city of Boston is 983
miles.
The distance between Dallas and the previous city of Chicago is 1205
miles.
The distance between Denver and the previous city of Dallas is 801
miles.
The distance between LA and the previous city of Denver is 1174.
The Excel Index functions which generated each of these distances are
shown to the right of each distance. An explanation of this use of the
Index function is as follows:
The Index function has the following syntax:
=INDEX(range, row number, column number)
For the above formula, the range is the cells from C3 to G7. This cell
range holds the distances in the Distance Chart.
The row number corresponds to the previous city visited. This row
number is the previous citys row number in the Distance chart.
The column number corresponds to the current city. This column
The following Solver Dialogue box shows the set of 5 Decision Variables
(Cells C10 to C14) subject collectively to the Alldifferent Constraint.
Following are views of the Excel model before solving and then after
solving with Excel Solvers Evolutionary method:
Answer Report
Part 1
Note:
- The Solver Result
- How long Solver took to solve the problem (especially
important in this case This time could be reduced by several of
the Options settings.)
- The Solver Engine that was used and the Solver Options settings
- Where the Objective Cell was labeled in the Excel model for its
name to appear as it does in Part 1 of the Answer Report
Note the solution time of 164 seconds. This could have been reduced by
limiting the maximum allowable run time, iterations, or subproblems
using the Options menu.
Part 3 - Constraints
-
Note that Cells C10 to C14 were set to AllDiff simultaneously as a group.
Population Report
The Population Report is made available when the Evolutionary method
is used. The Population Report provides indication about whether and
how you can make improvements to the model or to the Evolutionary
method Options
The Population Report can be valuable if successive runs of the
Evolutionary method produce different answers for the Objective. The
setting of the Mean Value and Standard Deviation during successive
runs provide insight into whether your successive solutions are getting
closer to the most optimal solution. See the section on a detail
description of this report for more information about this topic.
6700
7500
8700
8900
8800
10900
11200
11400
11500
12300
Here is an Excel scatter plot of this actual sales data:
We would like to create an equation from this data that will allow us to
predict the sales based upon the number of ads run in the previous
week.
The first step is to eyeball the data and estimate what general type of
curve these data points most likely fit to. In this case the data points
appear to a graph the has a diminishing y value for an increasing x
value. The formula for such a curve would have this general form:
Y = A1 + A2 * XB1
Sales = A1 + A2 * (Number of Ads Running)B1
We can use the Excel Solver to solve for A1, A2, and B1. We need to
arrange the data in this format as inputs into the Excel Solver as follows:
The preceding image shows the Excel model after it has already been
solved. By solved, we mean in this case that the Solver has calculated
the Decision Variable values (in the green cells B3 to B5) that minimize
the Objective.
This table shows the arrangement of data and the calculations. Here we
have created an Excel model based upon our model of:
Sales = A1 + A2 * (Number of Ads Running)B1
One example of this formula in action is explained for Cell E12. We are
listing the variable that we are solving for (A1, A2, and B1) in cells B3 to
B5. In Solver language, these solves that we are changing are called
Decision Variables.
We now take the difference between the actual number of sales and the
number of sales predicted by our model with our arbitrary settings for the
Decision Variables. The square of each difference is taken and then all
squares are summed up in the yellow Objective Cell C14.
We are trying to find the settings for the Decision Variables that will
minimize the sum of the squares of the differences. In other words, we
are trying to find A1, A2, and B1 that will minimize the number in cell
G14.
Bring up the Excel Solver and the following blank Solver dialogue box
comes up:
The Solver dialogue box has the following 4 parameters that need
to be set:
1) The Objective Cell This is the target cell that we are either
trying to maximize, minimize, or achieve a certain value.
Once again, here is the data table for Solver inputs as follows:
Objective:
We are trying to minimize yellow Objective Cell G14, the sum of the
square of differences between the actual and predicted sales.
Decision Variables:
We are changing A1, A2, and B1 (green cells B3 to B5) to minimize the
Objective Cell G14. The Decision Variables are therefore Cells B3 to B5.
Constraints:
There are none for this curve-fitting operation.
These functions have graphs that are curved (nonlinear), but have no
breaks (smooth)
If we now hit the Solve button, we get the following result, which in this
case is the set of Decision Variables that minimize the Objective:
We actually ran Solver twice to obtain this result. Often the GRG
Nonlinear method will produce different solutions on successive Solver
runs. The result of each run GRG Nonlinear run on a nonlinear problem
depends on the starting point that the Solver selects. It is often a good
idea to run the GRG Nonlinear method several times in a row to find the
most optimal solution.
We can now create an Excel graph of the Actual Sales vs. the Predicted
Sales as follows:
The trickiest part of this problem is the first step; eyeballing the
data to determine what kind of graph the data is arranged in. You
should take time to evaluate whether you are pursuing calculation of the
correct curve type.
Solver Tips
You may notice that if you run this problem through the Solver multiple
time, you will get slightly different answers. Each time that you run
Solvers GRG algorithm, it will calculate different values for the Decision
Variables. You are trying to find the values for the Decision Variables
that minimize the objective function (cell G14) the most.
When the Solver runs the GRG algorithm, it picks a starting point for its
calculations. Each time you run the Solver GRG method a slightly
different starting point will be picked. That is why different answers will
appear during each run. Choose the Decision Variable value that occurs
during the run which produces the lowest value of the Objective. Keep
running the Solver until the objective is not minimized anymore. That
should give you the optimal values of the Decision Variables. That was
done in the example above.
Summary
Excel Solver is an easy-to-use and powerful nonlinear regression tool as
a result of its curve-fitting capacity. One use of this is to calculate
predictive sales equations for your company. It will work as long as you
have properly determined the correct general curve type in the
beginning.