Chapter 14

advertisement
Risk Modeling and Stochastic Programming
Where does it occur?
Maximize
Subject to
CX
AX
X


b
0
Uncertain objective function returns - C
variability in prices
variability in production quantities
variability in costs
variability in market sales
Resource usages - A
variability in raw input quality
variability in working conditions
variability in intermediate product yields
variability in product requirements
Resource endowments - b
variability in demand firm faces
variability in resources available
variability in working conditions
Risk Modeling and Stochastic Programming
Including Risk
When incorporating risk there are three big issues
1. What is the nature of risk?
a. What parameters of the model are
uncertain?
b. How do we describe their distribution?
2.
When are risk outcomes revealed?
Does the producer receive information about
uncertain events and will make adaptive
decisions?
3.
How do we model behavioral reaction to
risk?
Is expected profit maximization not the proper
objective but rather some degree of aversion to the
variation caused by risk?
Risk Modeling and Stochastic Programming
Why Model Risk
Why not just solve for all values of risky parameters
Curses of dimensionality and certainty
Dimensionality: Number of possible plans
(5 possible values for 3 parameters 35 = 243)
Certainty: Each plan would be certain of data so we
would have 243 different things we could do
–What would we do?
General Risk Modeling Aim
Generate Robust in the face of the Uncertainty
Not necessarily a best performer in any setting, but
a good performer across many or most or the most
likely spectrum
Risk Modeling and Stochastic Programming
Forms of assumed reaction to risk
Non Recourse or non adaptive decision making
- Decisions made now consequence felt later
- No decisions made between now and when
consequences felt
Example–Buy stock now make no decision for one year
Recourse or adaptive decision making
Later time during model additional decisions made.
In this later decision period
Decision maker knows what happened between first
decision and now.
Decision makers cannot revise prior actions but can
adjust current decisions ie current decisions can be
employed to make adjustments in the face of
realized events -- phenomena called irreversibility
and recourse
Example – Buy stock now make review decisions
quarterly possibly selling and buying other
stocks
Including Non Adaptive Risk
Decision Maker reaction to risk
Expected Value Maximization
max
cX
s.t.
AX
 b
X
 o
Conservative - Fat or thin coefficients
max
s.t.
c~X
~
AX
~
 b
X
 o
~
Where c c  Risk Discount
~
a  a  Risk Discount
~ ~
b b  Risk Discount
E- V
Maximize
E(income) - RAP * Variance(income)
Expected utility
Maximize Sum(p,Probability(p)*U[Wealth(p)])
S.T.
Wealth(p)=InitWealth + Income(p) for all p
Income(p)=C(p)*X
for all p
Safety First based
Maximize Sum(p,Probability(p)*Income(p))
S.T.
Income(p)=C(p)*X
for all p
Income(p)safety
for all p
Including Non Adaptive Risk
First Risk Model
Markowitz mean-variance portfolio choice formulation
Given Problem
Max sum(invest, moneyinvest(invest)*avgreturn(invest))
s.t sum(invest,moneyinvest(invest)*price(invest))  funds
Markowitz observed not all money in highest valued
stock
Inconsistent with LP formulation
Why? Not a basic solution
Markowitz posed the hypothesis that average returns
and the variance of returns were important
Including Non Adaptive Risk
EV Formulation – Statistical Background
Given a linear objective function
Z  c1 X1  c 2 X 2
where X1, X2 are decision variables and c1 , c2 are uncertain
parameters distributed with means
c1 and c 2 as well as variances
s11 , s22, and covariance s12; then Z is distributed with mean
Z  c1 X 1  c 2 X 2
and variance
 Z2  s11 X12  s 22 X 22  2 s 21 X1 X 2 .
In matrix terms the mean and variance of Z are
(CX , X SX)
where in the two by two case

C  c1 c 2

s11 s12 
S
.
s 21 s 22 
Including Non Adaptive Risk
EV Formulation – Statistical Background
Defining terms
sii
is the variance of the objective function coefficient
of Xi, which is calculated using the formula
sik =  (cik- c i ) 2 /N where cik is the kth observation on
the objective value of Xi and N is the number of
observations, assuming an equally likely
probability (1/N) of occurrence.1
sij
for i  j is the covariance of the objective function
coefficients between ci and cj, calculated by the
formula sij = ∑ (cik- c i )(cjk- c j )/N. Note sij = sji.
ci
is the mean value of the objective function
coefficient ci, calculated by c i   cik/N. (Assuming
an equally likely probability of occurrence.)
1
One could also use the divisor N-1 when working with a sample.
Including Non Adaptive Risk
E-V Model Commonly Used Formulation
Markowitz Formulation
Min σ2
s.t. E =K
or
Freund Formulation
Max E    Z2
or Max E - RAP * Variance
Why Use Later – reuse of RAP and Transferability
Commonly Used Freund Formulation
Max  c j X j
j
s.t.
Xj
j
Xj
Where
E
=
Var =

=
    s jk X j X k
j k
 funds
 0 for all j
expected value of risky c times choice of x
sum of var time x squared minus twice
covariance times x’s
risk aversion parameter
Risk Modeling and Stochastic Programming
EV Model – Example
Assume an investor wishes to develop a stock portfolio given the stock annual returns
information shown in Table 14.1, 500 dollars to invest and prices of stock one $22.00,
stock two $30.00, stock three $28.00 and stock four $26.00.
Table 14.1. Data for E-V Example -- Returns by Stock and Event
----Stock Returns by Stock and Event---Stock1
Stock2
Stock3
Event1
7
6
8
5
Event2
8
4
16
6
Event3
4
8
14
6
Event4
5
9
-2
7
Event5
6
7
13
6
Event6
3
10
11
5
Event7
2
12
-2
6
Event8
5
4
18
6
Event9
4
7
12
5
Event10
3
9
-5
6
Stock1
Stock2
Stock3
Stock4
22
30
28
26
Price
Stock4
Risk Modeling and Stochastic Programming
EV Model – Example
Table 14.2.
Mean Returns and Variance Parameters for
Stock Example
Stock1 Stock2 Stock3 Stock4
Mean Returns
4.70
7.60
8.30
5.80
Variance-Covariance Matrix
Stock1 Stock2 Stock3 Stock4
Stock1
3.21
-3.52
6.99
0.04
Stock2
-3.52
5.84 -13.68
0.12
Stock3
6.99 -13.68 61.81
-1.64
Stock4
0.04
0.12
-1.64
0.36
Risk Modeling and Stochastic Programming
EV Model – Example
In turn the objective function is
X1 
 3.21
X 
 3.52
2

Max 4.70 7.60 8.30 5.80
  X 1 X 2 X 3 X 4  
X 3 
 6.99
 

 0.04
X 4 
 3.52  6.99  0.04 
 5.84  13.68  0.12 
 13.68  61.81  1.64 

 0.13  1.64  0.36
or, in scalar notation
Max
4.70 X 1  7.60 X 2  8.30 X 3  5.80 X 4
  3.21
X 12  3.52 X 1 X 2

  3.52 X 2 X 1  5.84 X 22
 
  6.99 X 3 X 1  13.68 X 3 X 2

  0.04 X 4 X 1  0.12 X 4 X 2
 6.99 X 1 X 3  0.04 X 1 X 4 

 13.68 X 2 X 3  0.12 X 2 X 4 

 61.81
X 32  1.64 X 3 X 4 

 1.64 X 4 X 3  0.36 X 24 
This objective function is maximized subject to a constraint on
investable funds:
22 X 1  30 X 2
 28 X 3  26 X 4  500
and non-negativity conditions on the variables.
X1 
X 
 2
X 3 
 
X 4 
GAMS Formulation
10
11
12
14
16
17
19
22
24
26
27
28
29
30
31
32
33
34
35
36
38
39
40
42
43
44
45
47
49
51
53
55
56
59
61
62
64
66
70
75
77
78
79
82
84
86
90
91
92
93
94
95
96
97
98
99
100
101
103
SETS
STOCKS
EVENTS
POTENTIAL INVESTMENTS / BUYSTOCK1*BUYSTOCK4 /
EQUALLY LIKELY RETURN STATES OF NATURE
/EVENT1*EVENT10 / ;
ALIAS (STOCKS,STOCK);
PARAMETERS
PRICES(STOCKS) PURCHASE PRICES OF THE STOCKS
/ BUYSTOCK1
22, BUYSTOCK2
30
BUYSTOCK3
28, BUYSTOCK4
26 / ;
SCALAR
FUNDS
TOTAL INVESTABLE FUNDS / 500 / ;
TABLE RETURNS(EVENTS,STOCKS) RETURNS BY STATE OF NATURE EVENT
BUYSTOCK1
BUYSTOCK2
BUYSTOCK3
BUYSTOCK4
EVENT1
7
6
8
5
EVENT2
8
4
16
6
EVENT3
4
8
14
6
EVENT4
5
9
-2
7
EVENT5
6
7
13
6
EVENT6
3
10
11
5
EVENT7
2
12
-2
6
EVENT8
5
4
18
6
EVENT9
4
7
12
5
EVENT10
3
9
-5
6
PARAMETERS
MEAN (STOCKS)
MEAN RETURNS TO X(STOCKS)
COVAR(STOCK,STOCKS) VARIANCE COVARIANCE MATRIX;
MEAN(STOCKS) = SUM(EVENTS , RETURNS(EVENTS,STOCKS) / CARD(EVENTS) );
COVAR(STOCK,STOCKS)
= SUM (EVENTS ,(RETURNS(EVENTS,STOCKS) - MEAN(STOCKS))
*(RETURNS(EVENTS,STOCK)- MEAN(STOCK)))/CARD(EVENTS);
DISPLAY MEAN , COVAR ;
SCALAR RAP
RISK AVERSION PARAMETER / 0.0 / ;
POSITIVE VARIABLES
INVEST(STOCKS) MONEY INVESTED IN EACH STOCK
VARIABLE
OBJ
NUMBER TO BE MAXIMIZED ;
EQUATIONS
OBJJ
OBJECTIVE FUNCTION
INVESTAV
INVESTMENT FUNDS AVAILABLE;
OBJJ..OBJ =E=
SUM(STOCKS, MEAN(STOCKS) * INVEST(STOCKS))
- RAP*(SUM(STOCK, SUM(STOCKS,
INVEST(STOCK)* COVAR(STOCK,STOCKS)*invest(stocks));
INVESTAV..
SUM(STOCKS, PRICES(STOCKS) * INVEST(STOCKS)) =L= FUNDS ;
MODEL EVPORTFOL /ALL/ ;
SCALAR VAR THE VARIANCE ;
SET RAPS
RISK AVERSION PARAMETERS /R0*R25/
PARAMETER RISKAVER(RAPS) RISK AVERSION COEFICIENT BY RISK AVERSION
/R0
0.00000, R1
0.00025, R2
0.00050, R3 0.00075,
R4
0.00100, R5
0.00150, R6
0.00200, R7 0.00300,
R20 5.00000, R21 10.0000, R22 15.
, R23 20.
R24 40.
, R25 80./
PARAMETER OUTPUT(*,RAPS) RESULTS FROM MODEL RUNS WITH VARYING RAP
LOOP (RAPS,RAP=RISKAVER(RAPS);
SOLVE EVPORTFOL USING NLP MAXIMIZING OBJ ;
VAR = SUM(STOCK, SUM(STOCKS,
INVEST.L(STOCK)* COVAR(STOCK,STOCKS) * INVEST.L(STOCKS)
OUTPUT("RAP",RAPS)=RAP;
OUTPUT(STOCKS,RAPS)=INVEST.L(STOCKS);
OUTPUT("OBJ",RAPS)=OBJ.L;
OUTPUT("MEAN",RAPS)=SUM(STOCKS, MEAN(STOCKS)*invest.l(stock));
OUTPUT("VAR",RAPS) = VAR;
OUTPUT("STD",RAPS)=SQRT(VAR);
OUTPUT("SHADPRICE",RAPS)=INVESTAV.M;
OUTPUT("IDLE",RAPS)=FUNDS-INVESTAV.L); );
DISPLAY OUTPUT;
Risk Modeling and Stochastic Programming
EV Model – Example
Table 14.4.
RAP
BUYSTOCK2
BUYSTOCK3
OBJ
MEAN
VAR
STD
SHADPRICE
E-V Example Solutions for Alternative Risk Aversion Parameters
17.857
148.214
148.214
19709.821
140.392
0.296
17.857
143.287
148.214
19709.821
140.392
0.277
0.0005
1.263
16.504
138.444
146.581
16274.764
127.573
0.261
RAP
BUYSTOCK2
BUYSTOCK3
OBJ
MEAN
VAR
STD
SHADPRICE
0.0015
9.386
7.801
132.671
136.080
2272.647
47.672
0.259
0.002
10.401
6.713
131.753
134.767
1506.907
38.819
0.257
0.003
11.416
5.625
130.575
133.454
959.949
30.983
0.255
0.005
12.229
4.755
129.005
132.404
679.907
26.075
0.251
0.010
12.838
4.102
125.999
131.617
561.764
23.702
0.241
RAP
BUYSTOCK1
BUYSTOCK2
BUYSTOCK3
BUYSTOCK4
OBJ
MEAN
VAR
STD
SHADPRICE
0.011
0.012
12.893
4.043
12.960
3.972
0.015
1.273
12.420
3.550
0.025
4.372
11.070
2.561
125.441
131.545
554.929
23.557
0.239
124.614
131.459
547.587
23.401
0.236
123.380
129.839
430.560
20.750
0.234
120.375
125.939
222.576
14.919
0.230
0.050
4.405
8.188
1.753
4.168
116.805
121.656
97.026
9.850
0.224
0.100
4.105
6.488
1.340
6.829
113.118
119.327
62.086
7.879
0.214
0.300
3.905
5.354
1.064
8.602
102.254
117.774
51.734
7.193
0.173
0.500
3.865
5.128
1.009
8.957
92.010
117.463
50.905
7.135
0.133
1.000
3.835
4.958
0.968
9.223
66.674
117.230
50.556
7.110
0.032
RAP
BUYSTOCK1
BUYSTOCK2
BUYSTOCK3
BUYSTOCK4
OBJ
MEAN
VAR
STD
SHADPRICE
IDLE FUNDS
0
0.00025
0.00075
5.324
12.152
135.688
141.331
7523.441
86.738
0.260
0.001
7.355
9.977
134.245
138.705
4460.478
66.787
0.260
2.500
1.777
2.289
0.446
4.296
27.185
54.370
10.874
3.298
0
268.044
Risk Modeling and Stochastic Programming
EV Model – Example
Efficiency Frontier:
14.1. E-V Model Efficient Frontier
150
140
130
120
110
100
Mean 90
80
70
60
50
20
40
60
80
Standard Deviation
100
120
140
Risk Modeling and Stochastic Programming
Characteristics of E-V Model Optimal Solutions
Properties of optimal E-V solutions may be examined via the
Kuhn-Tucker conditions. Given
the problem
  X SX
Max C X
s.t.
AX
 b
X
 0
Its Lagrangian function is
 X ,    C X
 X SX
   AX  b 
and the Kuhn-Tucker conditions are
 / X

 / X X

X
 /  
  /   

C
C  2X S  A  0

 2X S  A X
  AX  b 
  AX  b 
 0
 0
 0
 0
 0
Risk Modeling and Stochastic Programming
Unified Model
Expected Income
Variance
=
=
sum (k,prob(k)*Income(k))
sum (k,prob(k)*(income(k)-Expected Income)**2)
Max
s.t.
inc



   pk d k
k

2

d  
 2
k



0.5
 bi for all i
aij X j
j

ckj X j

 0 for all k
Inc k
j

pk Inc k

Inc
Inc k

Inc
 0
k

d k
d k ,
X j,
Inc k ,
Inc

d k
 0
for all k
d k
 0
for all j , k


0
for all k
Risk Modeling and Stochastic Programming
Unified Model- GAMS Formulation
10
11
12
14
15
16
17
18
19
20
22
23
24
25
26
27
28
29
30
31
32
33
34
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
53
54
55
56
57
58
59
60
61
62
63
64
65
67
68
69
SETS
POTENTIAL INVESTMENTS / BUYSTOCK1*BUYSTOCK4 /
EQUALLY LIKELY RETURN STATES OF NATURE
/EVENT1*EVENT10 / ;
PRICES(STOCKS) PURCHASE PRICES OF THE STOCKS
/ BUYSTOCK1
22
BUYSTOCK2
30
BUYSTOCK3
28
BUYSTOCK4
26 / ;
PARAMETERS
STOCKS
EVENTS
SCALAR
FUNDS
TOTAL INVESTABLE FUNDS / 500 / ;
TABLE RETURNS(EVENTS,STOCKS) RETURNS BY STATE OF NATURE EVENT
BUYSTOCK1
7
8
4
5
6
3
2
5
4
3
EVENT1
EVENT2
EVENT3
EVENT4
EVENT5
EVENT6
EVENT7
EVENT8
EVENT9
EVENT10
SCALAR RAP
BUYSTOCK2
6
4
8
9
7
10
12
4
7
9
BUYSTOCK3
8
16
14
-2
13
11
-2
18
12
-5
BUYSTOCK4
5
6
6
7
6
5
6
6
5
6
RISK AVERSION PARAMETER / 0.0 / ;
POSITIVE VARIABLES
INVEST(STOCKS) MONEY INVESTED IN EACH STOCK
POSDEV(EVENTS) POSITIVE DEVIATIONS FROM MEAN INCOME
NEGDEV(EVENTS) NEGATIVE DEVIATIONS FROM MEAN INCOME
VARIABLES
OBJ
RETURN(EVENTS)
MEAN
NUMBER TO BE MAXIMIZED
RETURNS BY EVENT
MEAN RETURNS ;
EQUATIONS
OBJJ
RETURNDEF(EVENTS)
AVRET
INVESTAV
DEVIATION(EVENTS)
OBJECTIVE FUNCTION
RETURNS DEFINITION
AVERAGE RETURNS
INVESTMENT FUNDS AVAILABLE
DEVIATIONS FROM MEAN INCOME ;
OBJJ..
OBJ =E= MEAN
- RAP*(SUM(EVENTS,(POSDEV(EVENTS)+NEGDEV(EVENTS))**2)/CARD(EVENTS));
INVESTAV..
SUM(STOCKS, PRICES(STOCKS) * INVEST(STOCKS)) =L= FUNDS ;
RETURNDEF(EVENTS)..SUM(STOCKS, RETURNS(EVENTS,STOCKS) * INVEST(STOCKS))
- RETURN(EVENTS) =E= 0 ;
AVRET..
SUM(EVENTS,1/CARD(EVENTS)*RETURN(EVENTS)) - MEAN=E= 0 ;
DEVIATION(EVENTS)..RETURN(EVENTS)-MEAN -POSDEV(EVENTS) + NEGDEV(EVENTS)
=E= 0 ;
MODEL EVPORTFOL /ALL/ ;
SOLVE EVPORTFOL USING NLP MAXIMIZING OBJ ;
Risk Modeling and Stochastic Programming
Motad Model Development
Formally, the total absolute deviation of income from mean income
under the kth state of nature (Dk) is

 

Dk    ckj X j     c j X j 
 j
  j

which can be rewritten as


Dk   c kj  c j X j
j
Total absolute deviation (TAD) is the sum of Dk across the states of
nature. Now introducing deviation variables to depict positive and
negative deviations we get
TAD   Dk   d k  d k 
k
k


where  c kj  c j X j  d k  d k  0 for all k
j
The final MOTAD formulation is
Max
 cjX j   
j

k

s.t.  c kj  c j X j 
j
d

k
 d k

d k  d k
 aij X j
j
X j,
d k ,
d k

0
for all k
 bi
for all i

for all j , k
0
Risk Modeling and Stochastic Programming
Motad Model Development
Model considering only negative deviations from the mean

Max
 c j X j    dk
j

k

d k
s.t.  c kj  c j X j 
j
 aij X j
j
d k
X j,
 0
for all k
 bi
for all i
 0
for all j , k
the standard error of a normally distributed population can be
estimated given sample size N, by multiplying mean absolute deviation
(MAD), total absolute deviation (TAD), or total negative deviation
(TND) by appropriate constraints. Thus,
 
0.5
N
2 N  1
MAD 
0.5
N
2 N  1
TAD


N
2 N N  1
0.5
2
TAD 
N N  1
0.5
TND
This transformation is commonly used in MOTAD formulations such as:
 cjX j
Max

j

s.t.  c kj  c j X j
j
 
d k

 aij X j
j
 TND   d k
 0
for all k
 bi
for all i

0
k
0.5


2

 TND


N
N

1


X j,
TND,
 
d k ,
 0
  0
for all j , k
Risk Modeling and Stochastic Programming
Motad Example
This example uses the same data as in the E-V Portfolio example.
Table 14.1.
Data for E-V Example -- Returns by Stock and Event
Event1
Event2
Event3
Event4
Event5
Event6
Event7
Event8
Event9
Event10
----Stock Returns by Stock and Event---Stock1
Stock2
Stock3
Stock4
7
6
8
5
8
4
16
6
4
8
14
6
5
9
-2
7
6
7
13
6
3
10
11
5
2
12
-2
6
5
4
18
6
4
7
12
5
3
9
-5
6
Price
Stock1
22
Table 14.5.
Event1
Event2
Event3
Event4
Event5
Event6
Event7
Event8
Event9
Event10
Stock2
30
Stock3
28
Stock4
26
Deviations from the Mean for Portfolio Example
Stock1
2.3
3.3
-0.7
0.3
1.3
-1.7
-2.7
0.3
-0.7
-1.7
Stock2
-1.6
-3.6
0.4
1.4
-0.6
2.4
4.4
-3.6
-0.6
1.4
Stock3
-0.3
7.7
5.7
-10.3
4.7
2.7
-10.3
9.7
3.7
-13.3
Stock4
-0.8
0.2
0.2
1.2
0.2
-0.8
0.2
0.2
-0.8
0.2
Risk Modeling and Stochastic Programming
Motad Example
Table 14.6. Example MOTAD Model Formulation
Max
4.70
X1

7.60
X2

8.30
X3

5.80
X4
s.t.
22
X1

30
X2

28
X3

26
X4
 2.300 X1
 1.600
X2

0.300
X3
 0.800 X 4
 3.300 X1
 3.600 X 2

7.700
X3
 0.200 X 4
 0.700 X1
 0.400 X 2

5.700
X3
 0.200 X 4
 0.300 X1
 1.400
 10.300
X3
 1.200
 1.300
X1
 0.600 X 2

4.700
X3
 0.200 X 4
 1.700
X1
 2.400 X 2

2.700
X3
 0.800 X 4
 2.700 X1
 4.400 X 2
 10.300
X3
 0.200 X 4
 0.300 X1
 3.600 X 2

9.700
X3
 0.200 X 4
 0.700 X1
 0.600 X 2

3.700
X3
 0.800 X 4
 1.700
 1.400
 13.300
X3
 0.200 X 4
X1
X2
X2
X4
 γ
σ
 500
 d1

0

0

0

0

0

0

0

0

0

0
 TND

0
Δ TND  σ

0
 d 2
 d 3
 d 4
 d 5
 d 6
 d 7
 d 8
 d 9

 d10

 dk
k
Risk Modeling and Stochastic Programming
Motad Example GAMS Formulation
10
11
12
14
15
16
17
18
20
21
22
23
25
26
28
30
31
32
33
34
35
36
37
38
39
40
42
43
44
46
48
50
52
54
56
57
58
59
60
62
64
65
66
67
68
71
72
74
76
77
79
81
83
SETS
STOCKS
EVENTS
POTENTIAL INVESTMENTS / BUYSTOCK1*BUYSTOCK4 /
EQUALLY LIKELY RETURN STATES OF NATURE
/EVENT1*EVENT10 / ;
PARAMETERS
PRICES(STOCKS) PURCHASE PRICES OF THE STOCKS
/ BUYSTOCK1
22
BUYSTOCK2
30
BUYSTOCK3
28
BUYSTOCK4
26 / ;
SCALAR
FUNDS
TOTAL INVESTABLE FUNDS / 500 /
N
SAMPLE SIZE
PI
/3.141716/
TRAN
TRANSFORMATION COEF MAD TO STD ERROR ;
N=CARD(EVENTS);
TRAN = ((PI * N)/(2*(N-1)))**0.5 ;
TABLE RETURNS(EVENTS,STOCKS) RETURNS BY OBSERVATION
BUYSTOCK1
BUYSTOCK2
BUYSTOCK3
BUYSTOCK4
EVENT1
7
6
8
5
EVENT2
8
4
16
6
EVENT3
4
8
14
6
EVENT4
5
9
-2
7
EVENT5
6
7
13
6
EVENT6
3
10
11
5
EVENT7
2
12
-2
6
EVENT8
5
4
18
6
EVENT9
4
7
12
5
EVENT10
3
9
-5
6
PARAMETERS
MEAN (STOCKS)
MEAN RETURNS TO X(STOCKS)
DEVS(EVENTS,STOCKS) DEVIATIONS FROM MEAN INCOME ;
MEAN(STOCKS) = SUM(EVENTS , RETURNS(EVENTS,STOCKS) / N );
DEVS(EVENTS,STOCKS) = RETURNS(EVENTS,STOCKS) - MEAN(STOCKS) ;
DISPLAY MEAN , DEVS ;
SCALAR RAP
RISK AVERSION PARAMETER / 0.0 / ;
DISPLAY TRAN ;
POSITIVE VARIABLES INVEST(STOCKS)
MONEY INVESTED IN EACH STOCK
DEVIATION(EVENTS) DEVIATION OF TOTAL INCOME BY EVENT
TRETURN
TOTAL RETURNS
APPROXSTDE
STANDARD ERROR AS APPROXIMATED
MAD
MEAN ABSOLUTE DEVIATION
VARIABLE
OBJ
NUMBER TO BE MAXIMIZED ;
EQUATIONS
OBJJ
OBJECTIVE FUNCTION
INVESTAV
INVESTMENT FUNDS AVAILABLE
DEVIATE(EVENTS)
DEVIATION EQUATION FOR EVENTS
MADBALANCE
MEAN ABSOLUTE DEVIATION DEFINITION
SEBALANCE
STANDARD DEVIATION APPROXIMATION
OBJJ..
OBJ =E= SUM(STOCKS, MEAN(STOCKS) * INVEST(STOCKS))
- RAP*APPROXSTDE;
INVESTAV..
SUM(STOCKS, PRICES(STOCKS) * INVEST(STOCKS)) =L= FUNDS ;
DEVIATE(EVENTS).. SUM(STOCKS, DEVS(EVENTS,STOCKS)*INVEST(STOCKS))
+ DEVIATION(EVENTS) =G= 0. ;
MADBALANCE..
2*SUM(EVENTS, DEVIATION(EVENTS))/N - MAD =E= 0. ;
SEBALANCE..
TRAN*MAD - APPROXSTDE =E= 0. ;
MODEL MOTADPORTF /ALL/ ;
85 SOLVE MOTADPORTF USING LP MAXIMIZING OBJ ;
Risk Modeling and Stochastic Programming
Motad Example
Table 14.7.
RAP
BUYSTOCK2
BUYSTOCK3
OBJ
MEAN
MAD
STDAPPROX
VAR
STD
SHADPRICE
RAP
BUYSTOCK1
BUYSTOCK2
BUYSTOCK3
OBJ
MEAN
MAD
STDAPPROX
VAR
STD
SHADPRICE
MOTAD Example Solutions for Alternative Risk Aversion Parameters
0.050
0.100
0.110
17.857
148.214
148.214
122.143
161.367
19709.821
140.392
0.296
17.857
140.146
148.214
122.143
161.367
19709.821
140.392
0.280
17.857
132.078
148.214
122.143
161.367
19709.821
140.392
0.264
17.857
130.464
148.214
122.143
161.367
19709.821
140.392
0.261
0.130
0.150
0.260
0.400
11.603
5.425
129.072
133.213
24.111
31.854
883.113
29.717
0.258
11.603
5.425
128.435
133.213
24.111
31.854
883.113
29.717
0.257
11.916
5.090
125.179
132.809
22.212
29.345
771.228
27.771
0.250
12.379
4.594
121.204
132.210
20.827
27.515
643.507
25.367
0.242
0.500
2.663
10.985
3.995
118.606
129.161
15.979
21.110
455.983
21.354
0.237
0.750
5.145
10.409
2.661
1.250
2.817
5.617
1.824
8.402
108.372
119.799
6.920
9.142
83.886
9.159
0.217
1.500
2.817
5.617
1.824
8.402
106.086
119.799
6.920
9.142
83.886
9.159
0.212
1.750
2.817
5.617
1.824
8.402
103.801
119.799
6.920
9.142
83.886
9.159
0.208
5.000
2.858
4.178
1.242
10.654
76.540
117.289
6.169
8.150
57.695
7.596
0.153
10.000
2.858
4.178
1.242
10.654
35.790
117.289
6.169
8.150
57.695
7.596
0.072
12.500
2.858
4.178
1.242
10.654
15.415
117.289
6.169
8.150
57.695
7.596
0.031
RAP
BUYSTOCK1
BUYSTOCK2
BUYSTOCK3
BUYSTOCK4
OBJ
MEAN
MAD
STDAPPROX
VAR
STD
SHADPRICE
114.168
125.384
11.320
14.955
211.996
14.560
0.228
1.000
7.119
9.879
1.564
0.123
111.009
122.240
8.501
11.231
121.386
11.018
0.222
RAP
BUYSTOCK1
BUYSTOCK2
BUYSTOCK3
BUYSTOCK4
OBJ
MEAN
MAD
STDAPPROX
VAR
STD
SHADPRICE
2.000
2.817
5.617
1.824
8.402
101.515
119.799
6.920
9.142
83.886
9.159
0.203
2.500
2.817
5.617
1.824
8.402
96.944
119.799
6.920
9.142
83.886
9.159
0.194
0.120
11.603
5.425
129.390
133.213
24.111
31.854
883.113
29.717
0.259
Risk Modeling and Stochastic Programming
Motad Example
Figure 14.2. E-V and MOTAD Efficient Frontiers
150
140
130
Mean
120
110
100
90
80
70
60
50
0
20
40
60
80
100
Standard Deviation
120
140
Risk Modeling and Stochastic Programming
Motad – Nasty Assumptions
Form of Distribution
Normality
Location and Scale
Form of Utility
Exponential
Taylor Series Approximation
Risk Modeling and Stochastic Programming
Motad – Finding a Risk Aversion Parameter
The link between the E-standard error and E-V risk aversion
parameters is as follows:
Consider the models
Max cX    2  X 
s.t.
AX
X
Max cX     X 
 b versus s.t.
 0
AX
 b
X
 0
The first order conditions assuming X is nonzero are
c  2   X 
  X 
 A  0
X
c  
  X 
 A  0
X
For these two solutions to be identical in terms of X and , then



2  X 
Risk Modeling and Stochastic Programming
Safety First
The Safety First model assumes that decision makers will choose plans
to first assure a given safety level for income.
 c kj X j
 S
for all k
j
The overall problem then becomes
Max  c j X j
j
s.t.
 a ij X j
 bi
for all i
 c kj X j
 S
for all k
Xj
 0
for all j
j
j
Risk Modeling and Stochastic Programming
Safety First – Example Formulation
Table 14.8.
Example Formulation of Safety First Problem
X1
 7.60
X2
 8.30
X3
 5.80
X4
22
X1

30
X2

28
X3

26
X4
 500
7
X1

6
X2

8
X3

5
X4

S
8
X1

4
X2

16
X3

6
X4

S
4
X1

8
X2

14
X3

6
X4

S
5
X1

9
X2

2
X3

7
X4

S
6
X1

7
X2

13
X3

6
X4

S
3
X1

10
X2

11
X3

5
X4

S
2
X1

12
X2

2
X3

6
X4

S
5
X1

4
X2

18
X3

6
X4

S
4
X1

7
X2

12
X3

5
X4

S
3
X1

9
X2

5
X3

6
X4

S
Max 4.70
s.t.
Solutions
Table 14.9.
RUIN
BUYSTOCK2
BUYSTOCK3
OBJ
MEAN
VAR
STD
SHADPRICE
Note:
Safety First Example Solutions for Alternative Safety Levels
-100.000
0.0
17.857
148.214
148.214
19709.821
140.392
0.296
-50.000
2.736
14.925
144.677
144.677
12695.542
112.674
0.280
0.0
6.219
11.194
140.174
140.174
6066.388
77.887
0.280
25.000
7.960
9.328
137.923
137.923
3717.016
60.967
0.280
50.000
9.701
7.463
135.672
135.672
2011.116
44.845
0.280
The abbreviations are the same as in the previous example solutions with RUIN giving
the safety level.
Safety First – GAMS Formulation
12
13
16
17
19
22
24
26
27
28
29
30
31
32
33
34
35
36
39
40
41
43
44
45
46
47
48
49
51
52
54
55
57
58
59
60
62
65
67
68
70
72
74
75
76
78
79
80
84
86
88
90
92
93
94
95
96
97
98
99
SETS STOCKS
EVENTS
PARAMETERS
POTENTIAL INVESTMENTS / BUYSTOCK1*BUYSTOCK4 /
EQUALLY LIKELY RETURN STATES OF NATURE/EVENT1*EVENT10 / ;
PRICES(STOCKS) PURCHASE PRICES OF THE STOCKS
/ BUYSTOCK1
22, BUYSTOCK2
30
BUYSTOCK3
28, BUYSTOCK4
26 / ;
SCALAR
FUNDS
TOTAL INVESTABLE FUNDS / 500 / ;
TABLE RETURNS(EVENTS,STOCKS) RETURNS BY STATE OF NATURE EVENT
BUYSTOCK1
BUYSTOCK2
BUYSTOCK3
BUYSTOCK4
EVENT1
7
6
8
5
EVENT2
8
4
16
6
EVENT3
4
8
14
6
EVENT4
5
9
-2
7
EVENT5
6
7
13
6
EVENT6
3
10
11
5
EVENT7
2
12
-2
6
EVENT8
5
4
18
6
EVENT9
4
7
12
5
EVENT10
3
9
-5
6
SCALAR RUIN LEVEL OF SAFETY
N
SAMPLE SIZE;
N = CARD(EVENTS) ;
PARAMETER STANDERROR(STOCKS) STANDARD ERROR OF STOCKS
AVRET(STOCKS)
AVERAGE RETURN BY STOCK
;
AVRET(STOCKS)
= SUM(EVENTS,RETURNS(EVENTS,STOCKS))/N;
STANDERROR(STOCKS) = SQRT(SUM(EVENTS,
(RETURNS(EVENTS,STOCKS)-AVRET(STOCKS))*
(RETURNS(EVENTS,STOCKS)-AVRET(STOCKS))/(N-1)));
POSITIVE VARIABLES
INVEST(STOCKS)
MONEY INVESTED IN EACH STOCK
ART
ARTIFICIAL VARIABLE
VARIABLES
OBJ
NUMBER TO BE MAXIMIZED
MEAN
MEAN INCOME
EQUATIONS
OBJJ
OBJECTIVE FUNCTION
AVRETDEF
AVERAGE RETURNS DEFINITION
INVESTAV
INVESTMENT FUNDS AVAILABLE
SAFETY(EVENTS)
SAFETY EQUATION ;
OBJJ..
OBJ =E= MEAN -99999* ART;
AVRETDEF..
MEAN =E= SUM(STOCKS, AVRET(STOCKS) * INVEST(STOCKS));
INVESTAV..
SUM(STOCKS, PRICES(STOCKS) * INVEST(STOCKS)) =L=FUNDS ;
SAFETY(EVENTS)..
SUM(STOCKS,RETURNS(EVENTS,STOCKS)*INVEST(STOCKS))
+ ART =G= RUIN;
MODEL SAFETYPORT /ALL/ ;
SET RUNS
ALTERNATIVE RUIN LEVELS /R0*R6/
PARAMETER RUINLEVEL(RUNS) SAFETY LEVELS
/R0 -100,
R1 -50, R2
0, R3
25,
R4
50,
R5
75 , R6 100/
PARAMETER OUTPUT(*,RUNS) RESULTS FROM MODEL RUNS WITH VARYING RUIN LEVEL
RETURN(EVENTS) RETURN BY EVENTS
VAR
VARIANCE;
LOOP (RUNS,RUIN=RUINLEVEL(RUNS);
SOLVE SAFETYPORT USING LP MAXIMIZING OBJ ;
RETURN(EVENTS) =SUM(STOCKS, RETURNS(EVENTS,STOCKS)*INVEST.L(STOCKS));
VAR = SUM(EVENTS,(RETURN(EVENTS)-MEAN.L)*(RETURN(EVENTS)-MEAN.L))/N;
OUTPUT("RUIN",RUNS)=RUIN;
OUTPUT(STOCKS,RUNS)=INVEST.L(STOCKS);
OUTPUT("OBJ",RUNS)=OBJ.L;
OUTPUT("MEAN",RUNS)=MEAN.L;
OUTPUT("VAR",RUNS) = VAR;
OUTPUT("STD",RUNS)=SQRT(VAR);
OUTPUT("SHADPRICE",RUNS)=INVESTAV.M;
OUTPUT("IDLE",RUNS)=FUNDS-INVESTAV.L);
Risk Modeling and Stochastic Programming
Target Motad
The Target MOTAD formulation incorporates a safety level of income
while also allowing negative deviations from that safety level.
Max  c j X j
j
 bi
for all i
Dev k
 T
for all k
 p k Dev k
 
Dev k
 0
 aij X j
s.t.
j
 c kj X j

j
k
X j,
Table 14.10.
Example Formulation of Target MOTAD Problem
Max 4.70 X1
s.t.
for all j , k
 7.60 X 2
 8.30 X 3
 5.80 X 4
22
X1

X2

28
X3

26
X4
 500
7
X1

X2

8
X3

5
X4

Dev1

T
8
X1

X2

16
X3

6
X4

Dev 2

T
4
X1

X2

14
X3

6
X4

Dev 3

T
5
X1

X2

2
X3

7
X4

Dev 4

T
6
X1

X2

13
X3

6
X4

Dev 5

T
3
X1

X2

11
X3

5
X4

Dev 6

T
2
X1

X2

2
X3

6
X4

Dev 7

T
5
X1

X2

18
X3

6
X4

Dev 8

T
4
X1

X2

12
X3

5
X4

Dev 9

T
3
X1

X2

5
X3

6
X4

Dev10

T
 Dev k

λ
k
Risk Modeling and Stochastic Programming
Target Motad
Table 14.11.Target MOTAD Example Solutions for Alternative Deviation
Limits
TARGETDEV
BUYSTOCK2
BUYSTOCK3
OBJ
MEAN
VAR
STD
SHADPRICE
120.000
0.0
17.857
148.214
148.214
19709.821
140.392
0.296
TARGETDEV
BUYSTOCK1
BUYSTOCK2
BUYSTOCK3
OBJ
MEAN
VAR
STD
SHADPRICE
60.000
0.0
17.857
148.214
148.214
19709.821
140.392
0.296
8.400
0.0
11.259
5.794
133.659
133.659
1030.649
32.104
0.298
24.000
7.081
10.270
139.059
139.059
4822.705
69.446
0.286
12.000
10.193
6.936
135.037
135.037
1646.270
40.574
0.295
7.200
0.0
11.782
5.234
132.982
132.982
816.629
28.577
0.298
10.800
10.516
6.590
134.618
134.618
1433.820
37.866
0.295
3.600
3.459
11.405
2.919
127.168
127.168
277.270
16.651
0.815
Note: The abbreviations are again the same with TARGETDEV giving the
 value.
Risk Modeling and Stochastic Programming
DEMP Model
Direct Expected Maximizing Nonlinear Programming
Max  p k U Wk 
k
 bi
for all i
  c kj X j
 Wo
for all k
Xj

0

 0
 aij X j
s.t.
j
Wk
j
Wk
where
for all k
pk is the probability of the kth state of nature;
Wo is initial wealth;
Wk is the wealth under the kth state of nature; and
ckj is the return to one unit of the jth activity under the kth
state of nature.
Risk Modeling and Stochastic Programming
DEMP Model – Example
Table 14.12.
Example Formulation of DEMP Problem
Max  (Wk ) power
k
s.t.
22 X1
 30 X 2
 28 X 3
 26 X 4
 500
W1

7
X1

6
X2

X3

5
X4
 100
W2

8
X1

4
X2
 16 X 3

6
X4
 100
W3

4
X1

8
X2
 14 X 3

6
X4
 100
W4

5
X1

9
X2

X3

7
X4
 100
W5

6
X1

7
X2
 13 X 3

6
X4
 100
W6

3
X1
 10 X 2
 11 X 3

5
X4
 100
W7

2
X1
 12 X 2

X3

6
X4
 100
W8

5
X1

4
X2
 18 X 3

6
X4
 100
W9

4
X1

7
X2
 12 X 3

5
X4
 100
W10

3
X1

9
X2


6
X4
 100
8
2
2
5
X3
Risk Modeling and Stochastic Programming
DEMP Model – Example
Table 14.13.
DEMP Example Solutions for Alternative Utility Function Exponents
POWER
BUYSTOCK2
BUYSTOCK3
OBJ
MEAN
VAR
STD
SHADPRICE
0.950
0.900
17.857
140.169
248.214
19709.821
140.392
0.277
0.750
4.560
12.972
60.363
242.319
8903.295
94.357
0.269
0.500
8.563
8.683
15.282
237.144
3054.034
55.263
0.266
0.400
9.344
7.846
8.848
236.134
2309.233
48.054
0.265
17.857
186.473
248.214
19709.821
140.392
0.287
POWER
BUYSTOCK2
BUYSTOCK3
OBJ
MEAN
VAR
STD
SHADPRICE
0.300
9.919
7.230
5.127
235.390
1843.171
42.932
0.264
0.200
10.358
6.759
2.972
234.822
1534.736
39.176
0.264
0.100
10.705
6.388
1.724
234.374
1320.345
36.337
0.263
0.050
10.852
6.230
1.313
234.184
1236.951
35.170
0.263
0.030
10.907
6.171
1.177
234.113
1207.076
34.743
0.263
POWER
BUYSTOCK2
BUYSTOCK3
OBJ
MEAN
VAR
STD
SHADPRICE
0.020
10.934
6.143
1.115
234.079
1192.805
34.537
0.263
0.010
10.960
6.115
1.056
234.045
1178.961
34.336
0.263
0.001
10.960
6.115
1.005
234.045
1178.961
34.336
0.263
0.0001
10.960
6.115
1.001
234.045
1178.961
34.336
0
DEMP Model – GAMS Formulation
12
13
14
16
17
18
19
20
22
24
26
27
28
29
30
31
32
33
34
35
36
39
40
42
44
45
46
48
49
50
51
53
55
57
58
60
63
65
67
68
69
70
71
73
75
79
80
81
82
83
84
85
86
87
88
89
90
91
92
SETS
STOCKS
EVENTS
POTENTIAL INVESTMENTS / BUYSTOCK1*BUYSTOCK4 /
EQUALLY LIKELY RETURN STATES OF NATURE
/EVENT1*EVENT10 / ;
PARAMETERS
PRICES(STOCKS) PURCHASE PRICES OF THE STOCKS
/ BUYSTOCK1
22
BUYSTOCK2
30
BUYSTOCK3
28
BUYSTOCK4
26 / ;
SCALAR
FUNDS
TOTAL INVESTABLE FUNDS / 500 / ;
TABLE RETURNS(EVENTS,STOCKS) RETURNS BY STATE OF NATURE EVENT
BUYSTOCK1
BUYSTOCK2
BUYSTOCK3
BUYSTOCK4
EVENT1
7
6
8
5
EVENT2
8
4
16
6
EVENT3
4
8
14
6
EVENT4
5
9
-2
7
EVENT5
6
7
13
6
EVENT6
3
10
11
5
EVENT7
2
12
-2
6
EVENT8
5
4
18
6
EVENT9
4
7
12
5
EVENT10
3
9
-5
6
SCALAR
INITWEALTH
INITIAL WEALTH
/100/
POWER
EXPONENT IN UTILITY FUNCTION /0.5/;
POSITIVE VARIABLES
INVEST(STOCKS)
MONEY INVESTED IN EACH STOCK
VARIABLES
OBJ
NUMBER TO BE MAXIMIZED
WEALTH(EVENTS)
RETURNS BY EVENT
MEAN
MEAN RETURNS ;
EQUATIONS
OBJJ
OBJECTIVE FUNCTION
WEALTHDEF(EVENTS) WEALTHS DEFINITION
AVWEALTH
AVERAGE WEALTH
INVESTAV
INVESTMENT FUNDS AVAILABLE;
OBJJ.. OBJ =E= SUM(EVENTS,(WEALTH(EVENTS)**POWER)/CARD(EVENTS));
INVESTAV..
SUM(STOCKS, PRICES(STOCKS) * INVEST(STOCKS)) =L= FUNDS ;
WEALTHDEF(EVENTS).. WEALTH(EVENTS)
- SUM(STOCKS, RETURNS(EVENTS,STOCKS) * INVEST(STOCKS)) =E=INITWEALTH ;
AVWEALTH..
MEAN =E= SUM(EVENTS,1/CARD(EVENTS)*WEALTH(EVENTS));
MODEL EVPORTFOL /ALL/ ;
SET POWERS
UTILITY FUNCTION POWER PARAMETERS /R0*R13/
PARAMETER POWERSET(POWERS) RISK AVERSION COEF BY RISK AVERSION PARAMETER
/R0
0.95 , R1
0.9
, R2
0.75, R3
0.5 ,
R4
0.4 , R5
0.3
, R6
0.2 , R7
0.1 ,
R8
0.05 , R9
0.03 , R10 0.02, R11 0.01,
R12 0.001, R13 0.0001/
PARAMETER VAR
VARIANCE OF RETURNS
PARAMETER OUTPUT(*,POWERS) RESULTS FROM MODEL RUNS WITH VARYING EXPONENT
LOOP (POWERS,POWER=POWERSET(POWERS);
SOLVE EVPORTFOL USING NLP MAXIMIZING OBJ ;
VAR = SUM(EVENTS,(WEALTH.L(EVENTS)-MEAN.L)*(WEALTH.L(EVENTS) -MEAN.L))
/CARD(EVENTS);
OUTPUT("OBJ",POWERS)=OBJ.L;
OUTPUT("POWER",POWERS)=POWER;
OUTPUT(STOCKS,POWERS)=INVEST.L(STOCKS);
OUTPUT("MEAN",POWERS)=MEAN.L;
OUTPUT("VAR",POWERS) = VAR;
OUTPUT("STD",POWERS)=SQRT(VAR);
OUTPUT("SHADPRICE",POWERS)$(MEAN.L GT 0.001)=
INVESTAV.M/(power*mean.l**(power-1));
OUTPUT("IDLE",POWERS)=FUNDS-INVESTAV.L
);
Risk Modeling and Stochastic Programming
Chance Constrained Programming
The probability of a constraint being satisfied is greater than or equal to
a prespecified value  .

P  aij X j
 j

 bi   

If the average value of the RHS (b i ) is subtracted from both sides of the
inequality and in turn both sides are divided by the standard deviation
of the RHS  b then the constraint becomes
i
  aij X j  bi
j
P

 bi


b
i


 bi 
 

 bi

Those familiar with probability theory will note that the term
b
i
 bi

 bi
gives the number of standard errors that bi is away from the mean. Let
 ) is used,
then the appropriate value of Z is Z and the constraint becomes
  aij X j  bi
j
P

 bi


 Z   


Assuming we discount for risk, then the constraint can be restated as
 aij X j
j
 bi
 Z   bi
Risk Modeling and Stochastic Programming
Chance Constrained Programming
Table 14.14.
Chance Constrained Example Data
Event
Small Lathe
Large Lathe
1
140
90
2
120
94
3
133
88
4
154
97
5
133
87
6
142
86
7
155
90
8
140
94
9
142
89
10
141
85
Mean
140
90
Standard
9.63
3.69
Error
Then the
resultant chance constrained formulation is
Carver
120
132
110
118
133
107
120
114
123
123
120
8.00
Max
67X1 +
66X2 + 66.3X3 +
s.t
0.8X1 +
1.3X2 +
0.2X3 + 1.2X4 +
1.7X5 +
0.5X6
 140 - 9.63 Z
0.5X1 +
0.2X2 +
1.3X3 + 0.7X4 +
0.3X5 +
1.5X6

0.4X1 +
0.4X2 +
0.4X3 +
X5 +
X6
X1 + 1.05X2 +
80X4 + 78.5X5 + 78.4X6
X4 +
1.1X3 + 0.8X4 + 0.82X5 + 0.84X6
90 - 3.69 Z
 120 - 8.00 Z

125
Risk Modeling and Stochastic Programming
Chance Constrained Programming
Table 14.15. Chance Constrained Example Solutions for Alternative Alpha Levels
Z
PROFIT
SMLLATHE
LRGLATHE
CARVER
LABOR
FUNCTNORM
FANCYNORM
FANCYMXLRG
0.00
1.280
1.654
2.330
10417.291
9884.611
9728.969
9447.647
140.000
90.000
120.000
125.000
127.669
85.280
109.760
125.000
124.067
83.900
106.768
125.000
117.554
81.407
101.360
125.000
62.233
73.020
5.180
78.102
51.495
6.788
82.739
45.205
7.258
91.120
33.837
8.108
Note: Z is the risk aversion parameter.
Chance Constrained Programming
12
13
14
15
16
17
19
20
21
22
23
24
26
28
29
30
31
32
34
36
37
38
39
40
41
42
43
44
45
47
48
50
52
53
54
58
61
64
66
68
69
70
72
73
74
76
78
80
81
82
86
87
88
89
90
91
93
SET
PROCESS
TYPES OF PRODUCTION PROCESSES
/FUNCTNORM , FUNCTMXSML , FUNCTMXLRG
,FANCYNORM , FANCYMXSML , FANCYMXLRG/
RESOURCE
TYPES OF RESOURCES
/SMLLATHE,LRGLATHE,CARVER,LABOR/
EVENT
STATES OF NATURE
/S1*S10/;
PARAMETER PRICE(PROCESS)
PRODUCT PRICES BY PROCESS
/FUNCTNORM 82, FUNCTMXSML 82, FUNCTMXLRG 82
,FANCYNORM 105, FANCYMXSML 105, FANCYMXLRG 105/
PRODCOST(PROCESS)
COST BY PROCESS
/FUNCTNORM 15, FUNCTMXSML 16 , FUNCTMXLRG 15.7
,FANCYNORM 25, FANCYMXSML 26.5, FANCYMXLRG 26.6/
TABLE RESORAVAIL(RESOURCE,EVENT) RESOURCE AVAILABLITY
S1 S2 S3 S4 S5 S6 S7 S8 S9 S10
SMLLATHE 140 120 133 154 133 142 155 140 142 141
LRGLATHE
90 94 88 97 87 86 90 94 89 85
CARVER
120 132 110 118 133 107 120 114 123 123
LABOR
125 125 125 125 125 125 125 125 125 125
TABLE RESOURUSE(RESOURCE,PROCESS) RESOURCE USAGE
FUNCTNORM
FUNCTMXSML FUNCTMXLRG
SMLLATHE
0.80
1.30
0.20
LRGLATHE
0.50
0.20
1.30
CARVER
0.40
0.40
0.40
LABOR
1.00
1.05
1.10
+
FANCYNORM
FANCYMXSML FANCYMXLRG
SMLLATHE
1.20
1.70
0.50
LRGLATHE
0.70
0.30
1.50
CARVER
1.00
1.00
1.00
LABOR
0.80
0.82
0.84;
PARAMETER MEANAVAIL(RESOURCE)
MEAN AMOUNT OF RESOURCE AVAILABILITY
STDERROR (RESOURCE)
STANDARD ERROR OF RESOURCE AVAILABILITY;
SCALAR ZALPHA
CHANCE CONSTRAINT DISCOUNT FACTOR/1.96/;
MEANAVAIL(RESOURCE) = SUM(EVENT,RESORAVAIL(RESOURCE,EVENT))/CARD(EVENT);
STDERROR(RESOURCE) = SQRT(SUM(EVENT,
SQR(RESORAVAIL(RESOURCE,EVENT)-MEANAVAIL(RESOURCE)))/CARD(EVENT));
POSITIVE VARIABLES PRODUCTION(PROCESS) ITEMS PRODUCED BY PROCESS;
VARIABLES
PROFIT
TOTALPROFIT;
EQUATIONS
OBJT
OBJECTIVE FUNCTION ( PROFIT )
AVAILABLE(RESOURCE) RESOURCES AVAILABLE ;
OBJT.. PROFIT =E=
SUM(PROCESS,(PRICE(PROCESS)-PRODCOST(PROCESS))
* PRODUCTION(PROCESS)) ;
AVAILABLE(RESOURCE)..
SUM(PROCESS,RESOURUSE(RESOURCE,PROCESS)*PRODUCTION(PROCESS))
=L= MEANAVAIL(RESOURCE)-ZALPHA*STDERROR(RESOURCE);
MODEL CHANCE /ALL/;
SET ZALPH ALTERNATIVE Z VALUE IDENTIFIERS /Z1*Z4/
PARAMETER OUTPUT(*,ZALPH) RESULTS FROM MODEL RUNS WITH VARYING RAP
ZALPHS(ZALPH)
ALTERNATIVE Z ALPHA VALUES
/Z1 0.0, Z2 1.28, Z3 1.654 , Z4 2.33/
LOOP (ZALPH,ZALPHA=ZALPHS(ZALPH);
SOLVE CHANCE USING LP MAXIMIZING PROFIT ;
OUTPUT(RESOURCE,ZALPH)=MEANAVAIL(RESOURCE)-ZALPHA*STDERROR(RESOURCE);
OUTPUT("PROFIT",ZALPH)=PROFIT.L;
OUTPUT("RAP",ZALPH)=ZALPHA;
OUTPUT(PROCESS,ZALPH)=PRODUCTION.L(PROCESS));
DISPLAY OUTPUT;
Risk Modeling and Stochastic Programming
Technical Coefficient Risk
Merrill’s Approach
a constraint containing uncertain coefficients can be rewritten as
 aij X j     X j X n  inj  bi for all i
j
j
n
or, using standard deviation,
0.5


 bi
 aij X j      X j X n  inj 
j
 j k

for all i
Wicks-Guise
given that the ith constraint contains uncertain aij's, the following
constraints may be set up.
  Di
 aij X j
j

 a kij
j

 aij X j
 d ki
 d ki


 d ki
 d ki
j
 bi
 0


for all k
Di
 0
  i
 bi
for all i
 0
for all i, k
 0
for all i
 0
for all i
 0
for all j , k , i
The general Wicks Guise formulation is
 cj X j
Max
j
 aij X j
s.t.

 a kij
j
j

 aij X j
 d ki
 d ki

 d ki

 d ki
k

 Di
Di
X j,
d ki ,
d ki ,
Di ,
 i
i
Wicks-Guise Example
Table 14.16.
Table 14.17.
Feed Nutrients by State of Nature for Wicks Guise Example
Nutrient
ENERGY
ENERGY
ENERGY
ENERGY
State
S1
S2
S3
S4
CORN
1.15
1.10
1.25
1.18
SOYBEANS
0.26
0.31
0.23
0.28
WHEAT
1.05
0.95
1.08
1.12
PROTEIN
PROTEIN
PROTEIN
PROTEIN
S1
S2
S3
S4
0.23
0.17
0.25
0.15
1.12
1.08
1.01
0.99
0.51
0.59
0.46
0.56
Wicks Guise Example
Corn
Soybeans Wheat
Objective
0.03
0.06
0.04
Volume
1
1.17
0.20
 0.02
 0.07
 0.08
 0.01
1
0.27
1.05
 0.01
 0.04
 0.04
 0.01
1
1.05
0.53
 0.00
 0.10
 0.03
 0.07
Energy
Protein
Energys1
Energys2
Energys3
Energys4
EnergyMAD
EnDev
 0.02  0.01
 0.00
Proteins2
 0.07  0.04
 0.10
Proteins3
 0.08  0.04
 0.03
Proteins4
 0.01  0.01
 0.07
PrMAD Prσ


 







 d e1
 d e1


 d e2
 d e2


 d e3
 d e3


 d e4  d e4


 (d ek  d ek )/4  1
Δ
ProteinMAD
Proteinσ
Note:
PrDev

k
Energyσ
Proteins1
EnMAD Enσ
EnDev is the energy deviation
EnMAD is the energy mean absolute deviation
En is the energy standard deviation approximations
PrDev is the protein deviation
PrMAD is the protein mean absolute deviation
Pr is the protein standard deviation approximation
1
 d p1  d p1
 d p2  d p2
 d p3  d p3
 d p4  d p4


 (d pk  d pk )/4
k
1
0.8
0.5
0
0
0
0
0
 0
 0
 0
 0
 0
1
 0
Δ
1  0
Risk Modeling and Stochastic Programming
Wicks-Guise Example Solution
Table 14.18.
RAP
CORN
SOYBEANS
WHEAT
OBJ
AVGPROTEIN
STDPROTEIN
AVGENERGY
STDENERGY
SHADPROT
RAP
CORN
SOYBEANS
WHEAT
OBJ
AVGPROTEIN
STDPROTEIN
AVGENERGY
STDENERGY
SHADPROT
Note:
Results From Example Wicks Guise Model Runs With Varying RAP
0.091
0.250
0.046
0.909
0.039
0.500
0.054
1.061
0.072
0.030
0.954
0.040
0.515
0.059
1.056
0.072
0.033
0.500
0.211
0.105
0.684
0.040
0.515
0.030
0.993
0.061
0.036
1.250
0.211
0.146
0.643
0.041
0.536
0.029
0.961
0.057
0.039
1.500
0.200
0.156
0.644
0.041
0.545
0.030
0.953
0.056
0.040
2.000
0.177
0.176
0.647
0.042
0.563
0.031
0.934
0.055
0.042
0.750
0.230
0.129
0.641
0.040
0.521
0.028
0.977
0.059
0.037
RAP gives the risk aversion parameter used
CORN gives the amount of corn used in the solution
SOYBEANS gives the amount of soybeans used in the solution
WHEAT gives the amount of wheat used in the solution
OBJ gives the objective function value
AVGPROTEIN gives the average amount of protein in the diet
STDPROTEIN gives the standard error of protein in the diet
AVGENERGY gives the average amount of energy in the diet
STDENERGY gives the standard error of energy in the diet
SHADPROT gives the shadow price on the protein requirement constraint
1.000
0.221
0.137
0.642
0.041
0.529
0.029
0.969
0.058
0.038
Download