%This case study demonstrates a simple (basic) setup of a single-period %portfolio optimization problem when risk is measured by CVaR. clear; load('ThisData', 'Hmatr', 'dmatr', 'Aeqmatr', 'beqvec', 'lbvec'); lambda = 100; Hmatr = [Hmatr zeros(size(Hmatr, 1), 1)]; d = zeros(size(Hmatr, 2), 1); d(end) = lambda; dmatr = [dmatr; 0]; Aeqmatr = [Aeqmatr 0.0]; lbvec = [lbvec; 0.0]; save('ThisData_Probl_2.mat', 'Hmatr', 'd', 'dmatr', 'Aeqmatr', 'beqvec', 'lbvec'); [xout, fval, exitflag, output] = riskprog('cvar_risk', 0.95, Hmatr, [], [], d, dmatr', -0.00105, Aeqmatr, beqvec, lbvec, [], ''); fprintf('Solution status = %s\n', exitflag); disp('Solution:'); disp(xout); fprintf('Data loading time = %f sec\n', output.data_loading_time); fprintf('Preprocessing time = %f sec\n', output.preprocessing_time); fprintf('Solving time = %f sec\n', output.solving_time); fprintf('Objective = %f\n', fval); fprintf('CVaR = %f\n', output.frval); fprintf('Expected return = %f\n', -output.fAval); fprintf('Expected return residual = %f\n', -output.rAval); fprintf('Budget constraint residual = %f\n', output.rAeqval); %=======================================================================| %American Optimal Decisions, Inc. Copyright | %Copyright ©American Optimal Decisions, Inc. 2007-2014. | %American Optimal Decisions (AOD) retains copyrights to this material. | % | %Permission to reproduce this document and to prepare derivative works | %from this document for internal use is granted, provided the copyright | %and “No Warranty” statements are included with all reproductions | %and derivative works. | % | %For information regarding external or commercial use of copyrighted | %materials owned by AOD, contact AOD at support@aorda.com. | %=======================================================================|