B.6 Nonlinear Programming

advertisement
Readings
Readings
Chapter 8
Nonlinear Optimization Models
BA 452 Lesson B.6 Nonlinear Programming
1
Overview
Overview
BA 452 Lesson B.6 Nonlinear Programming
2
Overview
Local and Global Optima of nonlinear programming problems are the optimal
solutions either over a neighborhood of the feasible set (local), or over the
entire feasible set (global).
Approximation Errors are typically measured as the sum of squares of the
differences between desired values and actual values, such as the difference
between an Index Fund and the S&P 500.
Nonlinear Assignment Problems are assignment problems where the objective
is nonlinear. For example, minimizing the distance times weight of cargo
assigned to loading docks.
Variance of an investment portfolio is measured as the expected value of the
sum of squares of the differences between expected rates of return and actual
rates of return.
Semi Variance of an investment portfolio modifies Variance by measuring only
the times when actual rates of return fall short of expected rates of return.
Those are the bad unexpected differences.
BA 452 Lesson B.6 Nonlinear Programming
3
Overview
Tool Summary
 Distinguish between a local optimum and a global
optimum. The former is an optimum only in the
immediate neighborhood, and the latter is an optimum in
the entire feasible region.
 Know that the product of two binary variables is, itself, a
binary variable. And the product is 1 if, and only if, each
separate binary variable is 1. Thus if x is a binary
variable that is 1 when you mow the yard and y is a
binary variable that is 1 when you wash the car, the
product of x and y is 1 when you mow the yard and wash
the car.
BA 452 Lesson B.6 Nonlinear Programming
4
Local and Global Optima
Local and Global Optima
BA 452 Lesson B.6 Nonlinear Programming
5
Local and Global Optima
Overview
Local and Global Optima of nonlinear programming
problems are the optimal solutions either over a
neighborhood of the feasible set (local), or over the
entire feasible set (global).
Because it is so hard for a computer program to solve
some nonlinear programs, you need not compute any
solutions.
BA 452 Lesson B.6 Nonlinear Programming
6
Local and Global Optima
Nonlinear optimization problems are those optimization
problems in which at least one term in the objective
function or a constraint is nonlinear. Nonlinear terms
include x 3 , 1/ x , 5x x , and log x .
1
2
1 2
3
BA 452 Lesson B.6 Nonlinear Programming
7
Local and Global Optima



A feasible solution is a local optimum if there are no
other feasible solutions with a better objective
function value in the immediate neighborhood.
• For a maximization problem the local optimum
corresponds to a local maximum.
• For a minimization problem the local optimum
corresponds to a local minimum.
A feasible solution is a global optimum if there are no
other feasible points with a better objective function
value in the feasible region.
Obviously, a global optimum is also a local optimum.
BA 452 Lesson B.6 Nonlinear Programming
8
Local and Global Optima





Nonlinear optimization problems can have multiple
local optimal solutions, in which case we want to find
the best local optimum.
Nonlinear problems with multiple local optima are
difficult to solve with optimization software.
In these cases, the software can get “stuck” and
terminate at a local optimum.
There can be a severe penalty (loss of objective) for
confusing a local optimum for a global optimum.
Developing software to find global optima is an
active research area.
BA 452 Lesson B.6 Nonlinear Programming
9
Local and Global Optima

2 (  X 2 ( Y  1)2 )
Consider the function f ( X , Y )  3(1  X ) e
 10( X /5  X  Y )e
3
 e( ( X  1)



2
Y 2 )
5
(  X 2 Y 2 )
/3.
The shape of this function is shown on the next slide.
The hills and valleys in the graph show that this
function has several local maximums and local
minimums.
There are three local maximums, one of which is the
global maximum.
BA 452 Lesson B.6 Nonlinear Programming
10
Local and Global Optima
2 (  X 2 ( Y  1)2 )
f ( X , Y )  3(1  X ) e
 10( X /5  X  Y )e
3
5
(  X 2 Y 2 )
BA 452 Lesson B.6 Nonlinear Programming
e
(  ( X  1)2 Y 2 )
/3
11
Local and Global Optima






Consider the function f ( X , Y )  X 2  Y 2 .
The shape of this function is shown on the next slide.
A function that is bowl-shaped down is called a
concave function.
The maximum value for this particular function is 0
and the point (0, 0) gives the optimal value of 0.
Functions such as this one have a single local
maximum that is also a global maximum.
A nonlinear problem with that type of objective
function is relatively easy to maximize.
BA 452 Lesson B.6 Nonlinear Programming
12
Local and Global Optima
Concave Function f ( X , Y )  X 2  Y 2
BA 452 Lesson B.6 Nonlinear Programming
13
Local and Global Optima






Consider the function f ( X , Y )  X 2  Y 2 .
The shape of this function is shown on the next slide.
A function that is bowl-shaped up is called a convex
function.
The minimum value for this particular function is 0
and the point (0, 0) gives the optimal value of 0.
Functions such as this one have a single local
minimum that is also a global minimum.
This type of nonlinear problem is relatively easy to
minimize.
BA 452 Lesson B.6 Nonlinear Programming
14
Local and Global Optima
Convex Function f ( X , Y )  X 2  Y 2
40
20
Z
4
2
0
X
-2
-4
-4
0
-2
2
4
Y
BA 452 Lesson B.6 Nonlinear Programming
15
Approximation Errors
Approximation Errors
BA 452 Lesson B.6 Nonlinear Programming
16
Approximation Errors
Overview
Approximation Errors are typically measured as the sum
of squares of the differences between predicted or
desired values and actual values, such as the difference
between the returns on an Index Fund and the past
performance of a broad market index, such as the S&P
500.
BA 452 Lesson B.6 Nonlinear Programming
17
Approximation Errors





Index funds are a very popular investment vehicle in
the mutual fund industry.
Vanguard 500 Index Fund is the largest mutual fund
in the U.S. with over $70 billion in net assets in 2005.
An index fund is an example of passive asset
management, which emphasizes past performance.
The key idea behind an index fund is to construct a
portfolio of stocks, mutual funds, or other securities
that closely matches the past performance of a broad
market index such as the S&P 500.
Behind the popularity of index funds is research that
basically says “you can’t beat the market”.
BA 452 Lesson B.6 Nonlinear Programming
18
Approximation Errors
Question: Lymann Brothers has a substantial number of
clients who wish to own a mutual fund portfolio that closely
matches the performance of the S&P 500 stock index.
A manager at Lymann Brothers has selected five mutual
funds (shown on the next slide) that will be considered for
inclusion in the portfolio. The manager must decide what
percentage of the portfolio should be invested in each
mutual fund.
BA 452 Lesson B.6 Nonlinear Programming
19
Approximation Errors

Mutual Fund Performance in 4 Selected Years
Mutual Fund
Annual Returns (Planning Scenarios)
Year 1
Year 2
Year 3
Year 4
International Stock
Large-Cap Blend
Mid-Cap Blend
Small-Cap Blend
Intermediate Bond
25.64
15.31
18.74
14.19
7.88
27.62
18.77
18.43
12.37
9.45
5.80
11.06
6.28
-1.92
10.56
-3.13
4.75
-1.04
7.32
3.31
S&P 500
13.00
12.00
7.00
2.00
BA 452 Lesson B.6 Nonlinear Programming
20
Approximation Errors
Formulate and solve a non-linear programming problem to
determine what percentage of the portfolio should be
invested in each mutual fund so that the portfolio closely
matches the performance of the S&P 500 stock index. Use
the sum of squared deviations to measure the closeness of
the portfolio to the index.
BA 452 Lesson B.6 Nonlinear Programming
21
Approximation Errors
Answer: Define the 9 Decision Variables
IS = proportion of portfolio invested in international stock
LC = proportion of portfolio invested in large-cap blend
MC = proportion of portfolio invested in mid-cap blend
SC = proportion of portfolio invested in small-cap blend
IB = proportion of portfolio invested in intermediate bond
R1 = portfolio return for scenario 1 (year 1)
R2 = portfolio return for scenario 2 (year 2)
R3 = portfolio return for scenario 3 (year 3)
R4 = portfolio return for scenario 4 (year 4)
BA 452 Lesson B.6 Nonlinear Programming
22
Approximation Errors
Fund Year 1 Year 2 Year 3 Year 4
IS
25.64 27.62 5.80 -3.13
LC
15.31 18.77 11.06 4.75
MC 18.74 18.43 6.28 -1.04
SC
14.19 12.37 -1.92 7.32
IB
7.88 9.45 10.56 3.31
SP
13.00 12.00
7.00 2.00
Define the objective function
Min (R1 – 13)2 + (R2 – 12)2 + (R3 – 7)2 + (R4 – 2)2
 Define the constraints (including non-negativity)
25.64IS + 15.31LC + 18.74MC + 14.19SC + 7.88IB = R1
27.62IS + 18.77LC + 18.43MC + 12.37SC + 9.45IB = R2
5.80IS + 11.06LC + 6.28MC - 1.92SC + 10.56IB = R3
- 3.13IS + 4.75LC - 1.04MC + 7.32SC + 3.31IB = R4
IS + LC + MC + SC + IB = 1
IS, LC, MC, SC, IB > 0

BA 452 Lesson B.6 Nonlinear Programming
23
Approximation Errors
Optimal Solution for Lymann Brothers Example
• R1 = 12.51
(12.51% portfolio return for scenario 1)
• R2 = 12.90
(12.90% portfolio return for scenario 2)
• R3 = 7.13
( 7.13% portfolio return for scenario 3)
• R4 = 2.51
( 2.51% portfolio return for scenario 4)
• IS = 0
( 0.0% of portfolio in international stock)
• LC = 0
( 0.0% of portfolio in large-cap blend)
• MC = .332
(33.2% of portfolio in mid-cap blend)
• SC = .161 (16.1% of portfolio in small-cap blend)
• IB = .507
(50.7% of portfolio in intermediate bond)
Lymann Brothers Portfolio Return vs. S&P 500 Return


Scenario
Portfolio Return
S&P 500 Return
1
2
3
4
12.51
12.90
7.13
2.51
13.00
12.00
7.00
2.00
BA 452 Lesson B.6 Nonlinear Programming
24
Nonlinear Assignment
Nonlinear Assignment
BA 452 Lesson B.6 Nonlinear Programming
25
Nonlinear Assignment
Overview
Nonlinear Assignment Problems are assignment problems
where the objective is nonlinear. For example, minimizing
the distance times weight of cargo assigned to loading
docks.
BA 452 Lesson B.6 Nonlinear Programming
26
Nonlinear Assignment



The port of Long Beach has three available loading
docks. The distance (in meters) between the loading
docks is giving in the table below:
1
2
3
1 |
0
100
150
2 | 100
0
50
3 | 150
50
0
Three tankers currently at sea are coming into Long
Beach. Each tanker needs its own dock. Currently
tankers 2 and 3 are empty. Tanker 1 has cargo that must
be loaded onto the other tankers: 60 tons to Tanker 2
and 80 tons to Tanker 3.
Formulate then solve a non-linear programming problem
to minimize the product of tonnage times distance,
added across all tankers.
BA 452 Lesson B.6 Nonlinear Programming
27
Nonlinear Assignment
This is an extension of the assignment problems
considered earlier. Like assigning “agents” to “tasks”,
now assign tankers to docks.
 Using standard notation for an assignment problem, let
XIJ = 1 if Tanker I is assigned to Dock J, and 0 if not.
 The constraints are just like the standard assignment
problems.
! Each tanker must be assigned to a dock;
X11 + X12 + X13 = 1; !Tanker 1;
X21 + X22 + X23 = 1; !Tanker 2;
X31 + X32 + X33 = 1; !Tanker 3;
! Each dock can be assigned to at most one tanker;
X11 + X21 + X31 < 1; !Dock 1;
X12 + X22 + X32 < 1; !Dock 2;
X13 + X23 + X33 < 1; !Dock 3;

BA 452 Lesson B.6 Nonlinear Programming
28
Nonlinear Assignment



The difference from the standard assignment problem is
the objective function is now nonlinear. The reason is
the cost of assigning Tanker I to Dock J is no longer
constant. For example, the cost of assigning Tanker 3 to
Dock J depends on where Tanker 1 is assigned,
because that assignment affects how far the 80 tons of
cargo must move from Tanker 1 to Tanker 3.
For example, consider the result of assigning Tanker 1 to
Dock 2 and Tanker 3 to Dock 1.
The distance between loading Docks 1 and 2 is 100
meters. And Tanker 1 must transfer 80 tons of goods to
Tanker 3. This means that 80 tons must be moved 100
meters. To capture that in the objective function, write
100*80*X12*X31. Since both X12 = 1 and X31 = 1 their
product is 1, and the product of distance and tonnage
moved (100*80) is the term 100*80*X12*X31.
BA 452 Lesson B.6 Nonlinear Programming
29
Nonlinear Assignment
The complete objective function is
MIN = 100*60*X11*X22 + 150*60*X11*X23
+ 100*60*X12*X21 + 50*60*X12*X23
+ 150*60*X13*X21 + 50*60*X13*X22
! Those are the costs of moving 60 tons from Tanker 1 to 2;
+ 100*80*X11*X32 + 150*80*X11*X33
+ 100*80*X12*X31 + 50*80*X12*X33
+ 150*80*X13*X31 + 50*80*X13*X32;
! Those are the costs of moving 80 tons from Tanker 1 to 3;
 For example, compute the cost of assigning Tanker 1 to
Dock 2, Tanker 2 to Dock 3, and Tanker 3 to Dock 1.
 Variables are X12 = X23 = X31 = 1, with all other XIJ = 0.
 The objective function is then
100*60*0*0 + 150*60*0*1
+ 100*60*1*0 + 50*60*1*1 + … = 50*60 + 100*80 = 11,000

BA 452 Lesson B.6 Nonlinear Programming
30
Nonlinear Assignment
Optimal assignment:
 Tanker 1 to Dock 2
 Tanker 2 to Dock 1
 Tanker 3 to Dock 3
@BIN(X33); specifies X33 as a binary variable
BA 452 Lesson B.6 Nonlinear Programming
31
Variance
Variance
BA 452 Lesson B.6 Nonlinear Programming
32
Variance
Overview
Variance of an investment portfolio is measured as the
expected value of the sum of squares of the differences
between expected rates of return and actual rates of
return.
BA 452 Lesson B.6 Nonlinear Programming
33
Variance




The key tradeoff in most portfolio optimization models
is between risk and return.
The index fund model (Lymann Brothers example)
presented earlier managed the tradeoff passively (ex
post, or after the fact).
The Markowitz mean-variance portfolio model
provides a very convenient way for an investor to
trade off risk versus return actively (ex ante, or before
the fact).
We demonstrate the Markowitz portfolio model by
extending the Lymann Brothers example.
BA 452 Lesson B.6 Nonlinear Programming
34
Variance


In the Lymann Brothers example there were four
scenarios and the return under each scenario was
defined by the variables R1, R2, R3, and R4.
If ps is the probability of scenario s, and there are n
scenarios, then the expected return for the portfolio R
is
n
R   ps Rs
s 1

If we assume that the four scenarios in the Lymann
Brothers model are equally likely, then
1
R   Rs or
s 1 4
4
1 4
R   Rs
4 s 1
BA 452 Lesson B.6 Nonlinear Programming
35
Variance


The measure of risk most often associated with the
Markowitz model is the variance of the portfolio.
For our example, the portfolio variance is
n
Var   ps ( Rs  R )2
s 1

For our example, the four planning scenarios are
equally likely. Thus,
1
Var   ( Rs  R )2 or
s 1 4
4
1 4
Var   ( Rs  R )2
4 s 1
BA 452 Lesson B.6 Nonlinear Programming
36
Variance



The portfolio variance is the average of the sum of
the squares of the deviations from the mean value
under each scenario.
The larger the variance value, the more widely
dispersed the scenario returns are around the
average return value.
If the portfolio variance equaled zero, then every
scenario return Ri would have to equal.
BA 452 Lesson B.6 Nonlinear Programming
37
Variance


There are two alternative ways to formulate the
Markowitz model:
• (1) Minimize the variance of the portfolio subject to
constraints on the expected return, and
• (2) Maximize the expected return of the portfolio
subject to a constraint on risk (we did that in a
previous lesson).
We demonstrate the first (1) formulation, assuming
that Lymann Brothers’ client requires the expected
portfolio return to be at least 9 percent.
BA 452 Lesson B.6 Nonlinear Programming
38
Approximation Errors
Question: Lymann Brothers has a substantial number of
clients who wish to own a mutual fund portfolio with
minimum variance and an expected return on 9 percent.
A manager at Lymann Brothers has selected five mutual
funds (shown on the next slide) that will be considered for
inclusion in the portfolio. The manager must decide what
percentage of the portfolio should be invested in each
mutual fund.
BA 452 Lesson B.6 Nonlinear Programming
39
Approximation Errors

Mutual Fund Performance in 4 Selected Years
Mutual Fund
Annual Returns (Planning Scenarios)
Year 1
Year 2
Year 3
Year 4
International Stock
Large-Cap Blend
Mid-Cap Blend
Small-Cap Blend
Intermediate Bond
25.64
15.31
18.74
14.19
7.88
27.62
18.77
18.43
12.37
9.45
5.80
11.06
6.28
-1.92
10.56
BA 452 Lesson B.6 Nonlinear Programming
-3.13
4.75
-1.04
7.32
3.31
40
Approximation Errors
Formulate and solve a non-linear programming problem to
determine what percentage of the portfolio should be
invested in each mutual fund so that the portfolio has
minimum variance and an expected return of 9 percent.
Assume all scenarios are equally likely.
BA 452 Lesson B.6 Nonlinear Programming
41
Approximation Errors
Answer: Define the 9 Decision Variables
IS = proportion of portfolio invested in international stock
LC = proportion of portfolio invested in large-cap blend
MC = proportion of portfolio invested in mid-cap blend
SC = proportion of portfolio invested in small-cap blend
IB = proportion of portfolio invested in intermediate bond
R1 = portfolio return for scenario 1 (year 1)
R2 = portfolio return for scenario 2 (year 2)
R3 = portfolio return for scenario 3 (year 3)
R4 = portfolio return for scenario 4 (year 4)
BA 452 Lesson B.6 Nonlinear Programming
42
Variance

Define the Objective Function
Minimize the portfolio variance:
1 4
Min  ( Rs  R )2
4 s 1

Fund Year 1 Year 2 Year 3 Year 4
IS
25.64 27.62 5.80 -3.13
LC
15.31 18.77 11.06 4.75
MC 18.74 18.43 6.28 -1.04
SC
14.19 12.37 -1.92 7.32
IB
7.88 9.45 10.56 3.31
Constrain the return for
each scenario:
25.64IS + 15.31LC + 18.74MC + 14.19SC + 7.88IB = R1
27.62IS + 18.77LC + 18.43MC + 12.37SC + 9.45IB = R2
5.80IS + 11.06LC + 6.28MC  1.92SC + 10.56IB = R3
 3.13IS + 4.75LC  1.04MC + 7.32SC + 3.31IB = R4
BA 452 Lesson B.6 Nonlinear Programming
43
Variance

Constrain that all money be invested:

IS + LC + MC + SC + IB = 1
Define the expected return for the portfolio:
1 4
Rs = R

4 s 1

Constrain the expected portfolio return to be at least 9
percent:
R  9

Constrain non-negativity:
IS, LC, MC, SC, IB > 0
BA 452 Lesson B.6 Nonlinear Programming
44
Variance

Optimal Solution
• R1 = 10.63% portfolio return for scenario 1
• R2 = 12.20% portfolio return for scenario 2
• R3 = 8.93% portfolio return for scenario 3
• R4 = 4.24% portfolio return for scenario 4
• Rbar = 9.00% expected portfolio return
• IS =
0.00% of portfolio in international stock
• LC = 25.10% of portfolio in large-cap blend
• MC = 0.00%of portfolio in mid-cap blend
• SC = 14.1% of portfolio in small-cap blend
• IB =
60.8% of portfolio in intermediate bond
100.0% of portfolio
BA 452 Lesson B.6 Nonlinear Programming
45
Semi Variance
Semi Variance
BA 452 Lesson B.6 Nonlinear Programming
46
Semi Variance
Overview
Semi Variance of an investment portfolio modifies
Variance by measuring only the times when actual rates
of return fall short of expected rates of return. Those
are the times when unexpected returns are bad.
.
BA 452 Lesson B.6 Nonlinear Programming
47
Semi Variance



Most investors are happy when their returns are
above average, but want to avoid returns below
average.
In the previous Markowitz porfolio optimization
problem, we minimized variance, which is the sum of
squares of the deviations from the mean.
Now change the objective to minimize the semivariance, which is the sum of squares of those
deviations from the mean that are below the mean.
BA 452 Lesson B.6 Nonlinear Programming
48
Semi Variance

As before, constrain the return
for each scenario:
Fund Year 1 Year 2 Year 3 Year 4
IS
25.64 27.62 5.80 -3.13
LC
15.31 18.77 11.06 4.75
MC 18.74 18.43 6.28 -1.04
SC
14.19 12.37 -1.92 7.32
IB
7.88 9.45 10.56 3.31
SP
13.00 12.00
7.00 2.00
25.64IS + 15.31LC + 18.74MC + 14.19SC + 7.88IB = R1
27.62IS + 18.77LC + 18.43MC + 12.37SC + 9.45IB = R2
5.80IS + 11.06LC + 6.28MC  1.92SC + 10.56IB = R3
3.13IS + 4.75LC  1.04MC + 7.32SC + 3.31IB = R4

Then, define and constrain the expected return for the
portfolio:
1 4
Rs = R
R  9

4 s 1
BA 452 Lesson B.6 Nonlinear Programming
49
Semi Variance



But instead of minimizing the variance
1 4
Min  ( Rs  R)2
4 s 1
Decompose deviations into positive or negative terms
R1 - Rbar = DP1 – DN1,
R2 - Rbar = DP2 – DN2,
R3 - Rbar = DP3 – DN3,
R4 - Rbar = DP4 – DN4.
Then minimize the sum of the squares of the negative
deviations, which is the semi-variance.
BA 452 Lesson B.6 Nonlinear Programming
50
Approximation Errors
Question: Lymann Brothers has a substantial number of
clients who wish to own a mutual fund portfolio with
minimum semivariance and an expected return on 9
percent.
A manager at Lymann Brothers has selected five mutual
funds (shown on the next slide) that will be considered for
inclusion in the portfolio. The manager must decide what
percentage of the portfolio should be invested in each
mutual fund.
BA 452 Lesson B.6 Nonlinear Programming
51
Approximation Errors

Mutual Fund Performance in 4 Selected Years
Mutual Fund
Annual Returns (Planning Scenarios)
Year 1
Year 2
Year 3
Year 4
International Stock
Large-Cap Blend
Mid-Cap Blend
Small-Cap Blend
Intermediate Bond
25.64
15.31
18.74
14.19
7.88
27.62
18.77
18.43
12.37
9.45
5.80
11.06
6.28
-1.92
10.56
BA 452 Lesson B.6 Nonlinear Programming
-3.13
4.75
-1.04
7.32
3.31
52
Approximation Errors
Formulate and solve a non-linear programming problem to
determine what percentage of the portfolio should be
invested in each mutual fund so that the portfolio has
minimum semivariance and an expected return of 9
percent. Assume all scenarios are equally likely.
BA 452 Lesson B.6 Nonlinear Programming
53
Semi Variance
Answer:
BA 452 Lesson B.6 Nonlinear Programming
54
Semi Variance



As an error check, make
sure that, for each variable,
either DPi = 0 or DNi = 0.
DN1 = DN2 = 0.
DP3 = DP4 = 0.
BA 452 Lesson B.6 Nonlinear Programming
55
BA 452
Quantitative Analysis
End of Lesson B.6
BA 452 Lesson B.6 Nonlinear Programming
56
Download