Working with Linear Inequality Constraints Using PortfolioMAD Object
Linear inequality constraints are optional linear constraints that impose systems of inequalities on portfolio weights (seeLinear Inequality Constraints). Linear inequality constraints have propertiesAInequality
不等式约束矩阵,bInequality
for the inequality constraint vector.
Setting Linear Inequality Constraints Using thePortfolioMAD
Function
The properties for linear inequality constraints are set using thePortfolioMAD
object. Suppose that you have a portfolio of five assets and you want to ensure that the first three assets are no more than 50% of your portfolio. To set up these constraints:
A = [ 1 1 1 0 0 ]; b = 0.5; p = PortfolioMAD('AInequality', A,'bInequality', b); disp(p.NumAssets) disp(p.AInequality) disp(p.bInequality)
5 1 1 1 0 0 0.5000
Setting Linear Inequality Constraints Using thesetInequality
andaddInequality
Functions
You can also set the properties for linear inequality constraints usingsetInequality
. Suppose that you have a portfolio of five assets and you want to ensure that the first three assets constitute no more than 50% of your portfolio. Given aPortfolioMAD
objectp
, usesetInequality
to set the linear inequality constraints:
A = [ 1 1 1 0 0 ]; b = 0.5; p = PortfolioMAD; p = setInequality(p, A, b); disp(p.NumAssets) disp(p.AInequality) disp(p.bInequality)
5 1 1 1 0 0 0.5000
Suppose that you want to add another linear inequality constraint to ensure that the last three assets constitute at least 50% of your portfolio. You can set up an augmented system of linear inequalities or use theaddInequality
function to build up linear inequality constraints. For this example, create another system of inequalities:
p = PortfolioMAD; A = [ 1 1 1 0 0 ];% first inequality constraintb = 0.5; p = setInequality(p, A, b); A = [ 0 0 -1 -1 -1 ];% second inequality constraintb = -0.5; p = addInequality(p, A, b); disp(p.NumAssets) disp(p.AInequality) disp(p.bInequality)
5 1 1 1 0 0 0 0 -1 -1 -1 0.5000 -0.5000
ThePortfolioMAD
object,setInequality
, andaddInequality
implement scalar expansion on thebInequality
property based on the dimension of the matrix in theAInequality
property.
See Also
PortfolioMAD
|setDefaultConstraints
|setBounds
|setBudget
|setGroups
|setGroupRatio
|setEquality
|setInequality
|setTurnover
|setOneWayTurnover
Related Examples
- 设置默认约束组合权重Using PortfolioMAD Object
- Creating the PortfolioMAD Object
- Validate the MAD Portfolio Problem
- Estimate Efficient Portfolios Along the Entire Frontier for PortfolioMAD Object
- Estimate Efficient Frontiers for PortfolioMAD Object
- Asset Returns and Scenarios Using PortfolioMAD Object