## When to Use Portfolio Objects Over Optimization Toolbox

While you can use Optimization Toolbox™ to solve portfolio optimization problems, Financial Toolbox™ has the `Portfolio`, `PortfolioCVaR`, and `PortfolioMAD` objects that you can use as well. Which tool you use depends on the problem case:

The following table summarizes the objective functions, constraints, and variables that apply in each case for solving a portfolio problem.

Case for Solving Portfolio ProblemObjective FunctionConstraintsInteger (Binary) Variables
"Always" case with Financial Toolbox
• Return — Gross portfolio returns or net portfolio returns

• Risk — Variance, CVaR, or MAD

• Sharpe ratio (only for mean-variance problems using `Portfolio` object)

• Continuous convex functions (only using the `Portfolio` object)

• Return — Gross portfolio returns or net portfolio returns

• Risk — Variance, CVaR, or MAD (risk constraints are only supported when the objective is the return)

• Linear equalities

• Linear inequalities

• Tracking error (only for mean-variance problems using `Portfolio` object. Not supported with custom objectives using `estimateCustomObjectivePortfolio`. Tracking error is only supported when the objective is the return, variance, or Sharpe ratio.)

• Turnover

• Bounds on the number of assets

• Conditional (semicontinuous) bounds (for example, if asset i is selected, then xilbi, otherwise xi = 0)

"Preferred" case with Financial Toolbox
• Return — Gross portfolio returns or net portfolio returns

• Risk — Variance, CVaR, or MAD

• Sharpe ratio (only for mean-variance problems using `Portfolio` object)

• Continuous functions (only using the `Portfolio` object)

• Return — Gross portfolio returns or net portfolio returns

• Risk — Variance, CVaR, or MAD (risk constraints are only supported when the objective is the return)

• Linear equalities

• Linear inequalities

• Tracking error (only for mean-variance problems using `Portfolio` object. Not supported with custom objectives using `estimateCustomObjectivePortfolio`. Tracking error is only supported when the objective is the return, variance, or Sharpe ratio.))

None
Optimization ToolboxAny other nonlinear function not mentioned in Always Use Portfolio, PortfolioCVaR, or PortfolioMAD Object and Preferred Use of Portfolio, PortfolioCVaR, or PortfolioMAD ObjectAny other nonlinear function not mentioned in Always Use Portfolio, PortfolioCVaR, or PortfolioMAD Object and Preferred Use of Portfolio, PortfolioCVaR, or PortfolioMAD Object

None

### Always Use `Portfolio`, `PortfolioCVaR`, or `PortfolioMAD` Object

The two general cases for always using the `Portfolio`, `PortfolioCVaR`, or `PortfolioMAD` object are:

• Problems with both supported nonlinear constraints and conditional bounds or bounds in the number of assets.

These problems include:

• Minimum risk problems subject to constraints for return, linear equality, linear inequality, turnover, and tracking error where the supported risk measures are variance, conditional value-at-risk (CVaR), and mean-absolute-deviation (MAD)

• Maximum return problems subject to constraints for linear equality, liner inequality, turnover, risk, and tracking error where the supported risk measures are variance, CVaR, and MAD

Tracking error is supported only for mean-variance problems using the `Portfolio` object. For more information on the supported constraints for a `Portfolio`, `PortfolioCVaR`, or `PortfolioMAD` object, see Portfolio Set for Optimization Using Portfolio Objects.

• Custom objective minimization or maximization. The custom objective function (using `estimateCustomObjectivePortfolio`) must be continuous and convex subject to constraints for return, linear equality, linear inequality, and turnover.

Tracking error is supported using the `Portfolio` object only when the objective is the return, variance or Sharpe ratio. Sharpe ratio is supported only using the `Portfolio` object.

For more information on the supported constraints and nonlinear risk functions for `Portfolio`, `PortfolioCVaR`, and `PortfolioMAD` objects, see Portfolio Set for Optimization Using Portfolio Objects and Portfolio Optimization Theory. The integer (binary) variables can come from either of the following sources: bounds on the number of assets that can be selected in the portfolio or the use of conditional (semicontinuous) bounds for the assets. For example, if asset i is selected, then xi`lb`i, otherwise xi = 0. These problems cannot be solved using the Optimization Toolbox solvers. However, you can implement your own mixed-integer solver. For more information, see Mixed-Integer Quadratic Programming Portfolio Optimization: Problem-Based.

• Problems with turnover constraints and sell or buy costs

Although the continuous version of these problems can be solved by the Optimization Toolbox solvers, the variable space must be manipulated to rewrite the nonsmooth constraints into equivalent smooth constraints. Given that rewriting the problem requires optimization knowledge, it is recommended to use the `Portfolio`, `PortfolioCVaR`, and `PortfolioMAD` objects instead.

### Preferred Use of `Portfolio`, `PortfolioCVaR`, or `PortfolioMAD` Object

The general case for preferred use of the `Portfolio`, `PortfolioCVaR`, or `PortfolioMAD` object is:

• Continuous problems with minimum risk, maximum return, and maximum Sharpe ratio that are subject to linear equality, liner inequality, turnover, and tracking error constraints.

Sharpe ratio is supported only for mean-variance problems using the `Portfolio` object. For more information on the supported constraints for a `Portfolio`, `PortfolioCVaR`, or `PortfolioMAD` object, see Portfolio Set for Optimization Using Portfolio Objects.

• Custom objective minimization or maximization. The custom objective function (using `estimateCustomObjectivePortfolio`) must be continuous and convex subject to constraints for return, linear equality, linear inequality, and turnover.

Tracking error is supported using the `Portfolio` object only when the objective is the return, variance or Sharpe ratio. Sharpe ratio is supported only using the `Portfolio` object.

The supported risk measures are variance, CVaR, and MAD. For more information on the supported constraints for these risk measures, see Portfolio Set for Optimization Using Portfolio Objects, Portfolio Set for Optimization Using PortfolioCVaR Object, and Portfolio Set for Optimization Using PortfolioMAD Object. For all other risk measures and constraints and if tracking error is in the objective, use the Optimization Toolbox.

The advantage of the `Portfolio`, `PortfolioCVaR`, and `PortfolioMAD` object framework over the problem-based framework for the type of problems in the "preferred" case is that common portfolio optimization workflows are leveraged. For example, the `Portfolio`, `PortfolioCVaR`, and `PortfolioMAD` object framework supports the following workflows:

• Estimating and plotting the efficient frontier

• Exchanging the return and risk proxies from the objective function to a constraint

• Solving the maximum Sharpe ratio problem

• Adding bounds on the number of assets selected

• Simplifying the use of turnover constraints and sell or buy costs

### Use Optimization Toolbox

The two general cases to use Optimization Toolbox is:

• Problems that have nonlinear constraints other than the constraints for risk or tracking error