## Portfolio Set for Optimization Using Portfolio Objects

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). The most general portfolio set handled by the portfolio
optimization tools (`Portfolio`

, `PortfolioCVaR`

, and `PortfolioMAD`

objects) can have any of these constraints:

Linear inequality constraints

Linear equality constraints

`'Simple'`

Bound constraints`'Conditional'`

Bond constraintsBudget constraints

Group constraints

Group ratio constraints

Average turnover constraints

One-way turnover constraints

Tracking error constraints (only for

`Portfolio`

object)Cardinality constraints

### Linear Inequality Constraints

*Linear inequality constraints* are general linear constraints that model
relationships among portfolio weights that satisfy a system of inequalities. Use
`setInequality`

to set linear
inequality constraints. Linear inequality constraints take the form

$${A}_{I}x\le {b}_{I}$$

where:

*x* is the portfolio (*n* vector).

*A _{I}* is the linear inequality
constraint matrix (

*n*-by-

_{I}*n*matrix).

*b _{I}* is the linear inequality
constraint vector (

*n*vector).

_{I}*n* is the number of assets in the universe
and *n _{I}* is the number of
constraints.

`Portfolio`

, `PortfolioCVaR`

, and
`PortfolioMAD`

object properties to specify linear inequality
constraints are:

`AInequality`

for*A*_{I}`bInequality`

for*b*_{I}`NumAssets`

for*n*

The default is to ignore these constraints.

### Linear Equality Constraints

*Linear equality constraints* are general linear constraints that model
relationships among portfolio weights that satisfy a system of equalities. Use
`setEquality`

to set linear equality
constraints. Linear equality constraints take the form

$${A}_{E}x={b}_{E}$$

where:

*x* is the portfolio (*n* vector).

*A _{E}* is the linear equality
constraint matrix (

*n*-by-

_{E}*n*matrix).

*b _{E}* is the linear equality
constraint vector (

*n*vector).

_{E}*n* is the number of assets in the universe
and *n _{E}* is the number of
constraints.

`Portfolio`

, `PortfolioCVaR`

, and
`PortfolioMAD`

object properties to specify linear equality
constraints are:

`AEquality`

for*A*_{E}`bEquality`

for*b*_{E}`NumAssets`

for*n*

The default is to ignore these constraints.

`'Simple'`

Bound Constraints

`'Simple'`

*Bound constraints* are specialized linear constraints that
confine portfolio weights to fall either above or below specific bounds. Use
`setBounds`

to
specify bound constraints with a `'Simple'`

`BoundType`

. Since every portfolio set must be bounded, it is often
a good practice, albeit not necessary, to set explicit bounds for the portfolio
problem. To obtain explicit `'Simple'`

bounds for a given portfolio
set, use the `estimateBounds`

function. Bound
constraints take the form

$${l}_{B}\le x\le {u}_{B}$$

where:

*x* is the portfolio (*n* vector).

*l _{B}* is the lower-bound
constraint (

*n*vector).

*u _{B}* is the upper-bound
constraint (

*n*vector).

*n* is the number of assets in the universe.

`Portfolio`

, `PortfolioCVaR`

, and
`PortfolioMAD`

object properties to specify bound constraints are:

`LowerBound`

for*l*_{B}`UpperBound`

for*u*_{B}`NumAssets`

for*n*

The default is to ignore these constraints.

The default portfolio optimization problem (see Default Portfolio Problem) has *l _{B}* =

`0`

with *u*set implicitly through a budget constraint.

_{B}`'Conditional'`

Bound Constraints

`'Conditional'`

*Bound constraints*, also called semicontinuous constraints,
are mixed-integer linear constraints that confine portfolio weights to fall either
above or below specific bounds *if* the asset is selected;
otherwise, the value of the asset is zero. Use `setBounds`

to
specify bound constraints with a `'Conditional'`

`BoundType`

. To mathematically formulate this type of constraints,
a binary variable *v*_{i} is
needed. *v*_{i} = 0
indicates that asset *i* is not selected and
*v*_{i} indicates
that the asset was selected. Thus

$${l}_{i}{v}_{i}\le {x}_{i}\le {u}_{i}{v}_{i}$$

where

*x* is the portfolio (*n* vector).

*l* is the conditional lower-bound constraint
(*n* vector).

*u* is the conditional upper-bound constraint
(*n* vector).

*n* is the number of assets in the universe.

`Portfolio`

, `PortfolioCVaR`

, and
`PortfolioMAD`

object properties to specify the bound
constraint are:

`LowerBound`

for*l*_{B}`UpperBound`

for*u*_{B}`NumAssets`

for*n*

The default is to ignore this constraint.

### Budget Constraints

*Budget constraints* are specialized linear constraints that confine the
sum of portfolio weights to fall either above or below specific bounds. Use
`setBudget`

to set budget
constraints. The constraints take the form

$${l}_{S}\le {1}^{T}x\le {u}_{S}$$

where:

*x* is the portfolio (*n* vector).

`1`

is the vector of ones (*n* vector).

*l _{S}* is the lower-bound
budget constraint (scalar).

*u _{S}* is the upper-bound
budget constraint (scalar).

*n* is the number of assets in the universe.

`Portfolio`

, `PortfolioCVaR`

, and
`PortfolioMAD`

object properties to specify budget constraints are:

`LowerBudget`

for*l*_{S}`UpperBudget`

for*u*_{S}`NumAssets`

for*n*

The default is to ignore this constraint.

The default portfolio optimization problem (see Default Portfolio Problem) has *l _{S}* =

*u*=

_{S}`1`

,
which means that the portfolio weights sum to `1`

.
If the portfolio optimization problem includes possible movements
in and out of cash, the budget constraint specifies how far portfolios
can go into cash. For example, if *l*=

_{S}`0`

and *u*=

_{S}`1`

,
then the portfolio can have 0–100% invested in cash. If cash
is to be a portfolio choice, set `RiskFreeRate`

(*r*

_{0}) to a suitable value (see Return Proxy and Working with a Riskless Asset).

### Group Constraints

*Group constraints* are specialized linear constraints that enforce
“membership” among groups of assets. Use `setGroups`

to set group constraints.
The constraints take the form

$${l}_{G}\le Gx\le {u}_{G}$$

where:

*x* is the portfolio (*n* vector).

*l _{G}* is the lower-bound
group constraint (

*n*vector).

_{G}*u _{G}* is the upper-bound
group constraint (

*n*vector).

_{G}*G* is the matrix of group membership indexes
(*n _{G}*-by-

*n*matrix).

Each row of *G* identifies which assets belong
to a group associated with that row. Each row contains either `0`

s
or `1`

s with `1`

indicating that
an asset is part of the group or `0`

indicating that
the asset is not part of the group.

`Portfolio`

, `PortfolioCVaR`

, and
`PortfolioMAD`

object properties to specify group constraints
are:

`GroupMatrix`

for*G*`LowerGroup`

for*l*_{G}`UpperGroup`

for*u*_{G}`NumAssets`

for*n*

The default is to ignore these constraints.

### Group Ratio Constraints

*Group ratio constraints* are specialized linear constraints that enforce
relationships among groups of assets. Use `setGroupRatio`

to set group ratio
constraints. The constraints take the form

$${l}_{Ri}{({G}_{B}x)}_{i}\le {({G}_{A}x)}_{i}\le {u}_{Ri}{({G}_{B}x)}_{i}$$

for *i* = 1,..., *n _{R}* where:

*x* is the portfolio (*n* vector).

*l _{R}* is the vector of
lower-bound group ratio constraints (

*n*vector).

_{R}*u _{R}* is the vector matrix
of upper-bound group ratio constraints (

*n*vector).

_{R}*G _{A}* is the matrix of
base group membership indexes (

*n*-by-

_{R}*n*matrix).

*G _{B}* is the matrix of
comparison group membership indexes (

*n*-by-

_{R}*n*matrix).

*n* is the number of assets in the universe
and *n _{R}* is the number of
constraints.

Each row of *G _{A}* and

*G*identifies which assets belong to a base and comparison group associated with that row.

_{B}Each row contains either `0`

s or `1`

s
with `1`

indicating that an asset is part of the
group or `0`

indicating that the asset is not part
of the group.

`Portfolio`

, `PortfolioCVaR`

, and
`PortfolioMAD`

object properties to specify group ratio
constraints are:

`GroupA`

for*G*_{A}`GroupB`

for*G*_{B}`LowerRatio`

for*l*_{R}`UpperRatio`

for*u*_{R}`NumAssets`

for*n*

The default is to ignore these constraints.

### Average Turnover Constraints

*Turnover constraint* is a linear absolute value constraint that ensures
estimated optimal portfolios differ from an initial portfolio by no more than a
specified amount. Although portfolio turnover is defined in many ways, the turnover
constraints implemented in Financial Toolbox™ compute portfolio turnover as the average of purchases and sales. Use
`setTurnover`

to set average turnover
constraints. Average turnover constraints take the form

$$\frac{1}{2}{1}^{T}|x-{x}_{0}|\le \tau $$

where:

*x* is the portfolio (*n* vector).

`1`

is the vector of ones (*n* vector).

*x _{0}* is the initial
portfolio (

*n*vector).

*τ* is the upper bound for turnover (scalar).

*n* is the number of assets in the universe.

`Portfolio`

, `PortfolioCVaR`

, and
`PortfolioMAD`

object properties to specify the average
turnover constraint are:

`Turnover`

for*τ*`InitPort`

for*x*_{0}`NumAssets`

for*n*

The default is to ignore this constraint.

### One-Way Turnover Constraints

*One-way turnover constraints* ensure that estimated optimal portfolios
differ from an initial portfolio by no more than specified amounts according to
whether the differences are purchases or sales. Use `setOneWayTurnover`

to set one-way
turnover constraints. The constraints take the forms

$${1}^{T}\mathrm{max}\left\{0,x-{x}_{0}\right\}\le {\tau}_{B}$$

$${1}^{T}\mathrm{max}\left\{0,{x}_{0}-x\right\}\le {\tau}_{S}$$

where:

*x* is the portfolio (*n* vector)

`1`

is the vector of ones (*n* vector).

*x _{0}* is the Initial
portfolio (

*n*vector).

τ_{B} is the upper
bound for turnover constraint on purchases (scalar).

τ_{S} is the upper
bound for turnover constraint on sales (scalar).

To specify one-way turnover constraints, use the following properties in the
`Portfolio`

, `PortfolioCVaR`

, or
`PortfolioMAD`

object:

`BuyTurnover`

for τ_{B}`SellTurnover`

for τ_{S}`InitPort`

for*x*_{0}

The default is to ignore this constraint.

**Note**

The average turnover constraint (see Working with Average Turnover Constraints Using Portfolio Object) with τ is not a combination of
the one-way turnover constraints with τ =
τ_{B} =
τ_{S}.

### Tracking Error Constraints

*Tracking error constraint*, within a portfolio optimization framework,
is an additional constraint to specify the set of feasible portfolios known as a
portfolio set. Use `setTrackingError`

to set tracking
error constraints. The tracking-error constraint has the form

$${(x-{x}_{T})}^{T}C(x-{x}_{T})\le {\tau}_{T}{}^{2}$$

where:

*x* is the portfolio (*n* vector).

*x _{T}* is the tracking
portfolio against which risk is to be measured (

*n*vector).

*C* is the covariance of asset returns.

*τ _{T}* is the upper
bound for tracking error (scalar).

*n* is the number of assets in the universe.

`Portfolio`

object properties to specify the average turnover constraint are:

`TrackingPort`

for*x*_{T}`TrackingError`

for*τ*_{T}

The default is to ignore this constraint.

**Note**

The tracking error constraints can be used with any of the other supported
constraints in the `Portfolio`

object without restrictions.
However, since the portfolio set necessarily and sufficiently must be a
non-empty compact set, the application of a tracking error constraint may
result in an empty portfolio set. Use `estimateBounds`

to confirm
that the portfolio set is non-empty and compact.

### Cardinality Constraints

*Cardinality constraint* limits the number of assets in the
optimal allocation for an `Portfolio`

,
`PortfolioCVaR`

, or `PortfolioMAD`

object .
Use `setMinMaxNumAssets`

to specify the `'MinNumAssets'`

and
`'MaxNumAssets'`

constraints. To mathematically formulate this
type of constraints, a binary variable
*v*_{i} is needed.
*v*_{i} = 0 indicates
that asset *i* is not selected and
*v*_{i} = 1
indicates that the asset was selected. Thus

$$MinNumAssets\le {\displaystyle \sum _{i=1}^{NumAssets}{v}_{i}\le MaxNumAssets}$$

The default is to ignore this constraint.

## See Also

`Portfolio`

| `PortfolioCVaR`

| `PortfolioMAD`

## Related Examples

- Creating the Portfolio Object
- Working with Portfolio Constraints Using Defaults
- Asset Allocation Case Study
- Portfolio Optimization Examples Using Financial Toolbox™
- Portfolio Optimization with Semicontinuous and Cardinality Constraints
- Black-Litterman Portfolio Optimization Using Financial Toolbox™
- Portfolio Optimization Using Factor Models