## Working with CVaR Portfolio Constraints Using Defaults

The final element for a complete specification of a portfolio optimization problem is the set of feasible portfolios, which is called a portfolio set. A portfolio set $$X\subset {R}^{n}$$ is specified by construction as the intersection of sets formed by a collection of constraints on portfolio weights. A portfolio set necessarily and sufficiently must be a nonempty, closed, and bounded set.

When setting up your portfolio set, ensure that the portfolio set satisfies these
conditions. The most basic or “default” portfolio set requires portfolio
weights to be nonnegative (using the lower-bound constraint) and to sum to
`1`

(using the budget constraint). For information on the workflow
when using `PortfolioCVaR`

objects, see PortfolioCVaR Object Workflow.

### Setting Default Constraints for Portfolio Weights Using PortfolioCVaR Object

The “default” CVaR portfolio problem has two constraints on portfolio weights:

Portfolio weights must be nonnegative.

Portfolio weights must sum to

`1`

.

Implicitly, these constraints imply that portfolio weights are no
greater than `1`

, although this is a superfluous constraint to
impose on the problem.

#### Setting Default Constraints Using the PortfolioCVaR Function

Given a portfolio optimization problem with `NumAssets`

=
`20`

assets, use the `PortfolioCVaR`

object to set up a
default problem and explicitly set bounds and budget constraints:

p = PortfolioCVaR('NumAssets', 20, 'LowerBound', 0, 'Budget', 1); disp(p)

PortfolioCVaR with properties: BuyCost: [] SellCost: [] RiskFreeRate: [] ProbabilityLevel: [] Turnover: [] BuyTurnover: [] SellTurnover: [] NumScenarios: [] Name: [] NumAssets: 20 AssetList: [] InitPort: [] AInequality: [] bInequality: [] AEquality: [] bEquality: [] LowerBound: [20×1 double] UpperBound: [] LowerBudget: 1 UpperBudget: 1 GroupMatrix: [] LowerGroup: [] UpperGroup: [] GroupA: [] GroupB: [] LowerRatio: [] UpperRatio: [] MinNumAssets: [] MaxNumAssets: [] BoundType: []

#### Setting Default Constraints Using the `setDefaultConstraints`

Function

An alternative approach is to use the `setDefaultConstraints`

function.
If the number of assets is already known in a `PortfolioCVaR`

object, use `setDefaultConstraints`

with no
arguments to set up the necessary bound and budget constraints. Suppose that you
have 20 assets to set up the portfolio set for a default
problem:

```
p = PortfolioCVaR('NumAssets', 20);
p = setDefaultConstraints(p);
disp(p)
```

PortfolioCVaR with properties: BuyCost: [] SellCost: [] RiskFreeRate: [] ProbabilityLevel: [] Turnover: [] BuyTurnover: [] SellTurnover: [] NumScenarios: [] Name: [] NumAssets: 20 AssetList: [] InitPort: [] AInequality: [] bInequality: [] AEquality: [] bEquality: [] LowerBound: [20×1 double] UpperBound: [] LowerBudget: 1 UpperBudget: 1 GroupMatrix: [] LowerGroup: [] UpperGroup: [] GroupA: [] GroupB: [] LowerRatio: [] UpperRatio: [] MinNumAssets: [] MaxNumAssets: [] BoundType: [20×1 categorical]

If the number of assets is unknown, `setDefaultConstraints`

accepts
`NumAssets`

as an optional argument to form a portfolio set
for a default problem. Suppose that you have 20
assets:

p = PortfolioCVaR; p = setDefaultConstraints(p, 20); disp(p)

PortfolioCVaR with properties: BuyCost: [] SellCost: [] RiskFreeRate: [] ProbabilityLevel: [] Turnover: [] BuyTurnover: [] SellTurnover: [] NumScenarios: [] Name: [] NumAssets: 20 AssetList: [] InitPort: [] AInequality: [] bInequality: [] AEquality: [] bEquality: [] LowerBound: [20×1 double] UpperBound: [] LowerBudget: 1 UpperBudget: 1 GroupMatrix: [] LowerGroup: [] UpperGroup: [] GroupA: [] GroupB: [] LowerRatio: [] UpperRatio: [] MinNumAssets: [] MaxNumAssets: [] BoundType: [20×1 categorical]

## See Also

`PortfolioCVaR`

| `setDefaultConstraints`

| `setBounds`

| `setBudget`

| `setGroups`

| `setGroupRatio`

| `setEquality`

| `setInequality`

| `setTurnover`

| `setOneWayTurnover`

## Related Examples

- Working with 'Simple' Bound Constraints Using PortfolioCVaR Object
- Working with Budget Constraints Using PortfolioCVaR Object
- Working with Group Constraints Using PortfolioCVaR Object
- Working with Group Ratio Constraints Using PortfolioCVaR Object
- Working with Linear Equality Constraints Using PortfolioCVaR Object
- Working with Linear Inequality Constraints Using PortfolioCVaR Object
- Working with Average Turnover Constraints Using PortfolioCVaR Object
- Working with One-Way Turnover Constraints Using PortfolioCVaR Object
- Creating the PortfolioCVaR Object
- 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