如何在 Matlab 中的 CVaR 优化代码中添加约束?
How to add a constraint in CVaR optimization code in Matlab?
我想通过最小化 VaR 在多资产投资组合中找到最佳权重。 这是为目标 return.
提供最小风险的代码p = PortfolioCVaR('ProbabilityLevel', .99, 'AssetNames', names);
p = p.setScenarios(R); % R= asset returns
p = p.setDefaultConstraints();
wts = p.estimateFrontier(20);
portRisk = p.estimatePortRisk(wts);
portRet = p.estimatePortReturn(wts);
clf
visualizeFrontier(p, portRisk, portRet);
%% Compute portfolio with given level of return
tic;
wt = p.estimateFrontierByReturn(.05/100);
toc;
pRisk = p.estimatePortRisk(wt);
pRet = p.estimatePortReturn(wt);
权重总和 = 1 .. 我的问题是如何添加约束,使得任何资产的权重都不能超过 60%。 感谢您提供的任何帮助
使用对象的setBounds
属性,
>> p = setBounds(p,LowerBoundsVector,UpperBoundsVector);
见
>> doc setBounds
了解更多信息。