Note: This page has been translated by MathWorks. Click here to see

To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

Choose mixed integer nonlinear programming (MINLP) solver for portfolio optimization

`obj = setSolverMINLP(obj,solverTypeMINLP)`

`obj = setSolverMINLP(___,Name,Value)`

selects the mixed integer nonlinear programming (MINLP) solver and enables you to specify
associated solver options for portfolio optimization for a `obj`

= setSolverMINLP(`obj`

,`solverTypeMINLP`

)`Portfolio`

, `PortfolioCVaR`

, or `PortfolioMAD`

object.

When any one or any combination of `'Conditional'`

`BoundType`

, `MinNumAssets`

, or
`MaxNumAssets`

constraints are active, the portfolio problem is formulated by
adding `NumAssets`

binary variables. The binary variable `0`

indicates that an asset is not invested and the binary variable `1`

indicates
that an asset is invested. For more information on using `'Conditional'`

`BoundType`

, see `setBounds`

. For more information
on specifying `MinNumAssets`

and `MaxNumAssets`

, see
`setMinMaxNumAssets`

.

If you use the `estimate`

functions with a `Portfolio`

,
`PortfolioCVaR`

, or `PortfolioMAD`

object for which any of
the `'Conditional'`

`BoundType`

, `MinNumAssets`

, or
`MaxNumAssets`

constraints are active, MINLP solver is automatically used.
For details on MINLP, see Algorithms.

specifies options using one or more name-value pair arguments in addition to the input
arguments in the previous syntax.`obj`

= setSolverMINLP(___,`Name,Value`

)

You can also use dot notation to specify associated name-value pair options.

obj = obj.setSolverMINLP(Name,Value);

The `solverTypeMINLP`

and `solverOptionsMINLP`

properties cannot be set using dot notation because they are hidden properties. To set the
`solverTypeMINLP`

and `solverOptionsMINLP`

properties,
use the `setSolverMINLP`

function directly.

When any one, or any combination of `'Conditional'`

`BoundType`

, `MinNumAssets`

, or `MaxNumAssets`

constraints is active, the portfolio problem is formulated by adding `NumAssets`

binary variables. The binary variable `0`

indicates that an asset is not
invested and the binary variable `1`

indicates that an asset is invested.

The `MinNumAssets`

and `MaxNumAssets`

constraints narrow
down the number of active positions in a portfolio to the range of [*minN*,
*maxN*]. In addition, the `'Conditional'`

`BoundType`

constraint is to set a lower and upper bound so that the position is
either `0`

or lies in the range [*minWgt*,
*maxWgt*]. These two types of constraints are incorporated into the portfolio
optimization model by introducing *n* variables,
*ν*_{i}, which only take binary values
`0`

and `1`

to indicate whether the corresponding asset is
invested (`1`

) or not invested (`0`

). Here *n*
is the total number of assets and the constraints can be formulated as the following linear
inequality constraints:

$$\begin{array}{l}minN\le {\displaystyle \sum _{i=1}^{n}{\upsilon}_{i}\le}\text{}maxN\\ minWgt\ast {\upsilon}_{i}\le {x}_{i}\le maxWgt\ast {\upsilon}_{i}\\ 0\le \upsilon \le 1\\ {\upsilon}_{i}\text{areintegers}\end{array}$$

In this equation, *minN* and *maxN* are
representations for `MinNumAsset`

and `MaxNumAsset`

that are
set using `setMinMaxNumAssets`

. Also,
*minWgt* and *maxWgt* are representations for
`LowerBound`

and `UpperBound`

that are set using `setBounds`

.

The portfolio optimization problem to minimize the variance of the portfolio, subject to achieving a target expected return and some additional linear constraints on the portfolio weights, is formulated as

$$\begin{array}{l}minimiz{e}_{x}\text{}{x}^{T}Hx\\ s.t.\text{}{m}^{T}x\ge TargetReturn\\ Ax\le b\\ {A}_{eq}x={b}_{eq}\\ lb\le x\le ub\end{array}$$

In this equation, *H* represents the covariance and
*m* represents the asset returns.

The portfolio optimization problem to maximize the return, subject to an upper limit on the variance of the portfolio return and some additional linear constraints on the portfolio weights, is formulated as

$$\begin{array}{l}maximiz{e}_{x}\text{}{m}^{T}x\\ s.t.\text{}{x}^{T}Hx\le TargetRisk\\ Ax\le b\\ {A}_{eq}x={b}_{eq}\\ lb\le x\le ub\end{array}$$

When the `'Conditional'`

`BoundType`

, `MinNumAssets`

, and
`MaxNumAssets`

constraints are added to the two optimization problems, the
problems become:

$$\begin{array}{l}minimiz{e}_{x\upsilon}\text{}{x}^{T}Hx\\ s.t.\text{}{m}^{T}x\ge TargetReturn\\ A\text{'}[x;\upsilon ]\le b\text{'}\\ {A}_{eq}x={b}_{eq}\\ minN\le {\displaystyle \sum _{i=1}^{n}{\upsilon}_{i}\le maxN}\\ minWgt({\upsilon}_{i})\le {x}_{i}\le maxWgt({\upsilon}_{i})\\ lb\le x\le ub\\ 0\le \upsilon \le 1\\ {\upsilon}_{i}\text{areintegers}\end{array}$$

$$\begin{array}{l}maximiz{e}_{x\upsilon}\text{}{m}^{T}x\\ s.t.\text{}{x}^{T}Hx\ge TargetRisk\\ A\text{'}[x;\upsilon ]\le b\text{'}\\ {A}_{eq}x={b}_{eq}\\ minN\le {\displaystyle \sum _{i=1}^{n}{\upsilon}_{i}\le maxN}\\ minWgt\ast {\upsilon}_{i}\le {x}_{i}\le maxWgt({\upsilon}_{i})\\ 0\le \upsilon \le 1\\ {\upsilon}_{i}\text{areintegers}\end{array}$$

[1] Bonami, P., Kilinc, M., and J. Linderoth. "Algorithms and Software for Convex Mixed Integer Nonlinear Programs." Technical Report #1664. Computer Sciences Department, University of Wisconsin-Madison, 2009.

[2] Kelley, J. E. "The Cutting-Plane Method for Solving Convex Programs."
*Journal of the Society for Industrial and Applied Mathematics.* Vol. 8,
Number 4, 1960, pp. 703–712.

[3] Linderoth, J. and S. Wright.
"Decomposition Algorithms for Stochastic Programming on a Computational Grid."
*Computational Optimization and Applications.* Vol. 24, Issue 2–3, 2003, pp.
207–250.

[4] Nocedal, J., and S. Wright.
*Numerical Optimization.* New York: Springer-Verlag, 1999.

`estimateFrontier`

| `estimateFrontierByReturn`

| `estimateFrontierByRisk`

| `estimateFrontierLimits`

| `estimateMaxSharpeRatio`

| `setBounds`

| `setMinMaxNumAssets`

| `setSolver`

- Portfolio Optimization with Semicontinuous and Cardinality Constraints
- Mixed-Integer Quadratic Programming Portfolio Optimization: Problem-Based (Optimization Toolbox)
- Portfolio Set for Optimization Using Portfolio Object
- Choosing and Controlling the Solver for Mean-Variance Portfolio Optimization
- Choosing and Controlling the Solver for PortfolioCVaR Optimizations
- Choosing and Controlling the Solver for PortfolioMAD Optimizations