Table 1. Solution of the Problem
Figure 2. Components of the optimal solution corresponding to the first value of the parameter
Problem 3 (see Formal Problem Statement) in MATLAB Environment is solved with riskconstrparam PSG subroutine.
Main MATLAB code is in file CS_CDaR_Single_Path.m.
Data are saved in file CDaR_Single_Path_data.zip.
Let us describe the main operations. To run case study you need to do the following main steps:
In file CS_CDaR_Single_Path.m:
Read annualized rates of returns of instruments in the portfolio over the time period [0,J]:
[header_matrix, matrix_arr] = read_matrix('matrix_annualized_returns.txt');
d = matrix_arr(1,2:size(matrix_arr,2)-2)';
Read scenarios of rates of returns of instruments in the portfolio:
[header_matrix, matrix_arr] = read_matrix('matrix_scenarios.txt');
H2 = matrix_arr(:,2:size(matrix_arr,2)-2);
Specify a set of values of parameter (upper bound on risk) for which runs should be conducted:
Parameters = [0.037 0.038 0.039 0.04 0.05 0.06 0.07 0.08 0.09 0.1 0.11];
Calculate number of values of the parameter:
N_Par = length(Parameters);
Read lower bounds on decision variables:
[header_point, point_arr] = read_point('point_lowerbounds.txt');
lb = point_arr';
Read upper bounds on decision variables:
[header_point, point_arr] = read_point('point_upperbounds.txt');
point_variables = strread(header_point, '%s');
ub = point_arr';
Set solver options:
options.Solver = 'VAN';
options.Precision = 6;
Set graph options:
options.PlotGraph = 'On';
options.PlotType = 1;
Optimize problem 3 for specified values of the parameter, and build efficient frontier (Figure 1):
[Objectives, Parameters, Points, GraphHandle]=riskconstrparam ([],'cdar_dev', [], [], [], [], ... 0.95, H2, [], [], d, Parameters(1), [], [], [], [], lb, ub, 'r', [],[],N_Par,... [], [], Parameters, [], options); |
Display the solution (Table 1 and Table 2):
fprintf('Points: %d\n', length(Parameters));
fprintf('Parameters (Risk) Objectives (Return)\n');
fprintf('%14f\t%14f\n', [Parameters; Objectives]);
fprintf('Optimal Points:\n');
disp(Points');
Build graph showing components of the optimal solution corresponding to the first value of the parameter (Figure 2). Here is the code for generating Figure 2:
clear x;
clear y;
i = 0;
for j=1:1:size(H2,2)
if Points(1,j)> lb(j)
i = i+1;
x(i) = point_variables(j);
y(i) = Points(1,j);
end
end
figure
bar(y,0.1,'c');
set(gca,'XTick',1:1:length(x));
hAxes = gca;
set(hAxes, 'XTickLabel', x);
grid on;
xlabel('Components of Optimal Solution Exceeding Lower Bounds');
ylabel('Componnents Values');
title('Point #1: CDaR Deviation = 0.037. Components of Optimal Solution Exceeding Lower Bounds');
Table 1. Solution of the Problem
Points: 11
Parameters (Risk) Objectives (Return)
0.037000 0.286882
0.038000 0.300157
0.039000 0.312725
0.040000 0.324784
0.050000 0.429559
0.060000 0.516013
0.070000 0.593939
0.080000 0.649262
0.090000 0.691147
0.100000 0.723623
0.110000 0.754324
Columns 1 through 5
0.20000000000000 0.20000000000000 0.20000000000000 0.20000000000000 0.20000000000000
0.20000000000000 0.20000000000000 0.20000000000000 0.20000000000000 0.43167078045502
0.20000000000000 0.20000000000000 0.20000000000000 0.20000000000000 0.26001845942643
0.20000000000000 0.20000000000000 0.20000000000000 0.20000000000000 0.39585371888494
0.34163331468675 0.37143960028128 0.41593487872535 0.46786963099904 0.80000000000000
0.20000000000000 0.20000000000000 0.20000000000000 0.20000000000000 0.20000000000000
0.20000000000000 0.20000000000000 0.20000000000000 0.20000000000000 0.25020913345086
0.20000000000000 0.20000000000000 0.20000000000000 0.20000000000000 0.25823321729114
0.36162332254605 0.41046793966276 0.44034233474915 0.48522821279092 0.45096255229332
0.68383675075672 0.61771943494888 0.58051168574132 0.55403995194221 0.80000000000000
0.36015918084364 0.38883927041552 0.39949961722976 0.45194100921354 0.65537957803785
0.39487897263463 0.57438064509461 0.70987164602330 0.80000000000000 0.80000000000000
0.57794920703754 0.55951951811963 0.57626180637577 0.53932358271143 0.80000000000000
0.20000000000000 0.20000000000000 0.20000000000000 0.20000000000000 0.20000000000000
0.20000000000000 0.20000000000000 0.20000000000000 0.20000000000000 0.20000000000000
0.20000000000000 0.20000000000000 0.20000000000000 0.20000000000000 0.20000000000000
0.20000000000000 0.20000000000000 0.20000000000000 0.20000000000000 0.20000000000000
0.20000000000000 0.20000000000000 0.20000000000000 0.20000000000000 0.20000000000000
0.20000000000000 0.20000000000000 0.20000000000000 0.20547892354296 0.80000000000000
0.20000000000000 0.20000000000000 0.20000000000000 0.20000000000000 0.20000000000000
0.20000000000000 0.20000000000000 0.20000000000000 0.20000000000000 0.20000000000000
0.20000000000000 0.20000000000000 0.22203056398251 0.22638951536029 0.47136551329841
0.20000000000000 0.20000000000000 0.20000000000000 0.20000000000000 0.20000000000000
0.20000000000000 0.20000000000000 0.20000000000000 0.20000000000000 0.20000000000000
0.20000000000000 0.20000000000000 0.20000000000000 0.20000000000000 0.20000000000000
0.54447513298983 0.55020229264269 0.56178504362119 0.56757962079096 0.72288936327901
0.20000000000000 0.20000000000000 0.20000000000000 0.20000000000000 0.20000000000000
0.20000000000000 0.20000000000000 0.20000000000000 0.20000000000000 0.20000000000000
0.30736713576311 0.34653424030503 0.38151485279013 0.40247665924114 0.60326893852948
0.20000000000000 0.20000000000000 0.20000000000000 0.20000000000000 0.20000000000000
0.20000000000000 0.20000000000000 0.20000000000000 0.20000000000000 0.20000000000000
0.27838883464360 0.29581243862453 0.30774132488592 0.35724682186014 0.44386224358270
Columns 6 through 10
0.39414575902017 0.77213848679257 0.80000000000000 0.80000000000000 0.80000000000000
0.71425395585924 0.80000000000000 0.80000000000000 0.80000000000000 0.80000000000000
0.71895639696292 0.80000000000000 0.80000000000000 0.80000000000000 0.80000000000000
0.37059876258380 0.22894144728523 0.24021686049756 0.62603605698461 0.62087699655344
0.80000000000000 0.80000000000000 0.80000000000000 0.80000000000000 0.80000000000000
0.20000000000000 0.38467209321155 0.70321900137765 0.80000000000000 0.80000000000000
0.20000000000000 0.20000000000000 0.20000000000000 0.26137416039994 0.46392052351516
0.73736905940969 0.80000000000000 0.80000000000000 0.80000000000000 0.80000000000000
0.68308273910215 0.80000000000000 0.80000000000000 0.80000000000000 0.80000000000000
0.80000000000000 0.80000000000000 0.80000000000000 0.80000000000000 0.80000000000000
0.79455876464448 0.80000000000000 0.80000000000000 0.80000000000000 0.80000000000000
0.80000000000000 0.80000000000000 0.80000000000000 0.80000000000000 0.80000000000000
0.80000000000000 0.80000000000000 0.80000000000000 0.80000000000000 0.80000000000000
0.20000000000000 0.21512390275443 0.20000000000000 0.80000000000000 0.80000000000000
0.20000000000000 0.20000000000000 0.34543926747189 0.44688141405393 0.49978650825799
0.51821753856462 0.75357144408918 0.80000000000000 0.80000000000000 0.80000000000000
0.20000000000000 0.47976012820399 0.80000000000000 0.80000000000000 0.80000000000000
0.20000000000000 0.20000000000000 0.20000000000000 0.20000000000000 0.20000000000000
0.80000000000000 0.80000000000000 0.80000000000000 0.80000000000000 0.80000000000000
0.20000000000000 0.20000000000000 0.20000000000000 0.20000000000000 0.20000000000000
0.20000000000000 0.20000000000000 0.20000000000000 0.20000000000000 0.20000000000000
0.55630448775488 0.80000000000000 0.80000000000000 0.80000000000000 0.80000000000000
0.20000000000000 0.20000000000000 0.20000000000000 0.20000000000000 0.22096134338409
0.20000000000000 0.20000000000000 0.20000000000000 0.20000000000000 0.20000000000000
0.20000000000000 0.20000000000000 0.66036335698388 0.80000000000000 0.80000000000000
0.80000000000000 0.80000000000000 0.80000000000000 0.80000000000000 0.80000000000000
0.20000000000000 0.34436552114074 0.49213316159770 0.80000000000000 0.80000000000000
0.20000000000000 0.20000000000000 0.20000000000000 0.20000000000000 0.80000000000000
0.73410977790561 0.80000000000000 0.80000000000000 0.80000000000000 0.80000000000000
0.36689358465325 0.80000000000000 0.80000000000000 0.80000000000000 0.80000000000000
0.20000000000000 0.20000000000000 0.20000000000000 0.20000000000000 0.60618302380938
0.66818214941420 0.75001542338902 0.80000000000000 0.80000000000000 0.80000000000000
Column 11
0.80000000000000
0.80000000000000
0.80000000000000
0.72948462160898
0.80000000000000
0.80000000000000
0.80000000000000
0.80000000000000
0.80000000000000
0.80000000000000
0.80000000000000
0.80000000000000
0.80000000000000
0.80000000000000
0.50989680445355
0.80000000000000
0.80000000000000
0.20000000000000
0.80000000000000
0.20000000000000
0.20000000000000
0.80000000000000
0.46545778717841
0.20000000000000
0.80000000000000
0.80000000000000
0.80000000000000
0.80000000000000
0.80000000000000
0.80000000000000
0.74560537651138
0.80000000000000
Figure 2. Components of the optimal solution corresponding to the first value of the parameter