Professional Documents
Culture Documents
QBUS6820 HO Week 8 Stochastic Optimization
QBUS6820 HO Week 8 Stochastic Optimization
Stochastic optimization
Introduction
1
What we will do
Stochastic optimization
Fundamentals of optimization
2
Background on optimisation
Three key components: decision variables; feasible set
and objective function
What are the values for the decision variables x and y
that maximize the objective?
optimal contours of the
solution y objective
function are the
lines where there
Feasible are equal values
set X of the objective
How do we optimise?
There are a great variety of methods. Most look at a set of
already visited points at which the objective function is
evaluated
Then a ‘model’ is constructed to guess what the objective
function looks like
This is used to guide the selection of a new point which we
hope is better than those so far looked at.
The process is repeated: we call it “hill climbing”
This is how the non-linear optimisation in Excel solver
works
3
A one-dimensional example
Unknown actual
function 1 − 𝑥 − 1
local
minima
maximum
4
Local optima
We may have multiple local optima without constraints
A linear problem
With a bounded feasible region a linear objective
ensures the optimum is at a boundary. Linear constraints
make the optimum at a corner
3
y
4x y 6
2x 3y 8 2
maximum
4 y 5x 1 1 Objective
6x + 7y + 2
1 2 x 3
10
5
Business Risk Management
Stochastic optimization
Two stage problems
11
12
6
Parthenon Oil Company
The Parthenon Oil Company (POC) makes plans for
February and March. In February POC buys oil from the
market, delivers some to its customers right away and
puts the rest in storage for March
In March the company can supply from storage or buy
from the market
We need to decide x1, the amount to purchase in
February, and x2, the amount to purchase in March
The decision depends on the price of oil in February and
March; the storage cost (say $5 per unit per month);
and the demand in each period. The price and demand in
March is uncertain (see the following table)
13
14
7
POC example (3)
Constraints are
x1 ≥ 1000 (February demand is met)
x1 – 1000 + x2 ≥ d (March demand is met)
x2 ≥ 0 (cannot sell excess oil)
Under scenario A (March is normal) it is optimal to take
x1 = 1000, x2 = 1000
Under scenario B (March is cold) it is optimal to take
x1 = 1000, x2 = 1200
Under scenario C (March is very cold) it is best to take
x1 = 2400, x2 = 0
But we need to decide x1 before we know the scenario.
Should we take it as 1000 or 2400 or something else
(perhaps the average value 4400/3 ?)
15
16
8
Recourse problems
The POC example is a two-stage stochastic problem with
recourse
At first stage we make a decision, say x
Then a random event occurs, before the second stage
where we make another decision, y. Our decision on y
depends on both x and the random event
At both stages costs are incurred (depending on our
decisions, with second stage costs also depending on the
random event)
We want to choose x (and then y) to minimize the
expected costs
17
Structure in a diagram
18
9
Solution options
We set up an optimisation problem and solve using
general purpose software (like solver in Excel)
One approach calculates the right second stage decision as
a function of the first stage choice; then we optimise for
the first stage choice (allowing for the probability of
different events)
Another approach is to optimise over the second stage
choices at the same time as the first stage choice. This is
what we did in the spreadsheet with POC: it gives a larger
optimisation problem (more variables) but less analysis to
do.
19
Stochastic optimization
Monte Carlo simulation
20
10
Monte Carlo simulation
Idea is to use a large number of scenarios to explore
possible behaviours. We need to be able to generate the
scenarios in a way which matches their actual likelihood
– so more likely scenarios are more likely to be
generated
Set up a model with random components made explicit
and where each random element has a given distribution
Use a (pseudo) random number generator – this will be
RAND() in Excel
Then convert to the right distribution through the
inverse of the cumulative distribution function
21
Generating a distribution
Find the cumulative distribution from the density.
f(x)
0
F -1(z)
The result F -1(z) has distribution given by f .
22
11
An example
Suppose that the distribution has density
f ( x ) 1.5 x
on the range 0 x 1
0 1
23
Method
Start by finding the CDF. If 𝑓(𝑥) = 1.5 − 𝑥 then
𝐹(𝑥) = 1.5𝑥 − 𝑥 /2 on the range (0,1).
To find the inverse function write 𝑦 for 𝐹(𝑥) and then
rewrite to get 𝑥 in terms of 𝑦
Here 𝑦 = 1.5𝑥 − 𝑥 /2
So 𝑥 − 3𝑥 + 2𝑦 = 0
This is a quadratic equation we can solve for 𝑥
24
12
Business Risk Management
Stochastic optimization
Value at Risk constraints
25
Reducing risk
So far we have looked at maximising expected profit.
Maximising expected utility is similar
But a stochastic optimisation framework with constraints
allows more complex objectives that take account of risk.
One option is to add a constraint that the objective should
never be worse than a certain value M
This is an extra constraint for each scenario:
Objective evaluated for this scenario > M
However with this approach there may be no feasible
solution
26
13
Value at Risk constraints
Rather than ruling out bad behaviour it is sometimes
more natural just to make bad behaviour very rare
Instead of saying that every scenario achieves a value no
worse than a value M, we could say that the probability
of being worse than M is very small (say less than 1%)
With 500 equally likely scenarios this would be like
saying no more than 5 scenarios are worse than M
We can say that M corresponds to the 99% Value at Risk
figure (or more precisely a loss of –M is the 99% Value at
Risk)
27
28
14
Portfolio with VaR
constraint (2)
For a normal distribution: if mean > 2.5758 (st. dev) then
there is a less than 0.5% chance of a negative result.
0.005 probability
of being to the left
of the line
-4 -3 -2 -1 0 1 2 3 4
29
wB Feasible
Contours of Optimal solution
region
the objective wA = 0.951,
1000 wA 600 wB wB = 0.049
wA 1
30
15
Portfolio with VaR
constraint (4)
Now we allow all three stocks: A, B and C. The mean is
1000wA 600wB 1200(1 wA wB ) 1200 200wA 600wB
Standard deviation 4002 wA2 2002 wB 2 6002 (1 wA wB )2
1.0
Red lines show VaR constraint
wB
0.8
mean > 2.5758 (st. dev)
which defines an ellipse
Contours of the
objective (increasing
0.6
Feasible
towards origin) region
0.4
Summary
Introduction to optimization
Two stage stochastic optimization with recourse
Warning: don’t use averages
Monte Carlo simulation and generating random
variables from a given distribution
Constraints based on Value at Risk
32
16