University of Chicago
Booth School of Business
Kipp Martin
February 17, 2010
1
List of Files portOptSet.gms portOptSetInclude.gms portOptSetTable.gms portOptData.dat portOptExcel.gms portOptData.xls (worksheet with data) maxCover.gams maxCover.dat maxCover.xls portOptControl.xlsm (control macro) clsGams.cls Outline
Motivation
Sets and Parameters
Separation of Model and Data
Interfacing GAMS with Excel
Another Example – Max Cover
References
Appendix – Vista
3
Motivation
Problem: How did we generate generate?
10.06*FS+17.64*IB+32.41*LG+32.36*LV+33.44*SG+24.56*SV = R1
13.12*FS+ 3.25*IB+18.71*LG+20.61*LV+19.40*SG+25.32*SV = R2
S13.47*FS+7.51*IB+33.28*LG+12.93*LV+3.85*SG-6.70*SV = R3
45.42*FS-1.33*IB+41.46*LG+7.06*LV+58.68*SG+5.43*SV = R4
-21.93*FS+7.36*IB-23.26*LG-5.37*LV-9.02*SG+17.31*SV = R5
By hand? What if I had 500 stocks and several thousand scenarios
(say daily returns rather than yearly returns)? Argh!!!
4
Motivation
In this module we are now going to combine:
Excel
VBA
GAMS
The first step is to rewrite our portfolio optimization model using sets and parameters.
5
Motivation
Our Goal:
GAMS
Excel
Data Input
Output
Excel
Control Macro
6
Motivation
Rather than write out the constraints “by hand” with all the numbers there, let’s write them in algebraic format:
OK, here we go!
7
Sets and Parameters t max
pi R i i=1 n
rji xj
= Ri ,
i = 1, . . . t
j=1
Ri
≥ ReqReti ,
i = 1, . . . t
j = 1, . . . , n indexes the set of funds i = 1, . . . , t indexes the set of scenarios
Ri , the return variable defined over the set of scenarios xj , the investment quantity variable over the set of funds rji , the return parameter defined over both the fund and scenario sets pi , the probability parameter defined over the set of scenarios
ReqReti , required return parameter defined over the set of
Sets and