Working with Linear Equality Constraints Using PortfolioCVaR Object
Linear equality constraints are optional linear constraints that impose systems of equalities on portfolio weights (seeLinear Equality Constraints). Linear equality constraints have propertiesAEquality
, for the equality constraint matrix, andbEquality
, for the equality constraint vector.
Setting Linear Equality Constraints Using thePortfolioCVaR
Function
The properties for linear equality constraints are set using thePortfolioCVaR
object. Suppose that you have a portfolio of five assets and want to ensure that the first three assets are 50% of your portfolio. To set this constraint:
一个= (1 1 1 0 0);b = 0.5;p = PortfolioCVaR('AEquality', A,'bEquality', b); disp(p.NumAssets) disp(p.AEquality) disp(p.bEquality)
5 1 1 1 0 0 0.5000
Setting Linear Equality Constraints Using thesetEquality
andaddEquality
Functions
You can also set the properties for linear equality constraints usingsetEquality
. Suppose that you have a portfolio of five assets and want to ensure that the first three assets are 50% of your portfolio. Given aPortfolioCVaR
objectp
, usesetEquality
to set the linear equality constraints:
一个= (1 1 1 0 0);b = 0.5;p = PortfolioCVaR; p = setEquality(p, A, b); disp(p.NumAssets) disp(p.AEquality) disp(p.bEquality)
5 1 1 1 0 0 0.5000
Suppose that you want to add another linear equality constraint to ensure that the last three assets also constitute 50% of your portfolio. You can set up an augmented system of linear equalities or useaddEquality
to build up linear equality constraints. For this example, create another system of equalities:
p = PortfolioCVaR; A = [ 1 1 1 0 0 ];% first equality constraintb = 0.5;p = setEquality(p, A, b); A = [ 0 0 1 1 1 ];% second equality constraintb = 0.5;p = addEquality(p, A, b); disp(p.NumAssets) disp(p.AEquality) disp(p.bEquality)
5 1 1 1 0 0 0 0 1 1 1 0.5000 0.5000
ThePortfolioCVaR
object,setEquality
, andaddEquality
implement scalar expansion on thebEquality
property based on the dimension of the matrix in theAEquality
property.
See Also
PortfolioCVaR
|setDefaultConstraints
|setBounds
|setBudget
|setGroups
|setGroupRatio
|setEquality
|setInequality
|setTurnover
|setOneWayTurnover
Related Examples
- Creating the PortfolioCVaR Object
- Working with CVaR Portfolio Constraints Using Defaults
- Validate the CVaR Portfolio Problem
- Estimate Efficient Portfolios for Entire Frontier for PortfolioCVaR Object
- Estimate Efficient Frontiers for PortfolioCVaR Object
- Asset Returns and Scenarios Using PortfolioCVaR Object
- Hedging Using CVaR Portfolio Optimization
- Compute Maximum Reward-to-Risk Ratio for CVaR Portfolio