You are on page 1of 44

Business

Analytics
Session 3
Optimization
Sebastian del Bano Rollin
London Business School

Premature optimization is the root of all evil


― Donald Knuth, Computer Scientist

london.edu

Optimization

What is optimization?

london.edu CM24 Business Analytics – Sebastian del Bano Rollin 2


What is Optimization?
Maximizing or minimizing something

• Optimization refers to situations where we have one single numerical


outcome (e.g. a profit number) that depends on several variables (tax,
margin, costs, income,…) some of which we can vary (e.g. the split
between different product types).
• The objective is to find the optimal choice of variables that will yield
the best outcome.
• Optimal means either maximum or minimum
• Often we have to additionally satisfy some constraints (more later).

london.edu CM24 Business Analytics – Sebastian del Bano Rollin 3

What is Optimization?
You can only optimize a single number!

One trivial remark but that is not always understood by your boss is:
• You can only optimize one number.
• But not two or more. E.g. you cannot optimize both revenue and
work hours at the same time.
“Profound” mathematical reason is that
the numbers are ‘ordered’, but the
points in a plane are not.

london.edu CM24 Business Analytics – Sebastian del Bano Rollin 4


Why learn about optimization?

• Optimization comes up in innumerable business problems but mostly


under the guise of resource allocation.
• The variables in the problem will be the numbers describing our
allocation of resources.
• Contexts in which this can appear:
• Finance (capital budgeting, portfolio management, ...)
• Electricity markets (maximise profit, ...)
• Operations Management (scheduling, supply chain management, ...)
• Marketing (setting optimal advertising levels, ...)
• Management Accounting (supplier selection, ...)
• Revenue/ Yield Management

london.edu CM24 Business Analytics – Sebastian del Bano Rollin 5

Optimization

The technology tool:


Solver Add-in in Excel

london.edu CM24 Business Analytics – Sebastian del Bano Rollin 6


The tool: Excel

The technological tool we will use today will be Excel

london.edu CM24 Business Analytics – Sebastian del Bano Rollin 7

The tool: Excel


Excel Solver Add-ini

We will use the Solver Add-in which is built-in Excel but needs to be
activated.
To do so, in Windows, do File->
Options->Manage->Excel Add-ins->
Go and select Solver
Add-In.

london.edu CM24 Business Analytics – Sebastian del Bano Rollin 8


The tool: Excel
Excel Solver Add-ini

You will see it at the end of the Data ribbon:

On a Mac you just need to click on the Tools->Excel Add-Ins menu


item on the top bar

london.edu CM24 Business Analytics – Sebastian del Bano Rollin 9

Optimization

Linear Optimization Problems

london.edu CM24 Business Analytics – Sebastian del Bano Rollin 10


Anatomy of an optimization problem
Decision variables, constraints, and output

Optimization models answer the question, “Given some constraints,


what decision values give the best outputs?”
Optimization models are necessary because resources are always
limited, these limitations are encoded in the constraints.
EXTERNAL OUTPUT
INPUTS

MODEL

CONSTRAINTS DECISION
VARIABLES

london.edu CM24 Business Analytics – Sebastian del Bano Rollin 11

Anatomy of an optimization problem


Building the model

A substantial part of the task is often building the model and


establishing what is the output to optimize and what are the decision
variables.
This involves ‘extracting’ the problem of any irrelevant details. This is
the original meaning of the word ‘abstract’. Often this means writing
maths or Excel. EXTERNAL ?
OUTPUT?
INPUTS ?

MODEL?
?
?
CONSTRAINTS ? DECISION
VARIABLES ?
london.edu ?
CM24 Business Analytics – Sebastian del Bano Rollin 12
Anatomy of an optimization problem
Linear optimization

Linear programming is a special type of optimization model that sets


up constraints as linear equations and solves them simultaneously while
optimizing an objective function.

DECISION
CONSTRAINTS OUTPUT
INPUTS MODEL
(objective
2x + 6y < 150 x function)
x + .8y < 40 10x + 18y
x + 1.5y < 50 y Maximize
10x + 18y

london.edu CM24 Business Analytics – Sebastian del Bano Rollin 13

Linear equations, is this not trivial?


Well, no.

• It would seem that anything involving linear equations should be


trivial, as we know how to solve these from high school, right?
• But the constraints make things a messier .
• With only a couple of variables, we can draw pictures and guess a
solution (we will do so soon).
• But in real world things get much scarier with linear problems
involving hundreds of variables. Linear programming was
developed as part of the war effort in USSR and USA in the forties.

london.edu CM24 Business Analytics – Sebastian del Bano Rollin 14


Optimization

First example –
Doing things by hand

london.edu CM24 Business Analytics – Sebastian del Bano Rollin 15

First example: What to produce?

• Bob manufactures 2 types of mufflers: family and


sport. Each family muffler nets him $10 and each
sport muffler $18. These numbers are known as the
products’ contribution margin.
• His profit function is $10f + $18s where f and s are the total number
of each type of muffler sold. This is his objective function.
• His decision variables are the number of family (f) and sport (s)
mufflers to manufacture each month.
• In an unconstrained situation, he would want to sell as many sport
mufflers as because of their higher contribution.
However…
london.edu CM24 Business Analytics – Sebastian del Bano Rollin 16
First example: What to produce?

In order to create a muffler, he must use


brackets, labour hours, and alloy. The Family Sports
resources needed for each type are: Brackets 2 6
Labour Hours 1 0.8
Alloy 1 1.5
In any given month, he is limited to 150 Brackets, 40 Labour hours and
50 Alloy units. These constraints can be modelled as a system of linear
inequalities:
2f + 6s ≤ 150 (brackets)
f + .8s ≤ 40 (labour)
f + 1.5s ≤ 50 (alloy)
london.edu CM24 Business Analytics – Sebastian del Bano Rollin 17

First example: What to produce?

Additionally:
He has a contract that forces him to manufacture 5 sports mufflers per
month and knows, from historical performance, that demand for family
mufflers in a given month will not exceed 35. These constraints can be
modelled as:

f ≤ 35 (maximum demand)
s≥ 5 (contractual obligation)

london.edu CM24 Business Analytics – Sebastian del Bano Rollin 18


Describing the problem on a chart

In order to help us understand the variability in this problem we plot each


possible choice of quantities of family and sports mufflers in a plane
30

25

20
Sports

15

10

0
0 10 20 30 40 50 60 70 80
Family

Each dot here represents a choice of quantity of family/sports mufflers.

london.edu CM24 Business Analytics – Sebastian del Bano Rollin 19

Describing the problem on a chart

For example, the constraint on # of brackets 2f+6s≤150 can be


represented as the set of points below or on the line of this equation
30

25
2f+6s>150
20
Sports

15

10
2f+6s<150
5 2f+6s=150
0
0 10 20 30 40 50 60 70 80
Family

So we should only consider points below or on this line.

london.edu CM24 Business Analytics – Sebastian del Bano Rollin 20


Describing the problem on a chart
The feasible region

Terminology: the feasible region is the set of values that satisfy our
constraints. If we only consider the brackets constraint, this is the blue
region below:

Points outside of the blue region are unfeasible as they use more than
the 150 brackets available.
london.edu CM24 Business Analytics – Sebastian del Bano Rollin 21

Describing the problem on a chart


Plotting all the constraints

The rest of the constraints can be added in a similar fashion:

2f + 6s ≤ 150 (brackets)
f + 0.8s ≤ 40 (labour)
f + 1.5s ≤ 50 (alloy)
f ≤ 35 (maximum demand)
s ≥5 (contractual obligation)

london.edu CM24 Business Analytics – Sebastian del Bano Rollin 22


Describing the problem on a chart
The feasible region

The feasible region for the model is the yellow region enclosed by all
lines:

2f + 6s ≤ 150 (brackets)
f + 0.8s ≤ 40 (labour)
f + 1.5s ≤ 50 (alloy)
f ≤ 35 (maximum demand)
s ≥5 (contractual obligation)

london.edu CM24 Business Analytics – Sebastian del Bano Rollin 23

Describing the problem on a chart


Got the constraints – What to do next?

Great! These are all the possible combinations of sports/family mufflers


that we are allowed to produce.
Which should be chose?
• The one which the largest profit.
• So we need to visualise the profit for
each of these combinations of
sports/family mufflers. How to do this?

london.edu CM24 Business Analytics – Sebastian del Bano Rollin 24


Describing the problem on a chart
Plotting the profit

• Recall the profit was $10f+$18s.


• The points with $10f+$18s=$100 will form a line: the line of all (f,s)
with profit $100.
• We can do this with other numbers
and obtain the isoprofit lines.
• These are all lines with the same
slope -5/9, the ratio between the
contribution margin of family to
sports mufflers.
Total Profit: $100 $190 $280 $370 $460 $550

london.edu CM24 Business Analytics – Sebastian del Bano Rollin 25

Putting it all together


Plotting profit alongside constraints

• By combining the profit lines with the


feasible region, you can identify the
highest profit line that touches a
feasible point

Optimal
The optimal point is a mix of 25 point
family mufflers and 16.67 sport
mufflers. This combination will
net Bob $550.

london.edu CM24 Business Analytics – Sebastian del Bano Rollin 26


Great, so we know how to solve these problems
Job done. Can I go home?

• We have been able to solve this problem visually because it uses


only two decision variables.
• In practice these types of problems often involve thousands of
variables and so if is impossible to plot this in Excel.
• For dimensions greater than 2 all this gets much more complicated
and we need more sophisticated algorithms.
• The most famous one is called the Simplex Method devised by
George Dantzig in the ‘40s whilst working for the US Air Force.
• It works when objective function and constraints are linear.
Excel can deal with these problems!
london.edu CM24 Business Analytics – Sebastian del Bano Rollin 27

Optimization

First example –
Using Excel Solver

london.edu CM24 Business Analytics – Sebastian del Bano Rollin 28


Using the Excel Solver Add-in

We will now solve the same problem


using Excel Solver.
For this you will go to the Data tab and
hit on Solver at the end of the ribbon.
You will get a dialog box as seen
But before we can use it we need to
set up a spreadsheet describing the
problem.

london.edu CM24 Business Analytics – Sebastian del Bano Rollin 29

Information needed by the Excel Solver

• Objective cell: One cell, the objective cell, contains the value of the objective. Solver varies the
values in the changing cells to optimize the value in the objective cell. This cell must be linked,
either directly or indirectly, to the changing cells by formulas.#
• Minimize or Maximize?: In our example we are maximizing profit
• Changing cells: Instead of using variable names, such as x, spreadsheet models use a set of
designated cells for the decision variables. The values in these cells can be changed to optimize
the objective. The values must be allowed to vary, so there should not be any formulas in them.
• Constraints. Excel does not show the constraints directly on the spreadsheet. Instead, they are
specified in a Solver dialog box. For example, a set of related constraints might be specified by,
e.g., B16:C16<=B18:C18
• Non-negativity. Normally, the decision variables –the values in the changing cells – must be non-
negative. Simply check an option in the Solver dialog box.
• Inputs. You might have other numerical inputs that are part of the calculations. These should be
clearly labelled in Excel but they are not needed by the Solver.
london.edu CM24 Business Analytics – Sebastian del Bano Rollin 30
• Solving Method: Choose LP Simplex
Sample Excel model

Contribution Margins Available resources

Resources needed for each


type of muffler
Contract
Maximum demand Profit

Decisions: How many of each


muffler to make.
Use trial values to start.

london.edu CM24 Business Analytics – Sebastian del Bano Rollin 31


Modeled constraints

Sample Excel model


The objective

The core of this sheet is

• Here we codify in the profit cell (green) 10 times the number of


family mufflers plus 18 times the quantity of Sports ones.
• The numbers 1 and 1 are just ‘starting values’ which Excel will
change when it searches for the best choice.
• The rest of the sheet codifies the restrictions and other numbers
involved in the calculations.
london.edu CM24 Business Analytics – Sebastian del Bano Rollin 32
Using the Solver

We next tell Excel to find the best


values for Family and Sports.
We select the profit cell and hit on
Solver under the Data tab.
Objective function (profit)

Decision variables

Constraints

london.edu CM24 Business Analytics – Sebastian del Bano Rollin 33

Using the Solver

Solver found the solution


(it is the same as we had
got by hand ☺)

We can also ask Excel to


display optimization
reports.

london.edu CM24 Business Analytics – Sebastian del Bano Rollin 34


Solver additional reports

These (optional) additional reports appear as new worksheets

london.edu CM24 Business Analytics – Sebastian del Bano Rollin 35

The Answer Report


Contains the solution and information about constraints

• dd This is the solution:


• The maximum profit
• The allocation that achieves this profit

Slack is the amount of unused resources


when we did not hit this constraint.
The constraint is not binding.
There are 1.67 labour hours left over, or slack.

Total resources used in the Binding means we hit that constraint.


optimal solution All available resources are used. Slack = 0
london.edu CM24 Business Analytics – Sebastian del Bano Rollin 36
The Sensitivity Report
What is sensitivity?

Sensitivity, in general refers to what happens when you change the


conditions of your problem
• What happens is we increase revenue per sports muffler?
• What happens if we have more hours available?
Will the overall profit increase?
• sometimes (e.g. if we increase the number of labour hours available) there will
be no change.
• but sometimes (e.g. if we increase the number of brackets available) then we
might increase production.

london.edu CM24 Business Analytics – Sebastian del Bano Rollin 37

The Sensitivity Report


Sensitivity to coefficients – Sensitivity to constraints

The sensitivity report contains two sections:


• The top section is for sensitivity to changes in the coefficients.
In our case this is the profit per type of muffler.
Each row in this section indicates how the optimal solution changes if
one of these coefficients changes.
• The bottom section is for sensitivity to changes in the constraints.
In our case this is the available resources and the demand
constraints.
Each row in this section indicates how the optimal solution changes if
one of these availabilities changes.

london.edu CM24 Business Analytics – Sebastian del Bano Rollin 38


The Sensitivity Report
Sensitivity to coefficients – the price of mufflers

• The first column, Final Value, is the amount of mufflers of each type we should produce.
• The third column, Objective Coefficient, is the profit per muffler, this is what we have set in Excel.
• The last two columns, Allowable increase/decrease, indicate how much you can change the
profit per muffler without affecting the optimal mix
• Family mufflers have a contribution of $10: this is how much money we make by selling a family muffler. If the
contribution of family mufflers stays within the allowable increase of $2 or allowable decrease of $4, or in other words
between 10-4=$6 and 10+2 =$12, the optimal mix would not change.

• Reduced cost only refers to variables where the Final Value is 0. I.e. they were not selected in
the mix. E.g. if they did not result in sufficient profit. Reduced cost will be the improvement in
profit that would result in the item being added in the optimal mix. In the example, Reduced Cost is
0 as both mufflers are included in the optimal mix. More on this later.
london.edu CM24 Business Analytics – Sebastian del Bano Rollin 39

The Sensitivity Report


Sensitivity to constraints – changing the demand and resource availability

• The first column, Final value is the value the constraint hit in the
optimal mix.
• The third column, Constraint R.H. Side, is the limit constraint value
we have provided. (R.H. Side means right hand side of an inequality)
• For binding constraints we have that these two coincide, as we have
hit the limit.
• Bracket and alloy
constraints are binding.
• None other constraint is
binding.

london.edu CM24 Business Analytics – Sebastian del Bano Rollin 40


The Sensitivity Report
Sensitivity to constraints – changing the demand and resource availability

• For a binding constraint it might be possible to increase profit by lifting


the constraint limit.
• E.g. increasing the amount of Alloy units available we might increase
profit.
• By how much? That is what Shadow Price means. In 2nd column.
• If we have 51 units of
alloy available
instead of 50,
we are able to make
an additional $8
profit.

london.edu CM24 Business Analytics – Sebastian del Bano Rollin 41

The Sensitivity Report


Sensitivity to constraints – changing the demand and resource availability

• Is this available shadow price valid forever? If so I’ll increase Alloy


available by 1,000,000 and make an extra 8,000,000$, right?
• Nope! It is only valid between the limits indicated in columns 4 and 5

london.edu CM24 Business Analytics – Sebastian del Bano Rollin 42


Setting up a LP problem

By far the most challenging aspect of solving these


types of problems is understanding the logic and setting
it up correctly in Excel.

After that, it is just a matter of clicking and


understanding output.
Business problems tend to be clouded by clutter of
irrelevant information that you need to cut through.
Also, it is important that your Excel model follows a
certain standard structure, with decision variables,
output and constraints clearly described.

london.edu CM24 Business Analytics – Sebastian del Bano Rollin 43

Optimization

A Larger Product Mix Problem


PC Manufacturing

london.edu CM24 Business Analytics – Sebastian del Bano Rollin 44


A Larger Product Mix Problem
You cannot draw this any longer 

Instead of two models, suppose we now produce have eight different PC


models
• There are two lines for testing; first line is faster and with higher labour
costs. A computer can be tested in either line and we have a certain
number of hours available per line.
Objective:
Maximise profit subject
to available labour
hours and maximum
sales.

london.edu CM24 Business Analytics – Sebastian del Bano Rollin 45

A Larger Product Mix Problem


Red=decision variables, Green=constraint LHS, Blue=constraint RHS, Bright Green=Objective

• dd

london.edu CM24 Business Analytics – Sebastian del Bano Rollin 46


Excel Solver
Use named cells and ranges!

Note that we have named cells/ranges


You can do this by selecting a
cell/range and then typing a name in
the name box

Named cells/ranges are a must in a professional


spreadsheet.
It is hard to maintain/debug a sheet full of H43:B6’s,
etc
london.edu CM24 Business Analytics – Sebastian del Bano Rollin 47

Remember

• Reduced Cost: The deterioration in the objective function if we force one unit of a
sub-optimal activity (zero level) into the optimal solution. Alternatively, the amount
by which we need to improve the contribution of sub-optimal activities before they
could enter the optimal solution on their own merit.
• Shadow Price: The amount by which the objective value will improve if we relax
the constraint by one unit. It is the most we are willing to pay to obtain an
additional unit of that resource.
Sensitivity analysis show what happens when a single input changes and all others
remain constant. Another way to do sensitivity analysis is to change the inputs and
re-run Solver. This is more straightforward, but can be tedious if there are a lot of
inputs. This “trial and error” approach allows multiple changes in inputs.
Can you think what these numbers will indicate in the business problem at
hand?
london.edu CM24 Business Analytics – Sebastian del Bano Rollin 48
Interpret shadow prices and reduced cost
What do the numbers mean?

Question:
• What is special about the decision variables with non-zero reduced cost?
• What is special about the lines with non-zero shadow price?
• Interpret numbers in yellow and green.

london.edu CM24 Business Analytics – Sebastian del Bano Rollin 49

Reduced Cost review


For something not in the optimal mix: how much better should its contribution be?

A reduced cost for a product not in the optimal mix (yellow cells)
indicates how much greater its margin would have to be before it would
enter the optimal mix.
Number tested on line 1 Model 2 has a
reduced cost of -20 and a Final Value of 0,
i.e., we are not producing any at all. We can
think of the reduced cost of -20 in two ways:
• Our profit would reduce by $20 if we are forced
to produce a model 2 which is tested on line
1.

• Currently, the objective coefficient of this model


is $132, and we are not producing any as it is not
optimal. Were the contribution to increase by
$20 to $132 + $20 = $152, then it would be
worthwhile.

london.edu CM24 Business Analytics – Sebastian del Bano Rollin 50


Shadow Price Review
For something where we hit a constraint: how much could we gain by lifting constraint 1 unit?

A nonzero shadow price (green cells) indicates how much profit would
change for a one-unit increase in that constraint. But this holds only for
changes within the allowable increase and decrease.
Labour hours for assembly has a shadow price = 29.50$. As long as the
number of assembly hours is between 20,000-2,375 and 20,000+3,250,
then any change in
assembly hours will
impact profit by 29.50$.
A zero shadow price
usually indicates that
we have more of the
resource than we need.
london.edu CM24 Business Analytics – Sebastian del Bano Rollin 51

Optimization

Red Brand Canners


A study in optimal mix and business confusion

london.edu CM24 Business Analytics – Sebastian del Bano Rollin 52


Red Brand Canners

Canner and distributor of fruits and vegetables


in West USA.
Starring executives:
• Mitchell Gordon, VP of operations
• William Cooper, Controller
• Charles Myers, Sales manager
• Dan Tucker, Production manager

Meeting:
• tomato crop has already been paid for and was beginning to arrive
• amount of tomato products to pack for the coming season?
•london.edu
packing operations start MondayCM24 Business Analytics – Sebastian del Bano Rollin 53

What to do with our tomatoes?


Product Selling Price per Case Demand Forecast (Cases)
Whole Tomatoes $ 12.00 800,000
Supply (Tucker) Tomato Juice $ 13.50 50,000
Tomato Paste $ 11.40 80,000
• quantity: 3,000,000 pounds (lbs)
• quality: 20% grade A (600,000 lbs), 80% grade B (2,400,000 lbs)
• 18 cents / pound
Demand forecasts (Myers)
• “Selling prices are set in light of the long-term marketing strategy of the company,
potential sales are forecast at these prices”
• “We can sell all the whole tomatoes we can produce.”
• “Demand for tomato juice and paste is limited”

london.edu CM24 Business Analytics – Sebastian del Bano Rollin 54


What to do with our tomatoes?
Sell all as canned tomatoes!

Profit contributions (Cooper)


• Incremental profit is greatest for
whole tomatoes
• Let us sell all 3m pounds as canned
whole tomatoes!

london.edu CM24 Business Analytics – Sebastian del Bano Rollin 55

Quality

Quality requirements (Tucker)


• “Impossible to produce all whole tomatoes because too small portion of the crop is grade A”
• RBC quality scale: 0 (low quality) - 10 (high quality)
• Tomatoes
• grade A 9 points
• grade B 5 points
• Product quality requirements
• whole canned tomatoes 8 points
• tomato juice 6 points
• tomato paste 5 points
• Conclusion: “Whole tomato production is limited to 800,000 pounds”

• Extra supply (Gordon)


• “Additional 80,000 pounds grade A tomatoes available at 25.50 cents per pound”
london.edu CM24 Business Analytics – Sebastian del Bano Rollin 56
Quality

Tucker proposes:
• Use all grade A to sell whole tomatoes
• Can place all existing 600,000 pounds grade A (9 points) plus 200,000 grade B
(5 points) which results in a mix of (600,000*9+200,000*5)/800,000=8 points
• These 800,000 lbs make 44,444 cases.
• And the rest (2,200,000 lbs) sell as paste (5 points).
• This translates into 110,000 cases. But there is a cap on 80,000 cases of paste.

london.edu CM24 Business Analytics – Sebastian del Bano Rollin 57

Myer’s Proposal
Let us set an internal price for grade A vs grade B tomatoes

Myers questions the fruit expense numbers above as each product quality
requirements implies a different cost of fruit
• So could use a price proportional to the required quality of fruit to build this in
• So if 1 pound of quality A holds 9 points, and 1 pound of quality B 5 points
• Then our whole stock of 600k lbs quality A and 2.4m lbs quality B holds 17.4 m
points. And each point is worth $540k/17.4m = 3.10 cents
• And one pound of point 8 whole tomato for canning should be worth 8*3.10 = 24.85 cents
($4.47 per case).
• One pound of point 6 tomato for juice 18.64 cents ($3.72 per case).
• One pound of point 5 tomato for paste 15.53 cents ($3.90 per case).

london.edu CM24 Business Analytics – Sebastian del Bano Rollin 58


Myer’s Proposal

This results in revised contribution


calculations
As a result tomato paste seems more
profitable followed by juice.
Myer recommends:
• Use 2m lbs of grade B tomatoes to make 80,000 cases of paste
• Use remaining 400,000 lbs of grade B and the 600,000 lbs of grade A
to make 50,000 cases of juice.

london.edu CM24 Business Analytics – Sebastian del Bano Rollin 59

Myer’s Proposal

The rationale here is not very sound.


The tomatoes have already been purchased, surely penalising a product
for using premium tomatoes is not relevant if the expense has already
been made.
Tomato cost is a sunk cost.
We must disregard any sunk costs in decision making.

london.edu CM24 Business Analytics – Sebastian del Bano Rollin 60


Omit Sunk Cost

In view of this, the right thing to do is to disregard the cost of fruit

We will now convert this into a linear programming problem.

london.edu CM24 Business Analytics – Sebastian del Bano Rollin 61

The Linear Programming Solution

The variables we will consider are the thousand pounds invested for
each product from each of
the two quality grades: AW,
AJ, AP, BW, BJ, and BP.

london.edu CM24 Business Analytics – Sebastian del Bano Rollin 62


The Linear Programming Solution

Maximise profit contribution


Subject to
Demand Constraints
Supply Constraints
Quality Constraints
Maximise 247AW + 198AJ + 222AP + 247BW + 198BJ + 222BP
Subject to
AW + BW ≤ 14,400 (thousand lbs in 800,000 cases)
AJ + BJ ≤ 1,000 (thousand lbs in 50,000 cases)
AP + BP ≤ 2,000 (thousand lbs in 80,000 cases)
AW + AJ + AP ≤ 600
BW + BJ + BP ≤ 2,400
9AW + 5BW ≥ 8(AW+BW)
london.edu 9AJ + 5BJ CM24 Business
≥ Analytics
6(AJ+BJ)
– Sebastian del Bano Rollin 63

The Linear Programming Solution

london.edu CM24 Business Analytics – Sebastian del Bano Rollin 64


How do the solutions differ?

london.edu CM24 Business Analytics – Sebastian del Bano Rollin 65

RBC – Sensitivity Analysis

Should we buy extra 80,000 extra lbs of Grade A tomatoes at 25.5 c (0.255)/lb?

london.edu CM24 Business Analytics – Sebastian del Bano Rollin 66


RBC – Sensitivity Analysis

Should we buy extra 80,000 extra lbs of Grade A tomatoes at 25.5 c (0.255)/lb?

• The shadow price is the increase in the objective if we increase the right-hand side of the corresponding
constraint by 1 unit.
• Shadow price of “Tomato A Pounds Used” (grade A supply constraint): $271 (/1000 pounds)
• We should be willing to pay up to $0.271/lb of grade A tomatoes. This is true for up to an additional 9.13m lbs
grade A tomatoes (“Allowable Increase”), beyond that the value of extra A tomatoes may be less.
• We should buy the 80,000 extra pounds at a price of $255/1000 pounds: net benefit = $271-$255 = $16/1000
pounds, $1,280 (=80*16) in total
london.edu CM24 Business Analytics – Sebastian del Bano Rollin 67

Optimization

Portfolio Optimization

london.edu CM24 Business Analytics – Sebastian del Bano Rollin 68


Combining Assets in a Portfolio

A portfolio consists of a holding of several securities.


Two typical measures of performance of a security are its % expected
return (or mean) and its standard deviation (which measures risk).
Say we have two securities expected returns of 7% and 11% Cash

If we consider a portfolio consisting of 50% of each security


then the mean of the portfolio is simply Fixed income (bonds)

1 1
7% + 11% = 9%
2 2 Equities (stocks)

What about the standard deviation?

london.edu CM24 Business Analytics – Sebastian del Bano Rollin -20% -10% 0% 10% 20%
69 30%

Combining Assets in a Portfolio


Expected return of a Portfolio

In more fancy language, if 𝑅1 is the (unknown, random) return of the first


security and 𝑅2 that of the second then the (unknown) return of the
1 1
portfolio is 𝑅1 + 𝑅2 .
2 2
Its expected return is:

1 1 1 1
𝐸 𝑅1 + 𝑅2 = 𝐸 𝑅1 + 𝐸 𝑅2
2 2 2 2

Which is what we had above: the return of the portfolio is just the
average return.
london.edu CM24 Business Analytics – Sebastian del Bano Rollin 70
Combining Assets in a Portfolio
Variability of a Portfolio: standard deviation and variance

What about variability?


Variability is measured by standard deviation of returns.
So what is the standard deviation of the returns in a 50%/50% portfolio?

The standard deviation is the square root of the variance.


The variance has a nicer behaviour when we add random variables.

london.edu CM24 Business Analytics – Sebastian del Bano Rollin 71

Combining Assets in a Portfolio


Variance of a Portfolio

The variance of a 50%/50% portfolio is


1 1
Var 𝑅1 + 𝑅2
2 2
2 2 2
1 1 1
= 𝑉𝑎𝑟 𝑅1 + 𝑉𝑎𝑟 𝑅2 + 2 𝐶𝑜𝑣𝑎𝑟 𝑅1 , 𝑅2
2 2 2

Covar is the covariance and it is equal to 𝑆𝐷 𝑅1 𝑆𝐷 𝑅2 𝐶𝑜𝑟𝑟𝑒𝑙(𝑅1 , 𝑅2 ) where SD is


the standard deviation. So can also write this as

2 2 2
1 1 1 1 1
𝑆𝐷2 𝑅1 + 𝑅2 = 𝑆𝐷2 𝑅1 + 𝑆𝐷2 𝑅2 + 2 𝑆𝐷 𝑅1 𝑆𝐷(𝑅2 )𝐶𝑜𝑟𝑟𝑒𝑙 𝑅1 , 𝑅2
london.edu
2 2 2 2
CM24 Business Analytics – Sebastian del Bano Rollin
2 72
Combining Assets in a Portfolio
Variance of a Portfolio

This means that the variance of our portfolio is:


2 2 2
1 1 1 1 1
𝑉𝑎𝑟 𝑅1 + 𝑅2 = 𝑉𝑎𝑟 𝑅1 + 𝑉𝑎𝑟 𝑅2 +2 𝑆𝐷 𝑅1 𝑆𝐷(𝑅2 )𝐶𝑜𝑟𝑟𝑒𝑙 𝑅1 , 𝑅2
2 2 2 2 2

If our portfolio is not 50%/50% but instead defined by two weights, 𝑤1 % and 𝑤2 %, we
just replace the 50%’s by relevant weights:

𝑆𝐷2 𝑤1 𝑅1 + 𝑤2 𝑅2 = 𝑤12 𝑉𝑎𝑟 𝑅1 + 𝑤22 𝑉𝑎𝑟 𝑅2 + 2𝑤1 𝑤2 𝑆𝐷 𝑅1 𝑆𝐷(𝑅2 )𝐶𝑜𝑟𝑟𝑒𝑙 𝑅1 , 𝑅2


What does this mean?
That the variance of a portfolio does not only depend on the variance of the
constituents, but also on their correlation.
Is this intuitive?
london.edu CM24 Business Analytics – Sebastian del Bano Rollin 73

Diversification: a short historical perspective


The fact that “de-correlating” one’s investments reduces risk has been known for a while

• In about the 4th century, Rabbi Issac bar Aha proposed the following rule for asset
allocation: “One should always divide his wealth into three parts: a third in land, a
third in merchandise, and a third ready to hand.”
Babylonian Talmud: Tractate Baba Mezi’a,
folio 42a.
• Markowitz (1952) derived the optimal rule for
allocating wealth across risky assets in a static
setting when investors care only about the
mean (return) and variance (risk) of a portfolio’s
return.

london.edu CM24 Business Analytics – Sebastian del Bano Rollin 74


Effect of correlation on portfolio risk

The expected return is always the weighted average of the two returns.
But the risk (volatility) depends on the correlation.
It is lowest when the correlation is negative and highest when the two assets are
perfectly correlated.

london.edu CM24 Business Analytics – Sebastian del Bano Rollin 75

Portfolio Optimization

We are going to see how to best pick portfolio allocations (the numbers
𝑤1 and 𝑤2 above)

You might consider as an objective: to maximize expected return and


minimise risk (variance of returns)

Is that right?

london.edu CM24 Business Analytics – Sebastian del Bano Rollin 76


Portfolio Optimization

Well, no.

You cannot optimise two numbers. 

Instead a general practice is to target a certain expected return, e,g.


12%), and with that constraint, minimise risk.

london.edu CM24 Business Analytics – Sebastian del Bano Rollin 77

Portfolio Optimization
An example

Stockco can invest in three different stocks. From past data, the means and SDs of
annual returns and correlations between annual returns have been estimated as
follows:
Mean SD Correlations
Stock 1 14% 20% Stocks 1 and 2 = 60%
Stock 2 11% 15% Stocks 1 and 3 = 40%
Stock 3 10% 8% Stocks 2 and 3 = 70%

Stockco wants to find a minimum variance portfolio that yields an expected annual
return of at least 12%

london.edu CM24 Business Analytics – Sebastian del Bano Rollin 78


Portfolio Optimization

• We want to determine the amounts to invest in each of several stocks:


𝑤1 , 𝑤2 , and 𝑤3 .
• The mean returns, SD of returns, and correlations between returns
are known
• We want the mean portfolio return to be 12% and the variance of the
return to be small

london.edu CM24 Business Analytics – Sebastian del Bano Rollin 79

Portfolio Optimization
A B C D E F G H I J

This sheet only contains the 1 Stockco Portfolio Problem


2
data for the problem: 3 Stock input data
4 Stock 1 Stock 2 Stock 3
5 Mean return 0.14 0.11 0.1
• Mean returns 6 StDev of return 0.2 0.15 0.08
7
8 Correlations
• StDevs 9 Stock 1 Stock 2 Stock 3 Enter any fractions here. Remember
10 Stock 1 1 0.6 0.4 that they are fractions of the total

• Correlations 11 Stock 2
12 Stock 3
0.6
0.4
1
0.7
0.7
1
invested, not dollar values. The ones
shown here are not optimal.
13

• Required expected portfolio 14 Investment decision


15 Stock 1 Stock 2 Stock 3 Total Required
return 16 Fractions to invest
17
0.3 0.3 0.4 1 = 1

18 Expected portfolio return Row sum


19 Actual Required
20 0.12
21
We have typed some invented 22 Standard deviations times fractions invested

portfolio fractions to be 23
24
Stock 1 Stock 2 Stock 3

optimized. 25
26 Portfolio variance
27
london.edu CM24 Business Analytics – Sebastian del Bano Rollin 80
28 Portfolio stdev
Portfolio Optimization
A B C D E F G H I J

In order to optimize we need 1 Stockco Portfolio Problem


2
3 Stock input data
• Portfolio return in cell B20 4
5 Mean return
Stock 1
0.14
Stock 2
0.11
Stock 3
0.1
6 StDev of return 0.2 0.15 0.08
• Portfolio variance in cell 7
8 Correlations
B26 9 Stock 1 Stock 2 Stock 3 Enter any fractions here. Remember
10 Stock 1 1 0.6 0.4 that they are fractions of the total
11 Stock 2 0.6 1 0.7 invested, not dollar values. The ones
12 Stock 3 0.4 0.7 1 shown here are not optimal.

Portfolio return is easy: 13


14 Investment decision
𝐸 𝑤1 𝑅1 + 𝑤2 𝑅2 + 𝑤3 𝑅3 = 15
16 Fractions to invest
Stock 1
0.3
Stock 2
0.3
Stock 3
0.4
Total
1 =
Required
1
17
𝑤1 𝐸 𝑅1 + 𝑤2 𝐸 𝑅2 +𝑤3 𝐸 𝑅3 18 Expected portfolio return Row sum
19 Actual Required
20 0.12
21

Or in Excel (in cell B20) 22 Standard deviations times fractions invested


23 Stock 1 Stock 2 Stock 3
24
25
26 Portfolio variance
27
london.edu CM24 Business Analytics – Sebastian del Bano Rollin 81
28 Portfolio stdev

Portfolio Optimization
Variance for a portfolio with 3 assets

Portfolio variance (the objective function which we wish to minimize) is a


bit more complicated. Basically a formula like

Var 𝑤1 𝑅1 + 𝑤2 𝑅2 = 𝑤12 𝑉𝑎𝑟 𝑅1 + 𝑤22 𝑉𝑎𝑟 𝑅2 + 2𝑤1 𝑤2 𝑆𝐷 𝑅1 𝑆𝐷(𝑅2 )𝐶𝑜𝑟𝑟𝑒𝑙 𝑅1 , 𝑅2

But with 3 instead of 2 variables.


This can be a bit of a pain.
Easier to do using matrices.

london.edu CM24 Business Analytics – Sebastian del Bano Rollin 82


Portfolio Optimization
Variance of a portfolio – standard notation

FYI, standard notation is


• 𝜎𝑖 : standard deviation of returns for i-th asset
• 𝜎𝑖2 : variance of returns for i-th asset
• 𝜚𝑖𝑗 : correlation between asset i and asset j
Formula above can be written as
2
𝜎𝑃𝑜𝑟𝑡𝑓𝑜𝑙𝑖𝑜 = 𝑤12 𝜎12 + 𝑤22 𝜎22 + 2𝑤1 𝑤2 𝜎1 𝜎2 𝜚12
If you’re into matrices this can also be written as
2 1 𝜚12 𝑤1 𝜎1
𝜎𝑃𝑜𝑟𝑡𝑓𝑜𝑙𝑖𝑜 = 𝑤1 𝜎1 , 𝑤2 𝜎2 𝑤2 𝜎2
𝜚12 1
london.edu CM24 Business Analytics – Sebastian del Bano Rollin 83

Portfolio Optimization
Portfolio variance with matrix multiplication

In our case we have 3 assets. You could write a very long formula like
the one above for the variance of the portfolio. But it is easier using
matrices:

1 𝜚12 𝜚13 𝑤1 𝜎1
2 𝜚12 1 𝜚23 𝑤2 𝜎2
𝜎𝑃𝑜𝑟𝑡𝑓𝑜𝑙𝑖𝑜 = 𝑤1 𝜎1 , 𝑤2 𝜎2 , 𝑤3 𝜎3
𝜚13 𝜚23 1 𝑤3 𝜎3

Which can be implemented in Excel as follows:


=MMULT(B24:D24,MMULT(B10:D12,TRANSPOSE(B24:D24)))
london.edu CM24 Business Analytics – Sebastian del Bano Rollin 84
Stockco Portfolio – Matrix Spreadsheet Model

To use the formula above we need A B C D E F G


to fill in the cells B24:D24 with 8 Correlations
9 Stock 1 Stock 2 Stock 3
weights times standard 10 Stock 1 1 0.6 0.4

deviations. 11 Stock 2
12 Stock 3
0.6
0.4
1
0.7
0.7
1
13
14 Investment decision
Then we are ready to go. 15
16 Fractions to invest
Stock 1
0.5
Stock 2
0
Stock 3
0.5
Total
1 =
Required
1
17
18 Expected portfolio return
Just run solver as usual and 19 Actual Required

minimize variance. 20
21
0.12 >= 0.12

22 Standard deviations times fractions invested


23 Stock 1 Stock 2 Stock 3
24 0.1 0 0.04
25
26 Portfolio variance 0.0148
Simpler formula, uses MMULT
27 and TRANSPOSE functions
28 Portfolio stdev 0.1217
london.edu CM24 Business Analytics – Sebastian del Bano Rollin 85
29

Stockco Portfolio - Solution

50% is invested in stock 1; 4


A B
Stock 1
C
Stock 2
D
Stock 3
E F G H

5 Mean return 0.14 0.11 0.1


6 StDev of return 0.2 0.15 0.08
the other half is in stock 3 7
8 Correlations
9 Stock 1 Stock 2 Stock 3

No money in stock 2 10
11
Stock 1
Stock 2
1
0.6
0.6
1
0.4
0.7
12 Stock 3 0.4 0.7 1
13
14 Investment decision
15 Stock 1 Stock 2 Stock 3 Total Required

The required 12% expected return is 16


17
Fractions to invest 0.5 0 0.5 1 = 1

This is the optimal solution

met exactly
18 Expected portfolio return
from the Solver.
19 Actual Required
20 0.12 >= 0.12
21
22 Standard deviations times fractions invested
23 Stock 1 Stock 2 Stock 3
24 0.1 0 0.04

The SD of the portfolio return (easier 25


26 Portfolio variance 0.0148

to interpret than variance) is about 27


28 Portfolio stdev 0.1217

12%
london.edu
29

CM24 Business Analytics – Sebastian del Bano Rollin 86


london.edu CM24 Business Analytics – Sebastian del Bano Rollin 87

You might also like